@wordpress/block-editor 14.8.0 → 14.8.1-next.a9f418477.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 (290) hide show
  1. package/build/autocompleters/block.js +2 -4
  2. package/build/autocompleters/block.js.map +1 -1
  3. package/build/autocompleters/link.js +2 -4
  4. package/build/autocompleters/link.js.map +1 -1
  5. package/build/components/block-canvas/index.js +3 -6
  6. package/build/components/block-canvas/index.js.map +1 -1
  7. package/build/components/block-list/block.js +6 -5
  8. package/build/components/block-list/block.js.map +1 -1
  9. package/build/components/block-list/index.js +0 -1
  10. package/build/components/block-list/index.js.map +1 -1
  11. package/build/components/block-list/use-block-props/index.js +6 -2
  12. package/build/components/block-list/use-block-props/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +87 -0
  14. package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
  15. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +98 -5
  16. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  17. package/build/components/block-lock/modal.js +4 -4
  18. package/build/components/block-lock/modal.js.map +1 -1
  19. package/build/components/block-parent-selector/index.js +2 -15
  20. package/build/components/block-parent-selector/index.js.map +1 -1
  21. package/build/components/block-patterns-list/index.js +13 -4
  22. package/build/components/block-patterns-list/index.js.map +1 -1
  23. package/build/components/block-popover/inbetween.js +4 -0
  24. package/build/components/block-popover/inbetween.js.map +1 -1
  25. package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
  26. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  27. package/build/components/block-settings-menu-controls/index.js +1 -1
  28. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  29. package/build/components/block-switcher/index.js +12 -22
  30. package/build/components/block-switcher/index.js.map +1 -1
  31. package/build/components/block-switcher/use-transformed-patterns.js +0 -1
  32. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  33. package/build/components/block-switcher/utils.js +0 -1
  34. package/build/components/block-switcher/utils.js.map +1 -1
  35. package/build/components/block-toolbar/index.js +7 -6
  36. package/build/components/block-toolbar/index.js.map +1 -1
  37. package/build/components/block-variation-transforms/index.js +0 -1
  38. package/build/components/block-variation-transforms/index.js.map +1 -1
  39. package/build/components/date-format-picker/index.js +0 -1
  40. package/build/components/date-format-picker/index.js.map +1 -1
  41. package/build/components/font-appearance-control/index.js +1 -0
  42. package/build/components/font-appearance-control/index.js.map +1 -1
  43. package/build/components/font-family/index.js +10 -0
  44. package/build/components/font-family/index.js.map +1 -1
  45. package/build/components/global-styles/dimensions-panel.js +17 -16
  46. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  47. package/build/components/global-styles/get-global-styles-changes.js +0 -1
  48. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  49. package/build/components/iframe/use-scale-canvas.js +68 -47
  50. package/build/components/iframe/use-scale-canvas.js.map +1 -1
  51. package/build/components/inserter/block-patterns-tab/index.js +0 -10
  52. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  53. package/build/components/inserter/menu.js +2 -1
  54. package/build/components/inserter/menu.js.map +1 -1
  55. package/build/components/inserter-draggable-blocks/index.js +19 -10
  56. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  57. package/build/components/inspector-controls/slot.js +2 -13
  58. package/build/components/inspector-controls/slot.js.map +1 -1
  59. package/build/components/letter-spacing-control/index.js +10 -0
  60. package/build/components/letter-spacing-control/index.js.map +1 -1
  61. package/build/components/line-height-control/index.js +1 -0
  62. package/build/components/line-height-control/index.js.map +1 -1
  63. package/build/components/media-placeholder/index.js +18 -18
  64. package/build/components/media-placeholder/index.js.map +1 -1
  65. package/build/components/multi-selection-inspector/index.js +9 -25
  66. package/build/components/multi-selection-inspector/index.js.map +1 -1
  67. package/build/components/observe-typing/index.js +0 -1
  68. package/build/components/observe-typing/index.js.map +1 -1
  69. package/build/components/recursion-provider/index.js +0 -1
  70. package/build/components/recursion-provider/index.js.map +1 -1
  71. package/build/components/rich-text/index.js +5 -1
  72. package/build/components/rich-text/index.js.map +1 -1
  73. package/build/components/rich-text/native/use-format-types.js +0 -1
  74. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  75. package/build/components/rich-text/use-format-types.js +0 -1
  76. package/build/components/rich-text/use-format-types.js.map +1 -1
  77. package/build/components/spacing-sizes-control/utils.js +0 -1
  78. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  79. package/build/components/typewriter/index.js +0 -1
  80. package/build/components/typewriter/index.js.map +1 -1
  81. package/build/components/use-block-drop-zone/index.js +11 -2
  82. package/build/components/use-block-drop-zone/index.js.map +1 -1
  83. package/build/components/use-moving-animation/index.js +15 -2
  84. package/build/components/use-moving-animation/index.js.map +1 -1
  85. package/build/components/use-resize-canvas/index.js +1 -1
  86. package/build/components/use-resize-canvas/index.js.map +1 -1
  87. package/build/components/warning/index.js +2 -3
  88. package/build/components/warning/index.js.map +1 -1
  89. package/build/components/writing-flow/use-drag-selection.js +11 -0
  90. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  91. package/build/components/writing-flow/use-tab-nav.js +6 -2
  92. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  93. package/build/hooks/block-bindings.js +4 -3
  94. package/build/hooks/block-bindings.js.map +1 -1
  95. package/build/hooks/gap.js +1 -1
  96. package/build/hooks/gap.js.map +1 -1
  97. package/build/hooks/generated-class-name.js +0 -1
  98. package/build/hooks/generated-class-name.js.map +1 -1
  99. package/build/hooks/use-zoom-out.js +47 -14
  100. package/build/hooks/use-zoom-out.js.map +1 -1
  101. package/build/store/private-selectors.js +1 -7
  102. package/build/store/private-selectors.js.map +1 -1
  103. package/build/store/reducer.js +478 -2
  104. package/build/store/reducer.js.map +1 -1
  105. package/build/store/selectors.js +12 -55
  106. package/build/store/selectors.js.map +1 -1
  107. package/build/utils/object.js +0 -1
  108. package/build/utils/object.js.map +1 -1
  109. package/build-module/autocompleters/block.js +2 -4
  110. package/build-module/autocompleters/block.js.map +1 -1
  111. package/build-module/autocompleters/link.js +2 -4
  112. package/build-module/autocompleters/link.js.map +1 -1
  113. package/build-module/components/block-canvas/index.js +3 -6
  114. package/build-module/components/block-canvas/index.js.map +1 -1
  115. package/build-module/components/block-list/block.js +8 -7
  116. package/build-module/components/block-list/block.js.map +1 -1
  117. package/build-module/components/block-list/index.js +0 -1
  118. package/build-module/components/block-list/index.js.map +1 -1
  119. package/build-module/components/block-list/use-block-props/index.js +6 -2
  120. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  121. package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +80 -0
  122. package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
  123. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +97 -5
  124. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  125. package/build-module/components/block-lock/modal.js +4 -4
  126. package/build-module/components/block-lock/modal.js.map +1 -1
  127. package/build-module/components/block-parent-selector/index.js +2 -15
  128. package/build-module/components/block-parent-selector/index.js.map +1 -1
  129. package/build-module/components/block-patterns-list/index.js +13 -4
  130. package/build-module/components/block-patterns-list/index.js.map +1 -1
  131. package/build-module/components/block-popover/inbetween.js +4 -0
  132. package/build-module/components/block-popover/inbetween.js.map +1 -1
  133. package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
  134. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  135. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  136. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  137. package/build-module/components/block-switcher/index.js +13 -23
  138. package/build-module/components/block-switcher/index.js.map +1 -1
  139. package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
  140. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  141. package/build-module/components/block-switcher/utils.js +0 -1
  142. package/build-module/components/block-switcher/utils.js.map +1 -1
  143. package/build-module/components/block-toolbar/index.js +7 -6
  144. package/build-module/components/block-toolbar/index.js.map +1 -1
  145. package/build-module/components/block-variation-transforms/index.js +0 -1
  146. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  147. package/build-module/components/date-format-picker/index.js +0 -1
  148. package/build-module/components/date-format-picker/index.js.map +1 -1
  149. package/build-module/components/font-appearance-control/index.js +1 -0
  150. package/build-module/components/font-appearance-control/index.js.map +1 -1
  151. package/build-module/components/font-family/index.js +10 -0
  152. package/build-module/components/font-family/index.js.map +1 -1
  153. package/build-module/components/global-styles/dimensions-panel.js +17 -16
  154. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  155. package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
  156. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  157. package/build-module/components/iframe/use-scale-canvas.js +68 -47
  158. package/build-module/components/iframe/use-scale-canvas.js.map +1 -1
  159. package/build-module/components/inserter/block-patterns-tab/index.js +1 -11
  160. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  161. package/build-module/components/inserter/menu.js +2 -1
  162. package/build-module/components/inserter/menu.js.map +1 -1
  163. package/build-module/components/inserter-draggable-blocks/index.js +20 -11
  164. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  165. package/build-module/components/inspector-controls/slot.js +3 -14
  166. package/build-module/components/inspector-controls/slot.js.map +1 -1
  167. package/build-module/components/letter-spacing-control/index.js +9 -0
  168. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  169. package/build-module/components/line-height-control/index.js +1 -0
  170. package/build-module/components/line-height-control/index.js.map +1 -1
  171. package/build-module/components/media-placeholder/index.js +18 -18
  172. package/build-module/components/media-placeholder/index.js.map +1 -1
  173. package/build-module/components/multi-selection-inspector/index.js +9 -25
  174. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  175. package/build-module/components/observe-typing/index.js +0 -1
  176. package/build-module/components/observe-typing/index.js.map +1 -1
  177. package/build-module/components/recursion-provider/index.js +0 -1
  178. package/build-module/components/recursion-provider/index.js.map +1 -1
  179. package/build-module/components/rich-text/index.js +5 -1
  180. package/build-module/components/rich-text/index.js.map +1 -1
  181. package/build-module/components/rich-text/native/use-format-types.js +0 -1
  182. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  183. package/build-module/components/rich-text/use-format-types.js +0 -1
  184. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  185. package/build-module/components/spacing-sizes-control/utils.js +0 -1
  186. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  187. package/build-module/components/typewriter/index.js +0 -1
  188. package/build-module/components/typewriter/index.js.map +1 -1
  189. package/build-module/components/use-block-drop-zone/index.js +11 -2
  190. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  191. package/build-module/components/use-moving-animation/index.js +15 -2
  192. package/build-module/components/use-moving-animation/index.js.map +1 -1
  193. package/build-module/components/use-resize-canvas/index.js +1 -1
  194. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  195. package/build-module/components/warning/index.js +2 -3
  196. package/build-module/components/warning/index.js.map +1 -1
  197. package/build-module/components/writing-flow/use-drag-selection.js +11 -0
  198. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  199. package/build-module/components/writing-flow/use-tab-nav.js +6 -2
  200. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  201. package/build-module/hooks/block-bindings.js +4 -3
  202. package/build-module/hooks/block-bindings.js.map +1 -1
  203. package/build-module/hooks/gap.js +1 -1
  204. package/build-module/hooks/gap.js.map +1 -1
  205. package/build-module/hooks/generated-class-name.js +0 -1
  206. package/build-module/hooks/generated-class-name.js.map +1 -1
  207. package/build-module/hooks/use-zoom-out.js +48 -15
  208. package/build-module/hooks/use-zoom-out.js.map +1 -1
  209. package/build-module/store/private-selectors.js +1 -6
  210. package/build-module/store/private-selectors.js.map +1 -1
  211. package/build-module/store/reducer.js +479 -3
  212. package/build-module/store/reducer.js.map +1 -1
  213. package/build-module/store/selectors.js +12 -55
  214. package/build-module/store/selectors.js.map +1 -1
  215. package/build-module/utils/object.js +0 -1
  216. package/build-module/utils/object.js.map +1 -1
  217. package/build-style/content-rtl.css +18 -5
  218. package/build-style/content.css +18 -5
  219. package/build-style/style-rtl.css +25 -64
  220. package/build-style/style.css +25 -64
  221. package/package.json +32 -32
  222. package/src/autocompleters/block.js +2 -4
  223. package/src/autocompleters/link.js +2 -4
  224. package/src/components/alignment-control/stories/aliginment-toolbar.story.js +47 -0
  225. package/src/components/alignment-control/stories/index.story.js +51 -0
  226. package/src/components/alignment-control/test/__snapshots__/index.js.snap +5 -5
  227. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +4 -4
  228. package/src/components/block-canvas/index.js +3 -5
  229. package/src/components/block-draggable/content.scss +11 -5
  230. package/src/components/block-list/block.js +7 -13
  231. package/src/components/block-list/content.scss +6 -0
  232. package/src/components/block-list/use-block-props/index.js +5 -0
  233. package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +83 -0
  234. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +112 -8
  235. package/src/components/block-lock/modal.js +4 -6
  236. package/src/components/block-parent-selector/index.js +1 -19
  237. package/src/components/block-patterns-list/index.js +12 -1
  238. package/src/components/block-patterns-list/stories/fixtures.js +1 -0
  239. package/src/components/block-patterns-list/style.scss +16 -5
  240. package/src/components/block-popover/inbetween.js +4 -0
  241. package/src/components/block-settings-menu/block-settings-dropdown.js +6 -1
  242. package/src/components/block-settings-menu-controls/index.js +2 -1
  243. package/src/components/block-switcher/index.js +19 -21
  244. package/src/components/block-switcher/style.scss +0 -9
  245. package/src/components/block-title/test/index.js +2 -0
  246. package/src/components/block-toolbar/index.js +9 -6
  247. package/src/components/block-tools/style.scss +5 -0
  248. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
  249. package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +1 -1
  250. package/src/components/dimensions-tool/stories/index.story.js +1 -1
  251. package/src/components/dimensions-tool/stories/scale-tool.story.js +1 -1
  252. package/src/components/dimensions-tool/stories/width-height-tool.story.js +1 -1
  253. package/src/components/font-appearance-control/index.js +1 -0
  254. package/src/components/font-family/index.js +10 -0
  255. package/src/components/font-family/style.scss +5 -0
  256. package/src/components/global-styles/dimensions-panel.js +16 -16
  257. package/src/components/iframe/content.scss +6 -1
  258. package/src/components/iframe/use-scale-canvas.js +103 -81
  259. package/src/components/inserter/block-patterns-tab/index.js +1 -17
  260. package/src/components/inserter/menu.js +8 -1
  261. package/src/components/inserter-draggable-blocks/index.js +19 -29
  262. package/src/components/inspector-controls/slot.js +3 -22
  263. package/src/components/letter-spacing-control/README.md +2 -1
  264. package/src/components/letter-spacing-control/index.js +17 -0
  265. package/src/components/line-height-control/index.js +1 -0
  266. package/src/components/media-placeholder/index.js +25 -28
  267. package/src/components/multi-selection-inspector/index.js +17 -27
  268. package/src/components/multi-selection-inspector/style.scss +0 -12
  269. package/src/components/resolution-tool/stories/index.story.js +1 -1
  270. package/src/components/rich-text/index.js +5 -0
  271. package/src/components/spacing-sizes-control/style.scss +0 -29
  272. package/src/components/text-alignment-control/stories/index.story.js +1 -1
  273. package/src/components/use-block-drop-zone/index.js +18 -1
  274. package/src/components/use-moving-animation/index.js +15 -0
  275. package/src/components/use-resize-canvas/index.js +1 -1
  276. package/src/components/warning/index.js +3 -4
  277. package/src/components/warning/test/index.js +3 -1
  278. package/src/components/writing-flow/use-drag-selection.js +11 -0
  279. package/src/components/writing-flow/use-tab-nav.js +9 -6
  280. package/src/hooks/block-bindings.js +8 -4
  281. package/src/hooks/gap.js +1 -1
  282. package/src/hooks/use-zoom-out.js +48 -16
  283. package/src/store/private-selectors.js +2 -17
  284. package/src/store/reducer.js +639 -2
  285. package/src/store/selectors.js +19 -69
  286. package/src/store/test/private-selectors.js +1 -0
  287. package/src/store/test/reducer.js +849 -0
  288. package/src/store/test/selectors.js +4 -110
  289. package/src/style.scss +1 -0
  290. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_utils","transformMatchingBlock","match","selectedBlock","retainedBlockAttributes","getRetainedBlockAttributes","name","attributes","exports","getPatternTransformedBlocks","selectedBlocks","patternBlocks","_patternBlocks","map","block","cloneBlock","consumedBlocks","Set","isMatch","patternBlock","getMatchingBlockByName","add","clientId","useTransformedPatterns","patterns","useMemo","reduce","accumulator","_pattern","transformedBlocks","blocks","push","_default","default"],"sources":["@wordpress/block-editor/src/components/block-switcher/use-transformed-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getMatchingBlockByName, getRetainedBlockAttributes } from './utils';\n\n/**\n * Mutate the matched block's attributes by getting\n * which block type's attributes to retain and prioritize\n * them in the merging of the attributes.\n *\n * @param {WPBlock} match The matched block.\n * @param {WPBlock} selectedBlock The selected block.\n * @return {void}\n */\nexport const transformMatchingBlock = ( match, selectedBlock ) => {\n\t// Get the block attributes to retain through the transformation.\n\tconst retainedBlockAttributes = getRetainedBlockAttributes(\n\t\tselectedBlock.name,\n\t\tselectedBlock.attributes\n\t);\n\tmatch.attributes = {\n\t\t...match.attributes,\n\t\t...retainedBlockAttributes,\n\t};\n};\n\n/**\n * By providing the selected blocks and pattern's blocks\n * find the matching blocks, transform them and return them.\n * If not all selected blocks are matched, return nothing.\n *\n * @param {WPBlock[]} selectedBlocks The selected blocks.\n * @param {WPBlock[]} patternBlocks The pattern's blocks.\n * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched.\n */\nexport const getPatternTransformedBlocks = (\n\tselectedBlocks,\n\tpatternBlocks\n) => {\n\t// Clone Pattern's blocks to produce new clientIds and be able to mutate the matches.\n\tconst _patternBlocks = patternBlocks.map( ( block ) =>\n\t\tcloneBlock( block )\n\t);\n\t/**\n\t * Keep track of the consumed pattern blocks.\n\t * This is needed because we loop the selected blocks\n\t * and for example we may have selected two paragraphs and\n\t * the pattern's blocks could have more `paragraphs`.\n\t */\n\tconst consumedBlocks = new Set();\n\tfor ( const selectedBlock of selectedBlocks ) {\n\t\tlet isMatch = false;\n\t\tfor ( const patternBlock of _patternBlocks ) {\n\t\t\tconst match = getMatchingBlockByName(\n\t\t\t\tpatternBlock,\n\t\t\t\tselectedBlock.name,\n\t\t\t\tconsumedBlocks\n\t\t\t);\n\t\t\tif ( ! match ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisMatch = true;\n\t\t\tconsumedBlocks.add( match.clientId );\n\t\t\t// We update (mutate) the matching pattern block.\n\t\t\ttransformMatchingBlock( match, selectedBlock );\n\t\t\t// No need to loop through other pattern's blocks.\n\t\t\tbreak;\n\t\t}\n\t\t// Bail eary if a selected block has not been matched.\n\t\tif ( ! isMatch ) {\n\t\t\treturn;\n\t\t}\n\t}\n\treturn _patternBlocks;\n};\n\n/**\n * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern\n */\n\n/**\n * Custom hook that accepts patterns from state and the selected\n * blocks and tries to match these with the pattern's blocks.\n * If all selected blocks are matched with a Pattern's block,\n * we transform them by retaining block's attributes with `role:content`.\n * The transformed pattern's blocks are set to a new pattern\n * property `transformedBlocks`.\n *\n * @param {WPBlockPattern[]} patterns Patterns from state.\n * @param {WPBlock[]} selectedBlocks The currently selected blocks.\n * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.\n */\nconst useTransformedPatterns = ( patterns, selectedBlocks ) => {\n\treturn useMemo(\n\t\t() =>\n\t\t\tpatterns.reduce( ( accumulator, _pattern ) => {\n\t\t\t\tconst transformedBlocks = getPatternTransformedBlocks(\n\t\t\t\t\tselectedBlocks,\n\t\t\t\t\t_pattern.blocks\n\t\t\t\t);\n\t\t\t\tif ( transformedBlocks ) {\n\t\t\t\t\taccumulator.push( {\n\t\t\t\t\t\t..._pattern,\n\t\t\t\t\t\ttransformedBlocks,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] ),\n\t\t[ patterns, selectedBlocks ]\n\t);\n};\n\nexport default useTransformedPatterns;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAGA,CAAEC,KAAK,EAAEC,aAAa,KAAM;EACjE;EACA,MAAMC,uBAAuB,GAAG,IAAAC,iCAA0B,EACzDF,aAAa,CAACG,IAAI,EAClBH,aAAa,CAACI,UACf,CAAC;EACDL,KAAK,CAACK,UAAU,GAAG;IAClB,GAAGL,KAAK,CAACK,UAAU;IACnB,GAAGH;EACJ,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAI,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AASO,MAAMQ,2BAA2B,GAAGA,CAC1CC,cAAc,EACdC,aAAa,KACT;EACJ;EACA,MAAMC,cAAc,GAAGD,aAAa,CAACE,GAAG,CAAIC,KAAK,IAChD,IAAAC,kBAAU,EAAED,KAAM,CACnB,CAAC;EACD;AACD;AACA;AACA;AACA;AACA;EACC,MAAME,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC;EAChC,KAAM,MAAMd,aAAa,IAAIO,cAAc,EAAG;IAC7C,IAAIQ,OAAO,GAAG,KAAK;IACnB,KAAM,MAAMC,YAAY,IAAIP,cAAc,EAAG;MAC5C,MAAMV,KAAK,GAAG,IAAAkB,6BAAsB,EACnCD,YAAY,EACZhB,aAAa,CAACG,IAAI,EAClBU,cACD,CAAC;MACD,IAAK,CAAEd,KAAK,EAAG;QACd;MACD;MACAgB,OAAO,GAAG,IAAI;MACdF,cAAc,CAACK,GAAG,CAAEnB,KAAK,CAACoB,QAAS,CAAC;MACpC;MACArB,sBAAsB,CAAEC,KAAK,EAAEC,aAAc,CAAC;MAC9C;MACA;IACD;IACA;IACA,IAAK,CAAEe,OAAO,EAAG;MAChB;IACD;EACD;EACA,OAAON,cAAc;AACtB,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAJ,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAYA,MAAMc,sBAAsB,GAAGA,CAAEC,QAAQ,EAAEd,cAAc,KAAM;EAC9D,OAAO,IAAAe,gBAAO,EACb,MACCD,QAAQ,CAACE,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IAC7C,MAAMC,iBAAiB,GAAGpB,2BAA2B,CACpDC,cAAc,EACdkB,QAAQ,CAACE,MACV,CAAC;IACD,IAAKD,iBAAiB,EAAG;MACxBF,WAAW,CAACI,IAAI,CAAE;QACjB,GAAGH,QAAQ;QACXC;MACD,CAAE,CAAC;IACJ;IACA,OAAOF,WAAW;EACnB,CAAC,EAAE,EAAG,CAAC,EACR,CAAEH,QAAQ,EAAEd,cAAc,CAC3B,CAAC;AACF,CAAC;AAAC,IAAAsB,QAAA,GAAAxB,OAAA,CAAAyB,OAAA,GAEaV,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_blocks","_utils","transformMatchingBlock","match","selectedBlock","retainedBlockAttributes","getRetainedBlockAttributes","name","attributes","exports","getPatternTransformedBlocks","selectedBlocks","patternBlocks","_patternBlocks","map","block","cloneBlock","consumedBlocks","Set","isMatch","patternBlock","getMatchingBlockByName","add","clientId","useTransformedPatterns","patterns","useMemo","reduce","accumulator","_pattern","transformedBlocks","blocks","push","_default","default"],"sources":["@wordpress/block-editor/src/components/block-switcher/use-transformed-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getMatchingBlockByName, getRetainedBlockAttributes } from './utils';\n\n/**\n * Mutate the matched block's attributes by getting\n * which block type's attributes to retain and prioritize\n * them in the merging of the attributes.\n *\n * @param {WPBlock} match The matched block.\n * @param {WPBlock} selectedBlock The selected block.\n * @return {void}\n */\nexport const transformMatchingBlock = ( match, selectedBlock ) => {\n\t// Get the block attributes to retain through the transformation.\n\tconst retainedBlockAttributes = getRetainedBlockAttributes(\n\t\tselectedBlock.name,\n\t\tselectedBlock.attributes\n\t);\n\tmatch.attributes = {\n\t\t...match.attributes,\n\t\t...retainedBlockAttributes,\n\t};\n};\n\n/**\n * By providing the selected blocks and pattern's blocks\n * find the matching blocks, transform them and return them.\n * If not all selected blocks are matched, return nothing.\n *\n * @param {WPBlock[]} selectedBlocks The selected blocks.\n * @param {WPBlock[]} patternBlocks The pattern's blocks.\n * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched.\n */\nexport const getPatternTransformedBlocks = (\n\tselectedBlocks,\n\tpatternBlocks\n) => {\n\t// Clone Pattern's blocks to produce new clientIds and be able to mutate the matches.\n\tconst _patternBlocks = patternBlocks.map( ( block ) =>\n\t\tcloneBlock( block )\n\t);\n\t/**\n\t * Keep track of the consumed pattern blocks.\n\t * This is needed because we loop the selected blocks\n\t * and for example we may have selected two paragraphs and\n\t * the pattern's blocks could have more `paragraphs`.\n\t */\n\tconst consumedBlocks = new Set();\n\tfor ( const selectedBlock of selectedBlocks ) {\n\t\tlet isMatch = false;\n\t\tfor ( const patternBlock of _patternBlocks ) {\n\t\t\tconst match = getMatchingBlockByName(\n\t\t\t\tpatternBlock,\n\t\t\t\tselectedBlock.name,\n\t\t\t\tconsumedBlocks\n\t\t\t);\n\t\t\tif ( ! match ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisMatch = true;\n\t\t\tconsumedBlocks.add( match.clientId );\n\t\t\t// We update (mutate) the matching pattern block.\n\t\t\ttransformMatchingBlock( match, selectedBlock );\n\t\t\t// No need to loop through other pattern's blocks.\n\t\t\tbreak;\n\t\t}\n\t\t// Bail eary if a selected block has not been matched.\n\t\tif ( ! isMatch ) {\n\t\t\treturn;\n\t\t}\n\t}\n\treturn _patternBlocks;\n};\n\n/**\n * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern\n */\n\n/**\n * Custom hook that accepts patterns from state and the selected\n * blocks and tries to match these with the pattern's blocks.\n * If all selected blocks are matched with a Pattern's block,\n * we transform them by retaining block's attributes with `role:content`.\n * The transformed pattern's blocks are set to a new pattern\n * property `transformedBlocks`.\n *\n * @param {WPBlockPattern[]} patterns Patterns from state.\n * @param {WPBlock[]} selectedBlocks The currently selected blocks.\n * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.\n */\nconst useTransformedPatterns = ( patterns, selectedBlocks ) => {\n\treturn useMemo(\n\t\t() =>\n\t\t\tpatterns.reduce( ( accumulator, _pattern ) => {\n\t\t\t\tconst transformedBlocks = getPatternTransformedBlocks(\n\t\t\t\t\tselectedBlocks,\n\t\t\t\t\t_pattern.blocks\n\t\t\t\t);\n\t\t\t\tif ( transformedBlocks ) {\n\t\t\t\t\taccumulator.push( {\n\t\t\t\t\t\t..._pattern,\n\t\t\t\t\t\ttransformedBlocks,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] ),\n\t\t[ patterns, selectedBlocks ]\n\t);\n};\n\nexport default useTransformedPatterns;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAGA,CAAEC,KAAK,EAAEC,aAAa,KAAM;EACjE;EACA,MAAMC,uBAAuB,GAAG,IAAAC,iCAA0B,EACzDF,aAAa,CAACG,IAAI,EAClBH,aAAa,CAACI,UACf,CAA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B,2BAA2B,CACpDC,cAAc,EACdkB,QAAQ,CAACE,MACV,CAAC;IACD,IAAKD,iBAAiB,EAAG;MACxBF,WAAW,CAACI,IAAI,CAAE;QACjB,GAAGH,QAAQ;QACXC;MACD,CAAE,CAAC;IACJ;IACA,OAAOF,WAAW;EACnB,CAAC,EAAE,EAAG,CAAC,EACR,CAAEH,QAAQ,EAAEd,cAAc,CAC3B,CAAC;AACF,CAAC;AAAC,IAAAsB,QAAA,GAAAxB,OAAA,CAAAyB,OAAA,GAEaV,sBAAsB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","exports","getRetainedBlockAttributes","attributes","contentAttributes","getBlockAttributesNamesByRole","length","reduce","_accumulator","attribute"],"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).\n */\nexport const getMatchingBlockByName = (\n\tblock,\n\tselectedBlockName,\n\tconsumedBlocks = new Set()\n) => {\n\tconst { clientId, name, innerBlocks = [] } = block;\n\t// Check if block has been consumed already.\n\tif ( consumedBlocks.has( clientId ) ) {\n\t\treturn;\n\t}\n\tif ( name === selectedBlockName ) {\n\t\treturn block;\n\t}\n\t// Try to find a matching block from InnerBlocks recursively.\n\tfor ( const innerBlock of innerBlocks ) {\n\t\tconst match = getMatchingBlockByName(\n\t\t\tinnerBlock,\n\t\t\tselectedBlockName,\n\t\t\tconsumedBlocks\n\t\t);\n\t\tif ( match ) {\n\t\t\treturn match;\n\t\t}\n\t}\n};\n\n/**\n * Find and return the block attributes to retain through\n * the transformation, based on Block Type's `role:content`\n * attributes. If no `role:content` attributes exist,\n * return selected block's attributes.\n *\n * @param {string} name Block type's namespaced name.\n * @param {Object} attributes Selected block's attributes.\n * @return {Object} The block's attributes to retain.\n */\nexport const getRetainedBlockAttributes = ( name, attributes ) => {\n\tconst contentAttributes = getBlockAttributesNamesByRole( name, 'content' );\n\tif ( ! contentAttributes?.length ) {\n\t\treturn attributes;\n\t}\n\n\treturn contentAttributes.reduce( ( _accumulator, attribute ) => {\n\t\tif ( attributes[ attribute ] ) {\n\t\t\t_accumulator[ attribute ] = attributes[ attribute ];\n\t\t}\n\t\treturn _accumulator;\n\t}, {} );\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAGA,CACrCC,KAAK,EACLC,iBAAiB,EACjBC,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC,KACtB;EACJ,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,WAAW,GAAG;EAAG,CAAC,GAAGN,KAAK;EAClD;EACA,IAAKE,cAAc,CAACK,GAAG,CAAEH,QAAS,CAAC,EAAG;IACrC;EACD;EACA,IAAKC,IAAI,KAAKJ,iBAAiB,EAAG;IACjC,OAAOD,KAAK;EACb;EACA;EACA,KAAM,MAAMQ,UAAU,IAAIF,WAAW,EAAG;IACvC,MAAMG,KAAK,GAAGV,sBAAsB,CACnCS,UAAU,EACVP,iBAAiB,EACjBC,cACD,CAAC;IACD,IAAKO,KAAK,EAAG;MACZ,OAAOA,KAAK;IACb;EACD;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATAC,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAUO,MAAMY,0BAA0B,GAAGA,CAAEN,IAAI,EAAEO,UAAU,KAAM;EACjE,MAAMC,iBAAiB,GAAG,IAAAC,qCAA6B,EAAET,IAAI,EAAE,SAAU,CAAC;EAC1E,IAAK,CAAEQ,iBAAiB,EAAEE,MAAM,EAAG;IAClC,OAAOH,UAAU;EAClB;EAEA,OAAOC,iBAAiB,CAACG,MAAM,CAAE,CAAEC,YAAY,EAAEC,SAAS,KAAM;IAC/D,IAAKN,UAAU,CAAEM,SAAS,CAAE,EAAG;MAC9BD,YAAY,CAAEC,SAAS,CAAE,GAAGN,UAAU,CAAEM,SAAS,CAAE;IACpD;IACA,OAAOD,YAAY;EACpB,CAAC,EAAE,CAAC,CAAE,CAAC;AACR,CAAC;AAACP,OAAA,CAAAC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","exports","getRetainedBlockAttributes","attributes","contentAttributes","getBlockAttributesNamesByRole","length","reduce","_accumulator","attribute"],"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).\n */\nexport const getMatchingBlockByName = (\n\tblock,\n\tselectedBlockName,\n\tconsumedBlocks = new Set()\n) => {\n\tconst { clientId, name, innerBlocks = [] } = block;\n\t// Check if block has been consumed already.\n\tif ( consumedBlocks.has( clientId ) ) {\n\t\treturn;\n\t}\n\tif ( name === selectedBlockName ) {\n\t\treturn block;\n\t}\n\t// Try to find a matching block from InnerBlocks recursively.\n\tfor ( const innerBlock of innerBlocks ) {\n\t\tconst match = getMatchingBlockByName(\n\t\t\tinnerBlock,\n\t\t\tselectedBlockName,\n\t\t\tconsumedBlocks\n\t\t);\n\t\tif ( match ) {\n\t\t\treturn match;\n\t\t}\n\t}\n};\n\n/**\n * Find and return the block attributes to retain through\n * the transformation, based on Block Type's `role:content`\n * attributes. If no `role:content` attributes exist,\n * return selected block's attributes.\n *\n * @param {string} name Block type's namespaced name.\n * @param {Object} attributes Selected block's attributes.\n * @return {Object} The block's attributes to retain.\n */\nexport const getRetainedBlockAttributes = ( name, attributes ) => {\n\tconst contentAttributes = getBlockAttributesNamesByRole( name, 'content' );\n\tif ( ! contentAttributes?.length ) {\n\t\treturn attributes;\n\t}\n\n\treturn contentAttributes.reduce( ( _accumulator, attribute ) => {\n\t\tif ( attributes[ attribute ] ) {\n\t\t\t_accumulator[ attribute ] = attributes[ attribute ];\n\t\t}\n\t\treturn _accumulator;\n\t}, {} );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAGA,CACrCC,KAAK,EACLC,iBAAiB,EACjBC,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC,KACtB;EACJ,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,WAAW,GAAG;EAAG,CAAC,GAAGN,KAAK;EAClD;EACA,IAAKE,cAAc,CAACK,GAAG,CAAEH,QAAS,CAAC,EAAG;IACrC;EACD;EACA,IAAKC,IAAI,KAAKJ,iBAAiB,EAAG;IACjC,OAAOD,KAAK;EACb;EACA;EACA,KAAM,MAAMQ,UAAU,IAAIF,WAAW,EAAG;IACvC,MAAMG,KAAK,GAAGV,sBAAsB,CACnCS,UAAU,EACVP,iBAAiB,EACjBC,cACD,CAAC;IACD,IAAKO,KAAK,EAAG;MACZ,OAAOA,KAAK;IACb;EACD;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATAC,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAUO,MAAMY,0BAA0B,GAAGA,CAAEN,IAAI,EAAEO,UAAU,KAAM;EACjE,MAAMC,iBAAiB,GAAG,IAAAC,qCAA6B,EAAET,IAAI,EAAE,SAAU,CAAC;EAC1E,IAAK,CAAEQ,iBAAiB,EAAEE,MAAM,EAAG;IAClC,OAAOH,UAAU;EAClB;EAEA,OAAOC,iBAAiB,CAACG,MAAM,CAAE,CAAEC,YAAY,EAAEC,SAAS,KAAM;IAC/D,IAAKN,UAAU,CAAEM,SAAS,CAAE,EAAG;MAC9BD,YAAY,CAAEC,SAAS,CAAE,GAAGN,UAAU,CAAEM,SAAS,CAAE;IACpD;IACA,OAAOD,YAAY;EACpB,CAAC,EAAE,CAAC,CAAE,CAAC;AACR,CAAC;AAACP,OAAA,CAAAC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -113,6 +113,7 @@ function PrivateBlockToolbar({
113
113
 
114
114
  // If one or more selected blocks are locked, do not show the BlockGroupToolbar.
115
115
  const _hasTemplateLock = selectedBlockClientIds.some(id => getTemplateLock(id) === 'contentOnly');
116
+ const _isZoomOut = isZoomOut();
116
117
  return {
117
118
  blockClientId: selectedBlockClientId,
118
119
  blockClientIds: selectedBlockClientIds,
@@ -120,15 +121,15 @@ function PrivateBlockToolbar({
120
121
  blockType: selectedBlockClientId && (0, _blocks.getBlockType)(_blockName),
121
122
  shouldShowVisualToolbar: isValid && isVisual,
122
123
  toolbarKey: `${selectedBlockClientId}${parentClientId}`,
123
- showParentSelector: !isZoomOut() && parentBlockType && getBlockEditingMode(parentClientId) !== 'disabled' && (0, _blocks.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length === 1,
124
+ showParentSelector: !_isZoomOut && parentBlockType && editingMode !== 'contentOnly' && getBlockEditingMode(parentClientId) !== 'disabled' && (0, _blocks.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length === 1,
124
125
  isUsingBindings: _isUsingBindings,
125
126
  hasParentPattern: _hasParentPattern,
126
127
  hasContentOnlyLocking: _hasTemplateLock,
127
- showShuffleButton: isZoomOut(),
128
- showSlots: !isZoomOut(),
129
- showGroupButtons: !isZoomOut(),
130
- showLockButtons: !isZoomOut(),
131
- showSwitchSectionStyleButton: isZoomOut(),
128
+ showShuffleButton: _isZoomOut,
129
+ showSlots: !_isZoomOut,
130
+ showGroupButtons: !_isZoomOut,
131
+ showLockButtons: !_isZoomOut,
132
+ showSwitchSectionStyleButton: _isZoomOut,
132
133
  hasFixedToolbar: getSettings().hasFixedToolbar,
133
134
  isNavigationMode: _isNavigationMode()
134
135
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_changeDesign","_switchSectionStyle","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","showShuffleButton","showSlots","showGroupButtons","showLockButtons","showSwitchSectionStyleButton","hasFixedToolbar","isNavigationMode","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getSettings","getParentSectionBlock","isZoomOut","_isNavigationMode","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowSwitchSectionStyleButton,\n\t\thasFixedToolbar,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetSettings,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! isZoomOut() &&\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: isZoomOut(),\n\t\t\tshowSlots: ! isZoomOut(),\n\t\t\tshowGroupButtons: ! isZoomOut(),\n\t\t\tshowLockButtons: ! isZoomOut(),\n\t\t\tshowSwitchSectionStyleButton: isZoomOut(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tisNavigationMode: _isNavigationMode(),\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t\t'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,sBAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,iBAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,mBAAA,GAAApB,OAAA;AACA,IA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kC,CAAE,CAAC,eACnE,IAAArF,WAAA,CAAAkF,GAAA,EAAChG,cAAA,CAAAiG,OAAa,CAACY,IAAI;UAClBC,KAAK,EAAC,QAAQ;UACdX,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAArF,WAAA,CAAAkF,GAAA,EAAChG,cAAA,CAAAiG,OAAa,CAACY,IAAI;UAClBC,KAAK,EAAC,OAAO;UACbX,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAArF,WAAA,CAAAkF,GAAA,EAACxF,iBAAA,CAAAyF,OAA0B,CAACc,QAAQ;UACnCC,KAAK,EAAGxF,SAAS,EAAEyF,IAAM;UAAAX,QAAA,eAEzB,IAAAxF,WAAA,CAAAkF,GAAA,EAAC/F,qBAAA,CAAAgG,OAA8B,CAACY,IAAI,IAAE;QAAC,CACH,CAAC;MAAA,CACrC,CACF,eACD,IAAA/F,WAAA,CAAAkF,GAAA,EAAC3F,wBAAA,CAAA4F,OAAuB;QAACQ,SAAS,EAAGnF;MAAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAAkF,GAAA,EAAC9F,kBAAA,CAAA+F,OAAiB;QAACQ,SAAS,EAAGnF;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GAlEAG,UAmEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASyF,YAAYA,CAAE;EAAElG,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAkF,GAAA,EAACjF,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAGoF,SAAW;IAC1BnF,0BAA0B,EAAGmF,SAAW;IACxClF,2BAA2B,EAAGkF;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_changeDesign","_switchSectionStyle","_lockUnlock","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","hasContentOnlyLocking","showShuffleButton","showSlots","showGroupButtons","showLockButtons","showSwitchSectionStyleButton","hasFixedToolbar","isNavigationMode","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","getTemplateLock","getSettings","getParentSectionBlock","isZoomOut","_isNavigationMode","unlock","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","parentSection","parentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","_hasTemplateLock","some","_isZoomOut","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","BlockLockToolbar","BlockGroupToolbar","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowSwitchSectionStyleButton,\n\t\thasFixedToolbar,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t\tgetTemplateLock,\n\t\t\tgetSettings,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _isZoomOut,\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tisNavigationMode: _isNavigationMode(),\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t\t'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t! hasParentPattern && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ ! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ showSwitchSectionStyleButton && (\n\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && showSlots && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AAK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AAgB,CAAE,CAAC,eACxD,IAAAR,WAAA,CAAAmF,GAAA,EAAC/F,kBAAA,CAAAgG,OAAiB;QAACQ,SAAS,EAAGpF;MAAgB,CAAE,CAAC;IAAA,CAC9C;EAAC,GAlEAG,UAmEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS0F,YAAYA,CAAE;EAAEnG,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAmF,GAAA,EAAClF,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAGqF,SAAW;IAC1BpF,0BAA0B,EAAGoF,SAAW;IACxCnF,2BAA2B,EAAGmF;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","hasContentRoleAttribute","unlock","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tif ( ! variations?.length || isContentOnly ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW,iBAAiBA,CAAE;EAC3BC,SAAS;EACTC,iBAAiB;EACjBC,aAAa;EACbC;AACD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kBAAkB;EAEvE,oBACC,IAAA3B,WAAA,CAAAQ,GAAA,EAACyE,SAAS;IACT/E,SAAS,EAAG4E,SAAW;IACvB3E,iBAAiB,EAAGA,iBAAmB;IACvCC,aAAa,EAAGA,aAAe;IAC/BC,UAAU,EAAGA;EAAY,CACzB,CAAC;AAEJ;AAAC,IAAA6E,QAAA,GAAAC,OAAA,CAAAjE,OAAA,GAEc+B,sCAAsC","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","hasContentRoleAttribute","unlock","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tif ( ! variations?.length || isContentOnly ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW,iBAAiBA,CAAE;EAC3BC,SAAS;EACTC,iBAAiB;EACjBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAL,WAAA,CAAAM,IAAA;IAAUJ,SAAS,EAAGA,SAAW;IAAAK,QAAA,gBAChC,IAAAP,WAAA,CAAAQ,GAAA,EAAChB,WAAA,CAAAiB,cAAc;MAACC,EAAE,EAAC,QAAQ;MAAAH,QAAA,EACxB,IAAAI,QAAE,EAAE,wBAAyB;IAAC,CACjB,CAAC,EACfN,UAAU,CAACO,GAAG,CAAIC,SAAS,iBAC5B,IAAAb,WAAA,CAAAQ,GAAA,EAAChB,WAAA,CAAAsB,MAAM;MACNC,qBAAqB;M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@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_date","_element","_components","_jsxRuntime","exampleDate","Date","setDate","setMonth","getMonth","DateFormatPicker","format","defaultFormat","onChange","jsxs","className","children","jsx","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","humanTimeDiff","customOption","hint","isCustom","setIsCustom","useState","some","option","__experimentalVStack","CustomSelectControl","__next40pxDefaultSize","options","value","find","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tCustomSelectControl,\n} from '@wordpress/components';\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somwhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\thint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAO+B,IAAAI,WAAA,GAAAJ,OAAA;AAb/B;AACA;AACA;;AAaA;AACA;AACA,MAAMK,WAAW,GAAG,IAAIC,IAAI,CAAC,CAAC;AAC9BD,WAAW,CAACE,OAAO,CAAE,EAAG,CAAC;AACzBF,WAAW,CAACG,QAAQ,CAAEH,WAAW,CAACI,QAAQ,CAAC,CAAC,GAAG,CAAE,CAAC;AAClD,IAAKJ,WAAW,CAACI,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAG;EACnC;EACAJ,WAAW,CAACG,QAAQ,CAAE,CAAE,CAAC;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,gBAAgBA,CAAE;EACzCC,MAAM;EACNC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAT,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B,qBAAA,cAAAA,qBAAA,GAAIW,YACR;MACD1B,QAAQ,EAAGA,CAAE;QAAEuC;MAAa,CAAC,KAAM;QAClC,IAAKA,YAAY,KAAKb,YAAY,EAAG;UACpCG,WAAW,CAAE,IAAK,CAAC;QACpB,CAAC,MAAM;UACNA,WAAW,CAAE,KAAM,CAAC;UACpB7B,QAAQ,CAAEuC,YAAY,CAACzC,MAAO,CAAC;QAChC;MACD;IAAG,CACH,CAAC,EACA8B,QAAQ,iBACT,IAAArC,WAAA,CAAAa,GAAA,EAACd,WAAA,CAAAkD,WAAW;MACXL,qBAAqB;MACrB1B,uBAAuB;MACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,eAAgB,CAAG;MAC/BkC,mBAAmB;MACnB9B,IAAI,EAAG,IAAA+B,iCAAwB,EAC9B,IAAAnC,QAAE,EACD,kDACD,CAAC,EACD;QACCoC,IAAI,eACH,IAAApD,WAAA,CAAAa,GAAA,EAACd,WAAA,CAAAsD,YAAY;UACZC,IAAI,EAAG,IAAAtC,QAAE,EACR,6EACD;QAAG,CACH;MAEH,CACD,CAAG;MACH8B,KAAK,EAAGvC,MAAQ;MAChBE,QAAQ,EAAKqC,KAAK,IAAMrC,QAAQ,CAAEqC,KAAM;IAAG,CAC3C,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_date","_element","_components","_jsxRuntime","exampleDate","Date","setDate","setMonth","getMonth","DateFormatPicker","format","defaultFormat","onChange","jsxs","className","children","jsx","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","humanTimeDiff","customOption","hint","isCustom","setIsCustom","useState","some","option","__experimentalVStack","CustomSelectControl","__next40pxDefaultSize","options","value","find","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tCustomSelectControl,\n} from '@wordpress/components';\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somwhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\thint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\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AAE,eAAgB,CAAG;MAC/BkC,mBAAmB;MACnB9B,IAAI,EAAG,IAAA+B,iCAAwB,EAC9B,IAAAnC,QAAE,EACD,kDACD,CAAC,EACD;QACCoC,IAAI,eACH,IAAApD,WAAA,CAAAa,GAAA,EAACd,WAAA,CAAAsD,YAAY;UACZC,IAAI,EAAG,IAAAtC,QAAE,EACR,6EACD;QAAG,CACH;MAEH,CACD,CAAG;MACH8B,KAAK,EAAGvC,MAAQ;MAChBE,QAAQ,EAAKqC,KAAK,IAAMrC,QAAQ,CAAEqC,KAAM;IAAG,CAC3C,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
@@ -156,6 +156,7 @@ function FontAppearanceControl(props) {
156
156
  ...otherProps,
157
157
  className: "components-font-appearance-control",
158
158
  __next40pxDefaultSize: __next40pxDefaultSize,
159
+ __shouldNotWarnDeprecated36pxSize: true,
159
160
  label: label,
160
161
  describedBy: getDescribedBy(),
161
162
  options: selectOptions,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","_jsxRuntime","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","__next40pxDefaultSize","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","getFontStylesAndWeights","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","sprintf","jsx","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t\t__next40pxDefaultSize = false,\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAH,OAAA;AAAkF,IAAAI,WAAA,GAAAJ,OAAA;AAVlF;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMK,sBAAsB,GAAGA,CAAEC,aAAa,EAAEC,cAAc,KAAM;EACnE,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAAE,QAAE,EAAE,aAAc,CAAC;EAC3B;EAEA,IAAK,CAAED,cAAc,EAAG;IACvB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,OAAO,IAAAA,QAAE,EAAE,YAAa,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;IACL;IACAC,qBAAqB,GAAG,KAAK;IAC7BC,QAAQ;IACRN,aAAa,GAAG,IAAI;IACpBC,cAAc,GAAG,IAAI;IACrBM,eAAe;IACfC,KAAK,EAAE;MAAEC,SAAS;MAAEC;IAAW,CAAC;IAChC,GAAGC;EACJ,CAAC,GAAGP,KAAK;EACT,MAAMQ,kBAAkB,GAAGZ,aAAa,IAAIC,c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mB;IAAA,GACd3B,UAAU;IACf4B,SAAS,EAAC,oCAAoC;IAC9ClC,qBAAqB,EAAGA,qBAAuB;IAC/CQ,KAAK,EAAGA,KAAO;IACf2B,WAAW,EAAGL,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGF,aAAe;IACzBrB,KAAK,EAAGwB,gBAAkB;IAC1B1B,QAAQ,EAAGA,CAAE;MAAEmC;IAAa,CAAC,KAC5BnC,QAAQ,CAAEmC,YAAY,CAACxB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","_jsxRuntime","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","__next40pxDefaultSize","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","getFontStylesAndWeights","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","sprintf","jsx","CustomSelectControl","className","__shouldNotWarnDeprecated36pxSize","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t\t__next40pxDefaultSize = false,\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAH,OAAA;AAAkF,IAAAI,WAAA,GAAAJ,OAAA;AAVlF;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMK,sBAAsB,GAAGA,CAAEC,aAAa,EAAEC,cAAc,KAAM;EACnE,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAAE,QAAE,EAAE,aAAc,CAAC;EAC3B;EAEA,IAAK,CAAED,cAAc,EAAG;IACvB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,OAAO,IAAAA,QAAE,EAAE,YAAa,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;IACL;IACAC,qBAAqB,GAAG,KAAK;IAC7BC,QAAQ;IACRN,aAAa,GAAG,IAAI;IACpBC,cAAc,GAAG,IAAI;IACrBM,eAAe;IACfC,KAAK,EAAE;MAAEC,SAAS;MAAEC;IAAW,CAAC;IAChC,GAAGC;EACJ,CAAC,GAAGP,KAAK;EACT,MAAMQ,kBAAkB,GAAGZ,aAAa,IAAIC,cAAc;EAC1D,MAAMY,KAAK,GAAGd,sBAAsB,CAAEC,aAAa,EAAEC,cAAe,CAAC;EACrE,MAAMa,aAAa,GAAG;IACrBC,GAAG,EAAE,SAAS;IACdC,IAAI,EAAE,IAAAd,QAAE,EAAE,SAAU,CAAC;IACrBe,KAAK,EAAE;MAAER,SAAS,EAAES,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EAAGwB,gBAAkB;IAC1B1B,QAAQ,EAAGA,CAAE;MAAEoC;IAAa,CAAC,KAC5BpC,QAAQ,CAAEoC,YAAY,CAACzB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
@@ -5,11 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = FontFamilyControl;
8
+ var _clsx = _interopRequireDefault(require("clsx"));
8
9
  var _components = require("@wordpress/components");
9
10
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
10
11
  var _i18n = require("@wordpress/i18n");
11
12
  var _useSettings = require("../use-settings");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * External dependencies
16
+ */
17
+
13
18
  /**
14
19
  * WordPress dependencies
15
20
  */
@@ -26,6 +31,7 @@ function FontFamilyControl({
26
31
  value = '',
27
32
  onChange,
28
33
  fontFamilies,
34
+ className,
29
35
  ...props
30
36
  }) {
31
37
  const [blockLevelFontFamilies] = (0, _useSettings.useSettings)('typography.fontFamilies');
@@ -57,12 +63,16 @@ function FontFamilyControl({
57
63
  }
58
64
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomSelectControl, {
59
65
  __next40pxDefaultSize: __next40pxDefaultSize,
66
+ __shouldNotWarnDeprecated36pxSize: true,
60
67
  label: (0, _i18n.__)('Font'),
61
68
  value: value,
62
69
  onChange: ({
63
70
  selectedItem
64
71
  }) => onChange(selectedItem.key),
65
72
  options: options,
73
+ className: (0, _clsx.default)('block-editor-font-family-control', className, {
74
+ 'is-next-has-no-margin-bottom': __nextHasNoMarginBottom
75
+ }),
66
76
  ...props
67
77
  });
68
78
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_deprecated","_interopRequireDefault","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","key","name","__","map","fontFamily","style","deprecated","since","version","hint","jsx","CustomSelectControl","label","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{\n\t\t\tkey: '',\n\t\t\tname: __( 'Default' ),\n\t\t},\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => ( {\n\t\t\tkey: fontFamily,\n\t\t\tname: name || fontFamily,\n\t\t\tstyle: { fontFamily },\n\t\t} ) ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<CustomSelectControl\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }\n\t\t\toptions={ options }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;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QAAE,EAAE,MAAO,CAAG;IACtBV,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,CAAE;MAAEoB;IAAa,CAAC,KAAMpB,QAAQ,CAAEoB,YAAY,CAACb,GAAI,CAAG;IACjED,OAAO,EAAGA,OAAS;IAAA,GACdJ;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_deprecated","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","fontFamilies","className","props","blockLevelFontFamilies","useSettings","length","options","key","name","__","map","fontFamily","style","deprecated","since","version","hint","jsx","CustomSelectControl","__shouldNotWarnDeprecated36pxSize","label","selectedItem","clsx"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\tclassName,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{\n\t\t\tkey: '',\n\t\t\tname: __( 'Default' ),\n\t\t},\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => ( {\n\t\t\tkey: fontFamily,\n\t\t\tname: name || fontFamily,\n\t\t\tstyle: { fontFamily },\n\t\t} ) ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<CustomSelectControl\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( { selectedItem } ) => onChange( selectedItem.key ) }\n\t\t\toptions={ options }\n\t\t\tclassName={ clsx( 'block-editor-font-family-control', className, {\n\t\t\t\t'is-next-has-no-margin-bottom': __nextHasNoMarginBottom,\n\t\t\t} ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAf9C;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,iBAAiBA,CAAE;EAC1C;EACAC,qBAAqB,GAAG,KAAK;EAC7B;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEJ,YAAY,EAAG;IACrBA,YAAY,GAAGG,sBAAsB;EACtC;EAEA,IAAK,CAAEH,YAAY,IAAIA,YAAY,CAACK,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IACCC,GAAG,EAAE,EAAE;IACPC,IAAI,EAAE,IAAAC,QAAE,EAAE,SAAU;EACrB,CAAC,EACD,GAAGT,YAAY,CAACU,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEH;EAAK,CAAC,MAAQ;IAClDD,GAAG,EAAEI,UAAU;IACfH,IAAI,EAAEA,IAAI,IAAIG,UAAU;IACxBC,KAAK,EAAE;MAAED;IAAW;EACrB,CAAC,CAAG,CAAC,CACL;EAED,IAAK,CAAEd,uBAAuB,EAAG;IAChC,IAAAgB,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACP,CACD,CAAC;EACF;EAEA,oBACC,IAAAtB,WAAA,CAAAuB,GAAA,EAAC3B,WAAA,CAAA4B,mBAAmB;IACnBtB,qBAAqB,EAAGA,qBAAuB;IAC/CuB,iCAAiC;IACjCC,KAAK,EAAG,IAAAX,QAAE,EAAE,MAAO,CAAG;IACtBX,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,CAAE;MAAEsB;IAAa,CAAC,KAAMtB,QAAQ,CAAEsB,YAAY,CAACd,GAAI,CAAG;IACjED,OAAO,EAAGA,OAAS;IACnBL,SAAS,EAAG,IAAAqB,aAAI,EAAE,kCAAkC,EAAErB,SAAS,EAAE;MAChE,8BAA8B,EAAEJ;IACjC,CAAE,CAAG;IAAA,GACAK;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -357,16 +357,6 @@ function DimensionsPanel({
357
357
  };
358
358
  }, []);
359
359
  const onMouseLeaveControls = () => onVisualize(false);
360
- const inputProps = {
361
- min: minMarginValue,
362
- onDragStart: () => {
363
- //Reset to 0 in case the value was negative.
364
- setMinMarginValue(0);
365
- },
366
- onDragEnd: () => {
367
- setMinMarginValue(minimumMargin);
368
- }
369
- };
370
360
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
371
361
  resetAllFilter: resetAllFilter,
372
362
  value: value,
@@ -437,8 +427,10 @@ function DimensionsPanel({
437
427
  units: units,
438
428
  allowReset: false,
439
429
  splitOnAxis: isAxialPadding,
440
- onMouseOver: onMouseOverPadding,
441
- onMouseOut: onMouseLeaveControls
430
+ inputProps: {
431
+ onMouseOver: onMouseOverPadding,
432
+ onMouseOut: onMouseLeaveControls
433
+ }
442
434
  }), showSpacingPresetsControl && /*#__PURE__*/(0, _jsxRuntime.jsx)(_spacingSizesControl.default, {
443
435
  values: paddingValues,
444
436
  onChange: setPaddingValues,
@@ -462,14 +454,23 @@ function DimensionsPanel({
462
454
  __next40pxDefaultSize: true,
463
455
  values: marginValues,
464
456
  onChange: setMarginValues,
465
- inputProps: inputProps,
457
+ inputProps: {
458
+ min: minMarginValue,
459
+ onDragStart: () => {
460
+ // Reset to 0 in case the value was negative.
461
+ setMinMarginValue(0);
462
+ },
463
+ onDragEnd: () => {
464
+ setMinMarginValue(minimumMargin);
465
+ },
466
+ onMouseOver: onMouseOverMargin,
467
+ onMouseOut: onMouseLeaveControls
468
+ },
466
469
  label: (0, _i18n.__)('Margin'),
467
470
  sides: marginSides,
468
471
  units: units,
469
472
  allowReset: false,
470
- splitOnAxis: isAxialMargin,
471
- onMouseOver: onMouseOverMargin,
472
- onMouseOut: onMouseLeaveControls
473
+ splitOnAxis: isAxialMargin
473
474
  }), showSpacingPresetsControl && /*#__PURE__*/(0, _jsxRuntime.jsx)(_spacingSizesControl.default, {
474
475
  values: marginValues,
475
476
  onChange: setMarginValues,