@wordpress/block-editor 12.4.0 → 12.5.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 (316) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -0
  3. package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
  4. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  5. package/build/components/block-heading-level-dropdown/index.native.js +4 -3
  6. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  7. package/build/components/block-lock/toolbar.js +25 -6
  8. package/build/components/block-lock/toolbar.js.map +1 -1
  9. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -6
  10. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  11. package/build/components/block-parent-selector/index.js +8 -5
  12. package/build/components/block-parent-selector/index.js.map +1 -1
  13. package/build/components/block-removal-warning-modal/index.js +18 -25
  14. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  15. package/build/components/block-toolbar/index.js +8 -5
  16. package/build/components/block-toolbar/index.js.map +1 -1
  17. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  18. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  19. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  20. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  21. package/build/components/dimensions-tool/index.js +207 -0
  22. package/build/components/dimensions-tool/index.js.map +1 -0
  23. package/build/components/dimensions-tool/scale-tool.js +111 -0
  24. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  25. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  26. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  27. package/build/components/global-styles/color-panel.js +1 -1
  28. package/build/components/global-styles/color-panel.js.map +1 -1
  29. package/build/components/global-styles/filters-panel.js +1 -1
  30. package/build/components/global-styles/filters-panel.js.map +1 -1
  31. package/build/components/global-styles/hooks.js +2 -2
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/typography-panel.js +34 -2
  34. package/build/components/global-styles/typography-panel.js.map +1 -1
  35. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  36. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  37. package/build/components/image-editor/use-save-image.js +1 -2
  38. package/build/components/image-editor/use-save-image.js.map +1 -1
  39. package/build/components/image-size-control/index.js +6 -0
  40. package/build/components/image-size-control/index.js.map +1 -1
  41. package/build/components/index.js +19 -1
  42. package/build/components/index.js.map +1 -1
  43. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  44. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  45. package/build/components/inserter/block-patterns-tab.js +7 -35
  46. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  47. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  48. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  49. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  50. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  51. package/build/components/inserter/media-tab/hooks.js +2 -21
  52. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  53. package/build/components/inserter/reusable-block-rename-hint.js +62 -0
  54. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  55. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  56. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  57. package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
  58. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  59. package/build/components/inserter/tabs.native.js +1 -1
  60. package/build/components/inserter/tabs.native.js.map +1 -1
  61. package/build/components/inserter-draggable-blocks/index.js +9 -1
  62. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  63. package/build/components/link-control/constants.js +1 -1
  64. package/build/components/link-control/constants.js.map +1 -1
  65. package/build/components/link-control/index.js +17 -15
  66. package/build/components/link-control/index.js.map +1 -1
  67. package/build/components/link-control/search-create-button.js +5 -21
  68. package/build/components/link-control/search-create-button.js.map +1 -1
  69. package/build/components/link-control/search-input.js +4 -4
  70. package/build/components/link-control/search-input.js.map +1 -1
  71. package/build/components/link-control/search-item.js +13 -30
  72. package/build/components/link-control/search-item.js.map +1 -1
  73. package/build/components/link-control/search-results.js +2 -2
  74. package/build/components/link-control/search-results.js.map +1 -1
  75. package/build/components/link-control/settings-drawer.js +2 -3
  76. package/build/components/link-control/settings-drawer.js.map +1 -1
  77. package/build/components/list-view/appender.js +2 -6
  78. package/build/components/list-view/appender.js.map +1 -1
  79. package/build/components/provider/index.js +5 -2
  80. package/build/components/provider/index.js.map +1 -1
  81. package/build/components/provider/use-block-sync.js +21 -0
  82. package/build/components/provider/use-block-sync.js.map +1 -1
  83. package/build/components/resolution-tool/index.js +55 -0
  84. package/build/components/resolution-tool/index.js.map +1 -0
  85. package/build/components/url-input/index.js +4 -2
  86. package/build/components/url-input/index.js.map +1 -1
  87. package/build/components/writing-flow/use-tab-nav.js +10 -27
  88. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  89. package/build/components/writing-mode-control/index.js +70 -0
  90. package/build/components/writing-mode-control/index.js.map +1 -0
  91. package/build/hooks/behaviors.js +25 -20
  92. package/build/hooks/behaviors.js.map +1 -1
  93. package/build/hooks/supports.js +7 -1
  94. package/build/hooks/supports.js.map +1 -1
  95. package/build/hooks/typography.js +2 -1
  96. package/build/hooks/typography.js.map +1 -1
  97. package/build/hooks/utils.js +4 -2
  98. package/build/hooks/utils.js.map +1 -1
  99. package/build/private-apis.js +10 -1
  100. package/build/private-apis.js.map +1 -1
  101. package/build/private-apis.native.js +3 -0
  102. package/build/private-apis.native.js.map +1 -1
  103. package/build/store/actions.js +195 -1
  104. package/build/store/actions.js.map +1 -1
  105. package/build/store/defaults.js +1 -0
  106. package/build/store/defaults.js.map +1 -1
  107. package/build/store/index.js +10 -1
  108. package/build/store/index.js.map +1 -1
  109. package/build/store/private-actions.js +46 -40
  110. package/build/store/private-actions.js.map +1 -1
  111. package/build/store/private-selectors.js +3 -3
  112. package/build/store/private-selectors.js.map +1 -1
  113. package/build/store/reducer.js +22 -8
  114. package/build/store/reducer.js.map +1 -1
  115. package/build/store/selectors.js +33 -15
  116. package/build/store/selectors.js.map +1 -1
  117. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
  118. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  119. package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
  120. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  121. package/build-module/components/block-lock/toolbar.js +25 -7
  122. package/build-module/components/block-lock/toolbar.js.map +1 -1
  123. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
  124. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  125. package/build-module/components/block-parent-selector/index.js +7 -5
  126. package/build-module/components/block-parent-selector/index.js.map +1 -1
  127. package/build-module/components/block-removal-warning-modal/index.js +20 -24
  128. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  129. package/build-module/components/block-toolbar/index.js +8 -5
  130. package/build-module/components/block-toolbar/index.js.map +1 -1
  131. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  132. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  133. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  134. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  135. package/build-module/components/dimensions-tool/index.js +195 -0
  136. package/build-module/components/dimensions-tool/index.js.map +1 -0
  137. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  138. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  139. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  140. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  141. package/build-module/components/global-styles/color-panel.js +1 -1
  142. package/build-module/components/global-styles/color-panel.js.map +1 -1
  143. package/build-module/components/global-styles/filters-panel.js +2 -2
  144. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  145. package/build-module/components/global-styles/hooks.js +2 -2
  146. package/build-module/components/global-styles/hooks.js.map +1 -1
  147. package/build-module/components/global-styles/typography-panel.js +33 -2
  148. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  149. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  150. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  151. package/build-module/components/image-editor/use-save-image.js +1 -2
  152. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  153. package/build-module/components/image-size-control/index.js +5 -0
  154. package/build-module/components/image-size-control/index.js.map +1 -1
  155. package/build-module/components/index.js +6 -0
  156. package/build-module/components/index.js.map +1 -1
  157. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  158. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  159. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  160. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  161. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  162. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  163. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  164. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  165. package/build-module/components/inserter/media-tab/hooks.js +2 -21
  166. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  167. package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
  168. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  169. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  170. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  171. package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
  172. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  173. package/build-module/components/inserter/tabs.native.js +1 -1
  174. package/build-module/components/inserter/tabs.native.js.map +1 -1
  175. package/build-module/components/inserter-draggable-blocks/index.js +9 -2
  176. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  177. package/build-module/components/link-control/constants.js +1 -1
  178. package/build-module/components/link-control/constants.js.map +1 -1
  179. package/build-module/components/link-control/index.js +17 -15
  180. package/build-module/components/link-control/index.js.map +1 -1
  181. package/build-module/components/link-control/search-create-button.js +7 -20
  182. package/build-module/components/link-control/search-create-button.js.map +1 -1
  183. package/build-module/components/link-control/search-input.js +4 -4
  184. package/build-module/components/link-control/search-input.js.map +1 -1
  185. package/build-module/components/link-control/search-item.js +14 -28
  186. package/build-module/components/link-control/search-item.js.map +1 -1
  187. package/build-module/components/link-control/search-results.js +3 -3
  188. package/build-module/components/link-control/search-results.js.map +1 -1
  189. package/build-module/components/link-control/settings-drawer.js +4 -5
  190. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  191. package/build-module/components/list-view/appender.js +2 -6
  192. package/build-module/components/list-view/appender.js.map +1 -1
  193. package/build-module/components/provider/index.js +5 -2
  194. package/build-module/components/provider/index.js.map +1 -1
  195. package/build-module/components/provider/use-block-sync.js +21 -0
  196. package/build-module/components/provider/use-block-sync.js.map +1 -1
  197. package/build-module/components/resolution-tool/index.js +45 -0
  198. package/build-module/components/resolution-tool/index.js.map +1 -0
  199. package/build-module/components/url-input/index.js +4 -2
  200. package/build-module/components/url-input/index.js.map +1 -1
  201. package/build-module/components/writing-flow/use-tab-nav.js +8 -26
  202. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  203. package/build-module/components/writing-mode-control/index.js +57 -0
  204. package/build-module/components/writing-mode-control/index.js.map +1 -0
  205. package/build-module/hooks/behaviors.js +26 -20
  206. package/build-module/hooks/behaviors.js.map +1 -1
  207. package/build-module/hooks/supports.js +7 -1
  208. package/build-module/hooks/supports.js.map +1 -1
  209. package/build-module/hooks/typography.js +2 -1
  210. package/build-module/hooks/typography.js.map +1 -1
  211. package/build-module/hooks/utils.js +4 -2
  212. package/build-module/hooks/utils.js.map +1 -1
  213. package/build-module/private-apis.js +7 -1
  214. package/build-module/private-apis.js.map +1 -1
  215. package/build-module/private-apis.native.js +2 -0
  216. package/build-module/private-apis.native.js.map +1 -1
  217. package/build-module/store/actions.js +191 -1
  218. package/build-module/store/actions.js.map +1 -1
  219. package/build-module/store/defaults.js +1 -0
  220. package/build-module/store/defaults.js.map +1 -1
  221. package/build-module/store/index.js +10 -1
  222. package/build-module/store/index.js.map +1 -1
  223. package/build-module/store/private-actions.js +45 -36
  224. package/build-module/store/private-actions.js.map +1 -1
  225. package/build-module/store/private-selectors.js +2 -2
  226. package/build-module/store/private-selectors.js.map +1 -1
  227. package/build-module/store/reducer.js +22 -8
  228. package/build-module/store/reducer.js.map +1 -1
  229. package/build-module/store/selectors.js +33 -15
  230. package/build-module/store/selectors.js.map +1 -1
  231. package/build-style/content-rtl.css +3 -0
  232. package/build-style/content.css +3 -0
  233. package/build-style/style-rtl.css +131 -129
  234. package/build-style/style.css +131 -129
  235. package/package.json +32 -31
  236. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  237. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  238. package/src/components/block-draggable/style.scss +1 -0
  239. package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
  240. package/src/components/block-heading-level-dropdown/index.native.js +8 -4
  241. package/src/components/block-inspector/style.scss +2 -1
  242. package/src/components/block-lock/toolbar.js +34 -6
  243. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
  244. package/src/components/block-parent-selector/index.js +13 -8
  245. package/src/components/block-removal-warning-modal/index.js +20 -33
  246. package/src/components/block-toolbar/index.js +9 -6
  247. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  248. package/src/components/block-tools/style.scss +73 -26
  249. package/src/components/default-block-appender/content.scss +11 -0
  250. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  251. package/src/components/dimensions-tool/index.js +212 -0
  252. package/src/components/dimensions-tool/scale-tool.js +124 -0
  253. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  254. package/src/components/dimensions-tool/stories/index.js +54 -0
  255. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  256. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  257. package/src/components/dimensions-tool/test/index.js +641 -0
  258. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  259. package/src/components/font-family/README.md +71 -0
  260. package/src/components/global-styles/color-panel.js +1 -1
  261. package/src/components/global-styles/filters-panel.js +2 -2
  262. package/src/components/global-styles/hooks.js +2 -0
  263. package/src/components/global-styles/typography-panel.js +40 -0
  264. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  265. package/src/components/image-editor/use-save-image.js +0 -1
  266. package/src/components/image-size-control/index.js +6 -0
  267. package/src/components/index.js +6 -0
  268. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  269. package/src/components/inserter/block-patterns-tab.js +8 -56
  270. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  271. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  272. package/src/components/inserter/media-tab/hooks.js +2 -22
  273. package/src/components/inserter/reusable-block-rename-hint.js +52 -0
  274. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  275. package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
  276. package/src/components/inserter/style.scss +28 -0
  277. package/src/components/inserter/tabs.native.js +5 -1
  278. package/src/components/inserter-draggable-blocks/index.js +13 -2
  279. package/src/components/link-control/constants.js +1 -1
  280. package/src/components/link-control/index.js +32 -28
  281. package/src/components/link-control/search-create-button.js +8 -26
  282. package/src/components/link-control/search-input.js +4 -3
  283. package/src/components/link-control/search-item.js +21 -43
  284. package/src/components/link-control/search-results.js +48 -46
  285. package/src/components/link-control/settings-drawer.js +6 -5
  286. package/src/components/link-control/style.scss +51 -123
  287. package/src/components/link-control/test/index.js +135 -123
  288. package/src/components/list-view/appender.js +5 -6
  289. package/src/components/list-view/style.scss +1 -2
  290. package/src/components/media-replace-flow/test/index.js +1 -1
  291. package/src/components/panel-color-settings/README.md +98 -0
  292. package/src/components/provider/index.js +9 -2
  293. package/src/components/provider/test/use-block-sync.js +21 -6
  294. package/src/components/provider/use-block-sync.js +19 -0
  295. package/src/components/recursion-provider/README.md +101 -0
  296. package/src/components/resolution-tool/index.js +56 -0
  297. package/src/components/resolution-tool/stories/index.js +48 -0
  298. package/src/components/url-input/index.js +2 -0
  299. package/src/components/writing-flow/use-tab-nav.js +10 -33
  300. package/src/components/writing-mode-control/index.js +68 -0
  301. package/src/components/writing-mode-control/style.scss +18 -0
  302. package/src/hooks/behaviors.js +25 -16
  303. package/src/hooks/supports.js +7 -0
  304. package/src/hooks/typography.js +2 -0
  305. package/src/hooks/utils.js +3 -0
  306. package/src/private-apis.js +6 -0
  307. package/src/private-apis.native.js +2 -0
  308. package/src/store/actions.js +194 -1
  309. package/src/store/defaults.js +1 -0
  310. package/src/store/index.js +10 -0
  311. package/src/store/private-actions.js +39 -39
  312. package/src/store/private-selectors.js +2 -2
  313. package/src/store/reducer.js +22 -8
  314. package/src/store/selectors.js +54 -20
  315. package/src/store/test/actions.js +111 -0
  316. package/src/store/test/private-actions.js +56 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"names":["focus","isFormElement","TAB","ESCAPE","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","lastFocus","hasMultiSelection","getSelectedBlockClientId","getBlockCount","setNavigationMode","isNavigationMode","select","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","preventDefault","isShift","shiftKey","direction","isElementPartOfSelectedBlock","selectedBlockElement","element","elementBlockId","closest","getAttribute","isElementSameBlock","isElementChildOfBlock","contains","nextTabbable","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","addEventListener","removeEventListener","mergedRefs"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,aAAhB,QAAqC,gBAArC;AACA,SAASC,GAAT,EAAcC,MAAd,QAA4B,qBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,oBAA3C;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,SAAS,GAAGJ,MAAM,EAAxB;AACA,QAAMK,qBAAqB,GAAGL,MAAM,EAApC;AACA,QAAMM,oBAAoB,GAAGN,MAAM,EAAnC;AACA,QAAMO,SAAS,GAAGP,MAAM,EAAxB;AACA,QAAM;AAAEQ,IAAAA,iBAAF;AAAqBC,IAAAA,wBAArB;AAA+CC,IAAAA;AAA/C,MACLd,SAAS,CAAEM,gBAAF,CADV;AAEA,QAAM;AAAES,IAAAA;AAAF,MAAwBd,WAAW,CAAEK,gBAAF,CAAzC;AACA,QAAMU,gBAAgB,GAAGhB,SAAS,CAC/BiB,MAAF,IAAcA,MAAM,CAAEX,gBAAF,CAAN,CAA2BU,gBAA3B,EADmB,EAEjC,EAFiC,CAAlC,CARmC,CAanC;;AACA,QAAME,oBAAoB,GAAG,CAAEF,gBAAF,GAAqB,GAArB,GAA2BG,SAAxD,CAdmC,CAgBnC;AACA;;AACA,QAAMC,SAAS,GAAGhB,MAAM,EAAxB;;AAEA,WAASiB,cAAT,CAAyBC,KAAzB,EAAiC;AAChC;AACA,QAAKF,SAAS,CAACG,OAAf,EAAyB;AACxBH,MAAAA,SAAS,CAACG,OAAV,GAAoB,IAApB;AACA,KAFD,MAEO,IAAKX,iBAAiB,EAAtB,EAA2B;A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AAK,CAACI,MAAnC,CAAf,CAfoC,CAgBpC;;AACA,UACCA,MAAM,KAAKjB,qBAAqB,CAACc,OAAjC,IACAG,MAAM,KAAKhB,oBAAoB,CAACa,OAFjC,EAGE;AACDD,QAAAA,KAAK,CAACsB,cAAN;AACAlB,QAAAA,MAAM,CAAC9B,KAAP,CAAc;AAAE8D,UAAAA,aAAa,EAAE;AAAjB,SAAd;AACA;AACD;;AAED,UAAM;AAAEjC,MAAAA;AAAF,QAAoBe,IAA1B;AACA,UAAM;AAAEb,MAAAA;AAAF,QAAkBF,aAAxB;AACAE,IAAAA,WAAW,CAACqC,gBAAZ,CAA8B,SAA9B,EAAyCD,kBAAzC;AACAvB,IAAAA,IAAI,CAACwB,gBAAL,CAAuB,SAAvB,EAAkCvB,SAAlC;AACAD,IAAAA,IAAI,CAACwB,gBAAL,CAAuB,UAAvB,EAAmCL,UAAnC;AACA,WAAO,MAAM;AACZhC,MAAAA,WAAW,CAACsC,mBAAZ,CAAiC,SAAjC,EAA4CF,kBAA5C;AACAvB,MAAAA,IAAI,CAACyB,mBAAL,CAA0B,SAA1B,EAAqCxB,SAArC;AACAD,MAAAA,IAAI,CAACyB,mBAAL,CAA0B,UAA1B,EAAsCN,UAAtC;AACA,KAJD;AAKA,GAhKuB,EAgKrB,EAhKqB,CAAxB;AAkKA,QAAMO,UAAU,GAAG/D,YAAY,CAAE,CAAEK,SAAF,EAAa+B,GAAb,CAAF,CAA/B;AAEA,SAAO,CAAEF,MAAF,EAAU6B,UAAV,EAAsB5B,KAAtB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB, ESCAPE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\tconst lastFocus = useRef();\n\tconst { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setNavigationMode } = useDispatch( blockEditorStore );\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tlastFocus.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) setNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\t// TODO: Should this become a utility function?\n\t\t\t/**\n\t\t\t * Determine whether an element is part of or is the selected block.\n\t\t\t *\n\t\t\t * @param {Object} selectedBlockElement\n\t\t\t * @param {Object} element\n\t\t\t * @return {boolean} Whether the element is part of or is the selected block.\n\t\t\t */\n\t\t\tconst isElementPartOfSelectedBlock = (\n\t\t\t\tselectedBlockElement,\n\t\t\t\telement\n\t\t\t) => {\n\t\t\t\t// Check if the element is or is within the selected block by finding the\n\t\t\t\t// closest element with a data-block attribute and seeing if\n\t\t\t\t// it matches our current selected block ID\n\t\t\t\tconst elementBlockId = element\n\t\t\t\t\t.closest( '[data-block]' )\n\t\t\t\t\t?.getAttribute( 'data-block' );\n\t\t\t\tconst isElementSameBlock =\n\t\t\t\t\telementBlockId === getSelectedBlockClientId();\n\n\t\t\t\t// Check if the element is a child of the selected block. This could be a\n\t\t\t\t// child block in a group or column block, etc.\n\t\t\t\tconst isElementChildOfBlock =\n\t\t\t\t\tselectedBlockElement.contains( element );\n\n\t\t\t\treturn isElementSameBlock || isElementChildOfBlock;\n\t\t\t};\n\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock(\n\t\t\t\t\tevent.target.closest( '[data-block]' ),\n\t\t\t\t\tnextTabbable\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCapture.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tlastFocus.current = event.target;\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"names":["focus","isFormElement","TAB","ESCAPE","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","lastFocus","hasMultiSelection","getSelectedBlockClientId","getBlockCount","setNavigationMode","isNavigationMode","select","focusCaptureTabIndex","undefined","noCapture","onFocusCapture","event","current","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","after","ref","node","onKeyDown","defaultPrevented","keyCode","preventDefault","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","addEventListener","removeEventListener","mergedRefs"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,aAAhB,QAAqC,gBAArC;AACA,SAASC,GAAT,EAAcC,MAAd,QAA4B,qBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,oBAA3C;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,aAAT,EAAwBC,iB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A,IAAI,CAACoB,mBAAL,CAA0B,SAA1B,EAAqCnB,SAArC;AACAD,MAAAA,IAAI,CAACoB,mBAAL,CAA0B,UAA1B,EAAsCP,UAAtC;AACA,KAJD;AAKA,GAxIuB,EAwIrB,EAxIqB,CAAxB;AA0IA,QAAMQ,UAAU,GAAG5D,YAAY,CAAE,CAAEO,SAAF,EAAa+B,GAAb,CAAF,CAA/B;AAEA,SAAO,CAAEF,MAAF,EAAUwB,UAAV,EAAsBvB,KAAtB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB, ESCAPE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\tconst lastFocus = useRef();\n\tconst { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setNavigationMode } = useDispatch( blockEditorStore );\n\tconst isNavigationMode = useSelect(\n\t\t( select ) => select( blockEditorStore ).isNavigationMode(),\n\t\t[]\n\t);\n\n\t// Don't allow tabbing to this element in Navigation mode.\n\tconst focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCapture = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCapture.current ) {\n\t\t\tnoCapture.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tlastFocus.current.focus();\n\t\t} else {\n\t\t\tsetNavigationMode( true );\n\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex={ focusCaptureTabIndex }\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ESCAPE && ! hasMultiSelection() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\t// Preserve the behaviour of entering navigation mode when\n\t\t\t\t// tabbing into the content without a block selection.\n\t\t\t\t// `onFocusCapture` already did this previously, but we need to\n\t\t\t\t// do it again here because after clearing block selection,\n\t\t\t\t// focus land on the writing flow container and pressing Tab\n\t\t\t\t// will no longer send focus through the focus capture element.\n\t\t\t\tif ( event.target === node ) setNavigationMode( true );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCapture.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tlastFocus.current = event.target;\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"]}
@@ -0,0 +1,57 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import classnames from 'classnames';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { BaseControl, Button } from '@wordpress/components';
12
+ import { __, isRTL } from '@wordpress/i18n';
13
+ import { textHorizontal, textVertical } from '@wordpress/icons';
14
+ const WRITING_MODES = [{
15
+ name: __('Horizontal'),
16
+ value: 'horizontal-tb',
17
+ icon: textHorizontal
18
+ }, {
19
+ name: __('Vertical'),
20
+ value: isRTL() ? 'vertical-lr' : 'vertical-rl',
21
+ icon: textVertical
22
+ }];
23
+ /**
24
+ * Control to facilitate writing mode selections.
25
+ *
26
+ * @param {Object} props Component props.
27
+ * @param {string} props.className Class name to add to the control.
28
+ * @param {string} props.value Currently selected writing mode.
29
+ * @param {Function} props.onChange Handles change in the writing mode selection.
30
+ *
31
+ * @return {WPElement} Writing Mode control.
32
+ */
33
+
34
+ export default function WritingModeControl({
35
+ className,
36
+ value,
37
+ onChange
38
+ }) {
39
+ return createElement("fieldset", {
40
+ className: classnames('block-editor-writing-mode-control', className)
41
+ }, createElement(BaseControl.VisualLabel, {
42
+ as: "legend"
43
+ }, __('Orientation')), createElement("div", {
44
+ className: "block-editor-writing-mode-control__buttons"
45
+ }, WRITING_MODES.map(writingMode => {
46
+ return createElement(Button, {
47
+ key: writingMode.value,
48
+ icon: writingMode.icon,
49
+ label: writingMode.name,
50
+ isPressed: writingMode.value === value,
51
+ onClick: () => {
52
+ onChange(writingMode.value === value ? undefined : writingMode.value);
53
+ }
54
+ });
55
+ })));
56
+ }
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"names":["classnames","BaseControl","Button","__","isRTL","textHorizontal","textVertical","WRITING_MODES","name","value","icon","WritingModeControl","className","onChange","map","writingMode","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SAASC,cAAT,EAAyBC,YAAzB,QAA6C,kBAA7C;AAEA,MAAMC,aAAa,GAAG,CACrB;AACCC,EAAAA,IAAI,EAAEL,EAAE,CAAE,YAAF,CADT;AAECM,EAAAA,KAAK,EAAE,eAFR;AAGCC,EAAAA,IAAI,EAAEL;AAHP,CADqB,EAMrB;AACCG,EAAAA,IAAI,EAAEL,EAAE,CAAE,UAAF,CADT;AAECM,EAAAA,KAAK,EAAEL,KAAK,KAAK,aAAL,GAAqB,aAFlC;AAGCM,EAAAA,IAAI,EAAEJ;AAHP,CANqB,CAAtB;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASK,kBAAT,CAA6B;AAAEC,EAAAA,SAAF;AAAaH,EAAAA,KAAb;AAAoBI,EAAAA;AAApB,CAA7B,EAA8D;AAC5E,SACC;AACC,IAAA,SAAS,EAAGb,UAAU,CACrB,mCADqB,EAErBY,SAFqB;AADvB,KAMC,cAAC,WAAD,CAAa,WAAb;AAAyB,IAAA,EAAE,EAAC;AAA5B,KACGT,EAAE,CAAE,aAAF,CADL,CAND,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGI,aAAa,CAACO,GAAd,CAAqBC,WAAF,IAAmB;AACvC,WACC,cAAC,MAAD;AACC,MAAA,GAAG,EAAGA,WAAW,CAACN,KADnB;AAEC,MAAA,IAAI,EAAGM,WAAW,CAACL,IAFpB;AAGC,MAAA,KAAK,EAAGK,WAAW,CAACP,IAHrB;AAIC,MAAA,SAAS,EAAGO,WAAW,CAACN,KAAZ,KAAsBA,KAJnC;AAKC,MAAA,OAAO,EAAG,MAAM;AACfI,QAAAA,QAAQ,CACPE,WAAW,CAACN,KAAZ,KAAsBA,KAAtB,GACGO,SADH,GAEGD,WAAW,CAACN,KAHR,CAAR;AAKA;AAXF,MADD;AAeA,GAhBC,CADH,CATD,CADD;AA+BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\n\nconst WRITING_MODES = [\n\t{\n\t\tname: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tname: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {WPElement} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<fieldset\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-writing-mode-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Orientation' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"block-editor-writing-mode-control__buttons\">\n\t\t\t\t{ WRITING_MODES.map( ( writingMode ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ writingMode.value }\n\t\t\t\t\t\t\ticon={ writingMode.icon }\n\t\t\t\t\t\t\tlabel={ writingMode.name }\n\t\t\t\t\t\t\tisPressed={ writingMode.value === value }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\twritingMode.value === value\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: writingMode.value\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} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"]}
@@ -9,6 +9,7 @@ import { __ } from '@wordpress/i18n';
9
9
  import { hasBlockSupport } from '@wordpress/blocks';
10
10
  import { createHigherOrderComponent } from '@wordpress/compose';
11
11
  import { useSelect } from '@wordpress/data';
12
+ import { useMemo } from '@wordpress/element';
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
@@ -52,43 +53,48 @@ function BehaviorsControl({
52
53
  // Capitalize the first letter of the behavior name.
53
54
  label: `${behaviorName.charAt(0).toUpperCase()}${behaviorName.slice(1).toLowerCase()}`
54
55
  }));
55
- const options = [...Object.values(defaultBehaviors), ...behaviorsOptions]; // If every behavior is disabled, do not show the behaviors inspector control.
56
-
57
- if (behaviorsOptions.length === 0) {
58
- return null;
59
- } // Block behaviors take precedence over theme behaviors.
60
-
61
-
62
- const behaviors = { ...themeBehaviors,
63
- ...(blockBehaviors || {})
64
- };
65
- const helpText = disabled ? __('The lightbox behavior is disabled for linked images.') : '';
56
+ const options = [...Object.values(defaultBehaviors), ...behaviorsOptions];
57
+ const {
58
+ behaviors,
59
+ behaviorsValue
60
+ } = useMemo(() => {
61
+ const mergedBehaviors = { ...themeBehaviors,
62
+ ...(blockBehaviors || {})
63
+ };
64
+ let value = '';
66
65
 
67
- const value = () => {
68
66
  if (blockBehaviors === undefined) {
69
- return 'default';
67
+ value = 'default';
70
68
  }
71
69
 
72
- if (behaviors?.lightbox.enabled) {
73
- return 'lightbox';
70
+ if (blockBehaviors?.lightbox.enabled) {
71
+ value = 'lightbox';
74
72
  }
75
73
 
76
- return '';
77
- };
74
+ return {
75
+ behaviors: mergedBehaviors,
76
+ behaviorsValue: value
77
+ };
78
+ }, [blockBehaviors, themeBehaviors]); // If every behavior is disabled, do not show the behaviors inspector control.
78
79
 
80
+ if (behaviorsOptions.length === 0) {
81
+ return null;
82
+ }
83
+
84
+ const helpText = disabled ? __('The lightbox behavior is disabled for linked images.') : '';
79
85
  return createElement(InspectorControls, {
80
86
  group: "advanced"
81
87
  }, createElement("div", null, createElement(SelectControl, {
82
88
  label: __('Behaviors') // At the moment we are only supporting one behavior (Lightbox)
83
89
  ,
84
- value: value(),
90
+ value: behaviorsValue,
85
91
  options: options,
86
92
  onChange: onChangeBehavior,
87
93
  hideCancelButton: true,
88
94
  help: helpText,
89
95
  size: "__unstable-large",
90
96
  disabled: disabled
91
- }), behaviors?.lightbox.enabled && createElement(SelectControl, {
97
+ }), behaviorsValue === 'lightbox' && createElement(SelectControl, {
92
98
  label: __('Animation') // At the moment we are only supporting one behavior (Lightbox)
93
99
  ,
94
100
  value: behaviors?.lightbox.animation ? behaviors?.lightbox.animation : '',
@@ -97,7 +103,7 @@ function BehaviorsControl({
97
103
  label: __('Zoom')
98
104
  }, {
99
105
  value: 'fade',
100
- label: 'Fade'
106
+ label: __('Fade')
101
107
  }],
102
108
  onChange: onChangeAnimation,
103
109
  hideCancelButton: false,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"names":["addFilter","SelectControl","__","hasBlockSupport","createHigherOrderComponent","useSelect","store","blockEditorStore","InspectorControls","BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","themeBehaviors","select","getBehaviors","getSettings","__experimentalFeatures","blocks","behaviors","defaultBehaviors","default","value","label","noBehaviors","behaviorsOptions","Object","entries","filter","behaviorName","behaviorValue","map","charAt","toUpperCase","slice","toLowerCase","options","values","length","helpText","undefined","lightbox","enabled","animation","withBehaviors","BlockEdit","props","blockEdit","name","blockHasLink","attributes","linkDestination","nextValue","setAttributes","window","__experimentalInteractivityAPI"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,gBAAT,CAA2B;AAC1BC,EAAAA,SAD0B;AAE1BC,EAAAA,cAF0B;AAG1BC,EAAAA,gBAH0B;AAI1BC,EAAAA,iBAJ0B;AAK1BC,EAAAA,QAAQ,GAAG;AALe,CAA3B,EAMI;AACH,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA+BX,SAAS,CAC3CY,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QAAgCF,MAAM,CAAEV,gBAAF,CAA5C;AAEA,WAAO;AACNQ,MAAAA,QAAQ,EACPI,WAAW,IAAIC,sBAAf,EAAuCC,MAAvC,GAAiDX,SAAjD,GACGY,SAHE;AAINN,MAAAA,cAAc,EAAEE,YAAY,IAAIG,MAAhB,GAA0BX,SAA1B;AAJV,KAAP;AAMA,GAV4C,EAW7C,CAAEA,SAAF,CAX6C,CAA9C;AAcA,QAAMa,gBAAgB,GAAG;AACxBC,IAAAA,OAAO,EAAE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DoD,CAAhD;;AAwDP,IAAKK,MAAM,EAAEC,8BAAb,EAA8C;AAC7C1D,EAAAA,SAAS,CACR,kBADQ,EAER,uCAFQ,EAGR+C,aAHQ,CAAT;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\n\nfunction BehaviorsControl( {\n\tblockName,\n\tblockBehaviors,\n\tonChangeBehavior,\n\tonChangeAnimation,\n\tdisabled = false,\n} ) {\n\tconst { settings, themeBehaviors } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBehaviors, getSettings } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tsettings:\n\t\t\t\t\tgetSettings()?.__experimentalFeatures?.blocks?.[ blockName ]\n\t\t\t\t\t\t?.behaviors,\n\t\t\t\tthemeBehaviors: getBehaviors()?.blocks?.[ blockName ],\n\t\t\t};\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst defaultBehaviors = {\n\t\tdefault: {\n\t\t\tvalue: 'default',\n\t\t\tlabel: __( 'Default' ),\n\t\t},\n\t\tnoBehaviors: {\n\t\t\tvalue: '',\n\t\t\tlabel: __( 'No behaviors' ),\n\t\t},\n\t};\n\n\tconst behaviorsOptions = Object.entries( settings )\n\t\t.filter(\n\t\t\t( [ behaviorName, behaviorValue ] ) =>\n\t\t\t\thasBlockSupport( blockName, `behaviors.${ behaviorName }` ) &&\n\t\t\t\tbehaviorValue\n\t\t) // Filter out behaviors that are disabled.\n\t\t.map( ( [ behaviorName ] ) => ( {\n\t\t\tvalue: behaviorName,\n\t\t\t// Capitalize the first letter of the behavior name.\n\t\t\tlabel: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName\n\t\t\t\t.slice( 1 )\n\t\t\t\t.toLowerCase() }`,\n\t\t} ) );\n\n\tconst options = [\n\t\t...Object.values( defaultBehaviors ),\n\t\t...behaviorsOptions,\n\t];\n\n\t// If every behavior is disabled, do not show the behaviors inspector control.\n\tif ( behaviorsOptions.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Block behaviors take precedence over theme behaviors.\n\tconst behaviors = { ...themeBehaviors, ...( blockBehaviors || {} ) };\n\n\tconst helpText = disabled\n\t\t? __( 'The lightbox behavior is disabled for linked images.' )\n\t\t: '';\n\n\tconst value = () => {\n\t\tif ( blockBehaviors === undefined ) {\n\t\t\treturn 'default';\n\t\t}\n\t\tif ( behaviors?.lightbox.enabled ) {\n\t\t\treturn 'lightbox';\n\t\t}\n\t\treturn '';\n\t};\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t{ /* This div is needed to prevent a margin bottom between the dropdown and the button. */ }\n\t\t\t<div>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Behaviors' ) }\n\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\tvalue={ value() }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ onChangeBehavior }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t{ behaviors?.lightbox.enabled && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Animation' ) }\n\t\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tbehaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t? behaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'zoom',\n\t\t\t\t\t\t\t\tlabel: __( 'Zoom' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ value: 'fade', label: 'Fade' },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ onChangeAnimation }\n\t\t\t\t\t\thideCancelButton={ false }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning behaviors to blocks if behaviors are enabled in the theme.json.\n *\n * Currently, only the `core/image` block is supported.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\t// Only add behaviors to blocks with support.\n\t\tif ( ! hasBlockSupport( props.name, 'behaviors' ) ) {\n\t\t\treturn blockEdit;\n\t\t}\n\t\tconst blockHasLink =\n\t\t\ttypeof props.attributes?.linkDestination !== 'undefined' &&\n\t\t\tprops.attributes?.linkDestination !== 'none';\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockEdit }\n\t\t\t\t<BehaviorsControl\n\t\t\t\t\tblockName={ props.name }\n\t\t\t\t\tblockBehaviors={ props.attributes.behaviors }\n\t\t\t\t\tonChangeBehavior={ ( nextValue ) => {\n\t\t\t\t\t\tif ( nextValue === 'default' ) {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If the user selects something, it means that they want to\n\t\t\t\t\t\t\t// change the default value (true) so we save it in the attributes.\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\t\tenabled: nextValue === 'lightbox',\n\t\t\t\t\t\t\t\t\t\tanimation:\n\t\t\t\t\t\t\t\t\t\t\tnextValue === 'lightbox'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'zoom'\n\t\t\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},\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\tonChangeAnimation={ ( nextValue ) => {\n\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\tenabled:\n\t\t\t\t\t\t\t\t\t\tprops.attributes.behaviors.lightbox\n\t\t\t\t\t\t\t\t\t\t\t.enabled,\n\t\t\t\t\t\t\t\t\tanimation: nextValue,\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\tdisabled={ blockHasLink }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n}, 'withBehaviors' );\n\nif ( window?.__experimentalInteractivityAPI ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/behaviors/with-inspector-control',\n\t\twithBehaviors\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"names":["addFilter","SelectControl","__","hasBlockSupport","createHigherOrderComponent","useSelect","useMemo","store","blockEditorStore","InspectorControls","BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","themeBehaviors","select","getBehaviors","getSettings","__experimentalFeatures","blocks","behaviors","defaultBehaviors","default","value","label","noBehaviors","behaviorsOptions","Object","entries","filter","behaviorName","behaviorValue","map","charAt","toUpperCase","slice","toLowerCase","options","values","behaviorsValue","mergedBehaviors","undefined","lightbox","enabled","length","helpText","animation","withBehaviors","BlockEdit","props","blockEdit","name","blockHasLink","attributes","linkDestination","nextValue","setAttributes","window","__experimentalInteractivityAPI"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,gBAAT,CAA2B;AAC1BC,EAAAA,SAD0B;AAE1BC,EAAAA,cAF0B;AAG1BC,EAAAA,gBAH0B;AAI1BC,EAAAA,iBAJ0B;AAK1BC,EAAAA,QAAQ,GAAG;AALe,CAA3B,EAMI;AACH,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA+BZ,SAAS,CAC3Ca,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QAAgCF,MAAM,CAAEV,gBAAF,CAA5C;AAEA,WAAO;AACNQ,MAAAA,QAAQ,EACPI,WAAW,IAAIC,sBAAf,EAAuCC,MAAvC,GAAiDX,SAAjD,GACGY,SAHE;AAINN,MAAAA,cAAc,EAAEE,YAAY,IAAIG,MAAhB,GAA0BX,SAA1B;AAJV,KAAP;AAMA,GAV4C,EAW7C,CAAEA,SAAF,CAX6C,CAA9C;AAcA,QAAMa,gBAAgB,GAAG;AACxBC,IAAAA,OAAO,EAAE;AACRC,MAAAA,KAAK,EAAE,SADC;AAERC,MAAAA,KAAK,EAAEzB,EAAE,CAAE,SAAF;AAFD,KADe;AAKxB0B,IAAAA,WAAW,EAAE;AACZF,MAAAA,KAAK,EAAE,EADK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,EAAGH;AApCZ,MAFD,CADD;AA2CA,GApDD;AAqDA,CAtDsD,EAsDpD,eAtDoD,CAAhD;;AAwDP,IAAKK,MAAM,EAAEC,8BAAb,EAA8C;AAC7C7D,EAAAA,SAAS,CACR,kBADQ,EAER,uCAFQ,EAGRkD,aAHQ,CAAT;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\n\nfunction BehaviorsControl( {\n\tblockName,\n\tblockBehaviors,\n\tonChangeBehavior,\n\tonChangeAnimation,\n\tdisabled = false,\n} ) {\n\tconst { settings, themeBehaviors } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBehaviors, getSettings } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tsettings:\n\t\t\t\t\tgetSettings()?.__experimentalFeatures?.blocks?.[ blockName ]\n\t\t\t\t\t\t?.behaviors,\n\t\t\t\tthemeBehaviors: getBehaviors()?.blocks?.[ blockName ],\n\t\t\t};\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst defaultBehaviors = {\n\t\tdefault: {\n\t\t\tvalue: 'default',\n\t\t\tlabel: __( 'Default' ),\n\t\t},\n\t\tnoBehaviors: {\n\t\t\tvalue: '',\n\t\t\tlabel: __( 'No behaviors' ),\n\t\t},\n\t};\n\n\tconst behaviorsOptions = Object.entries( settings )\n\t\t.filter(\n\t\t\t( [ behaviorName, behaviorValue ] ) =>\n\t\t\t\thasBlockSupport( blockName, `behaviors.${ behaviorName }` ) &&\n\t\t\t\tbehaviorValue\n\t\t) // Filter out behaviors that are disabled.\n\t\t.map( ( [ behaviorName ] ) => ( {\n\t\t\tvalue: behaviorName,\n\t\t\t// Capitalize the first letter of the behavior name.\n\t\t\tlabel: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName\n\t\t\t\t.slice( 1 )\n\t\t\t\t.toLowerCase() }`,\n\t\t} ) );\n\n\tconst options = [\n\t\t...Object.values( defaultBehaviors ),\n\t\t...behaviorsOptions,\n\t];\n\n\tconst { behaviors, behaviorsValue } = useMemo( () => {\n\t\tconst mergedBehaviors = {\n\t\t\t...themeBehaviors,\n\t\t\t...( blockBehaviors || {} ),\n\t\t};\n\n\t\tlet value = '';\n\t\tif ( blockBehaviors === undefined ) {\n\t\t\tvalue = 'default';\n\t\t}\n\t\tif ( blockBehaviors?.lightbox.enabled ) {\n\t\t\tvalue = 'lightbox';\n\t\t}\n\t\treturn {\n\t\t\tbehaviors: mergedBehaviors,\n\t\t\tbehaviorsValue: value,\n\t\t};\n\t}, [ blockBehaviors, themeBehaviors ] );\n\t// If every behavior is disabled, do not show the behaviors inspector control.\n\tif ( behaviorsOptions.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst helpText = disabled\n\t\t? __( 'The lightbox behavior is disabled for linked images.' )\n\t\t: '';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<div>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Behaviors' ) }\n\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\tvalue={ behaviorsValue }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ onChangeBehavior }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t{ behaviorsValue === 'lightbox' && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Animation' ) }\n\t\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tbehaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t? behaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'zoom',\n\t\t\t\t\t\t\t\tlabel: __( 'Zoom' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'fade',\n\t\t\t\t\t\t\t\tlabel: __( 'Fade' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ onChangeAnimation }\n\t\t\t\t\t\thideCancelButton={ false }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning behaviors to blocks if behaviors are enabled in the theme.json.\n *\n * Currently, only the `core/image` block is supported.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\t// Only add behaviors to blocks with support.\n\t\tif ( ! hasBlockSupport( props.name, 'behaviors' ) ) {\n\t\t\treturn blockEdit;\n\t\t}\n\t\tconst blockHasLink =\n\t\t\ttypeof props.attributes?.linkDestination !== 'undefined' &&\n\t\t\tprops.attributes?.linkDestination !== 'none';\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockEdit }\n\t\t\t\t<BehaviorsControl\n\t\t\t\t\tblockName={ props.name }\n\t\t\t\t\tblockBehaviors={ props.attributes.behaviors }\n\t\t\t\t\tonChangeBehavior={ ( nextValue ) => {\n\t\t\t\t\t\tif ( nextValue === 'default' ) {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If the user selects something, it means that they want to\n\t\t\t\t\t\t\t// change the default value (true) so we save it in the attributes.\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\t\tenabled: nextValue === 'lightbox',\n\t\t\t\t\t\t\t\t\t\tanimation:\n\t\t\t\t\t\t\t\t\t\t\tnextValue === 'lightbox'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'zoom'\n\t\t\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},\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\tonChangeAnimation={ ( nextValue ) => {\n\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\tenabled:\n\t\t\t\t\t\t\t\t\t\tprops.attributes.behaviors.lightbox\n\t\t\t\t\t\t\t\t\t\t\t.enabled,\n\t\t\t\t\t\t\t\t\tanimation: nextValue,\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\tdisabled={ blockHasLink }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n}, 'withBehaviors' );\n\nif ( window?.__experimentalInteractivityAPI ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/behaviors/with-inspector-control',\n\t\twithBehaviors\n\t);\n}\n"]}
@@ -33,6 +33,12 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
33
33
  */
34
34
 
35
35
  const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
36
+ /**
37
+ * Key within block settings' supports array indicating support for writing mode
38
+ * e.g. settings found in `block.json`.
39
+ */
40
+
41
+ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
36
42
  /**
37
43
  * Key within block settings' supports array indicating support for text
38
44
  * transforms e.g. settings found in `block.json`.
@@ -46,7 +52,7 @@ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
46
52
 
47
53
  const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
48
54
  const LAYOUT_SUPPORT_KEY = 'layout';
49
- const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
55
+ const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
50
56
  const SPACING_SUPPORT_KEY = 'spacing';
51
57
  const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY];
52
58
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/supports.js"],"names":["getBlockSupport","hasBlockSupport","Platform","ALIGN_SUPPORT_KEY","ALIGN_WIDE_SUPPORT_KEY","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","CUSTOM_CLASS_NAME_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","LINE_HEIGHT_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","LETTER_SPACING_SUPPORT_KEY","LAYOUT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","SPACING_SUPPORT_KEY","styleSupportKeys","hasAlignSupport","nameOrType","getAlignSupport","hasAlignWideSupport","getAlignWideSupport","hasBorderSupport","feature","OS","support","color","radius","width","style","getBorderSupport","hasColorSupport","colorSupport","link","gradient","background","text","hasLinkColorSupport","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","getColorSupport","hasCustomClassNameSupport","getCustomClassNameSupport","hasFontFamilySupport","getFontFamilySupport","hasFontSizeSupport","getFontSizeSupport","hasLayoutSupport","getLayoutSupport","hasStyleSupport","some","key"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA,MAAMC,iBAAiB,GAAG,OAA1B;AACA,MAAMC,sBAAsB,GAAG,WAA/B;AACA,MAAMC,kBAAkB,GAAG,sBAA3B;AACA,MAAMC,iBAAiB,GAAG,OAA1B;AACA,MAAMC,6BAA6B,GAAG,iBAAtC;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA,MAAMC,qBAAqB,GAAG,qBAA9B;AACA,MAAMC,uBAAuB,GAAG,uBAAhC;AACA;AACA;AACA;;AACA,MAAMC,sBAAsB,GAAG,oCAA/B;AACA;AACA;AACA;;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA;AACA;AACA;AACA;;AACA,MAAMC,wBAAwB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Acd,uBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAM0C,oBAAoB,GAAK5B,UAAF,IACnCtB,eAAe,CAAEsB,UAAF,EAAcd,uBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAM2C,kBAAkB,GAAK7B,UAAF,IACjCrB,eAAe,CAAEqB,UAAF,EAAcb,qBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAM2C,kBAAkB,GAAK9B,UAAF,IACjCtB,eAAe,CAAEsB,UAAF,EAAcb,qBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAM4C,gBAAgB,GAAK/B,UAAF,IAC/BrB,eAAe,CAAEqB,UAAF,EAAcL,kBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMqC,gBAAgB,GAAKhC,UAAF,IAC/BtB,eAAe,CAAEsB,UAAF,EAAcL,kBAAd,CADT;AAGP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMsC,eAAe,GAAKjC,UAAF,IAC9BF,gBAAgB,CAACoC,IAAjB,CAAyBC,GAAF,IAAWxD,eAAe,CAAEqB,UAAF,EAAcmC,GAAd,CAAjD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\nconst ALIGN_SUPPORT_KEY = 'align';\nconst ALIGN_WIDE_SUPPORT_KEY = 'alignWide';\nconst BORDER_SUPPORT_KEY = '__experimentalBorder';\nconst COLOR_SUPPORT_KEY = 'color';\nconst CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';\nconst FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\nconst FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\nconst LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n/**\n * Key within block settings' support array indicating support for font style.\n */\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\n/**\n * Key within block settings' support array indicating support for font weight.\n */\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\n/**\n * Key within block settings' supports array indicating support for text\n * columns e.g. settings found in `block.json`.\n */\nconst TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\n/**\n * Key within block settings' supports array indicating support for text\n * decorations e.g. settings found in `block.json`.\n */\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\n/**\n * Key within block settings' supports array indicating support for text\n * transforms e.g. settings found in `block.json`.\n */\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\n/**\n * Key within block settings' supports array indicating support for letter-spacing\n * e.g. settings found in `block.json`.\n */\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst LAYOUT_SUPPORT_KEY = 'layout';\nconst TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\nconst SPACING_SUPPORT_KEY = 'spacing';\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\n/**\n * Returns true if the block defines support for align.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for align wide.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignWideSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align wide, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignWideSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( nameOrType, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( nameOrType, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Get block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getBorderSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ BORDER_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\n/**\n * Returns true if the block defines support for link color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLinkColorSupport = ( nameOrType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\n/**\n * Returns true if the block defines support for gradient color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasGradientSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasBackgroundColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasTextColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Get block support for color properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Color feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getColorSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ COLOR_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for custom class name.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasCustomClassNameSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns the block support value for custom class name, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getCustomClassNameSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns true if the block defines support for font family.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontFamilySupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font family, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontFamilySupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for font size.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontSizeSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font size, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontSizeSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for layout.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLayoutSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns the block support value for layout, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getLayoutSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for style.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/supports.js"],"names":["getBlockSupport","hasBlockSupport","Platform","ALIGN_SUPPORT_KEY","ALIGN_WIDE_SUPPORT_KEY","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","CUSTOM_CLASS_NAME_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","LINE_HEIGHT_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","WRITING_MODE_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","LETTER_SPACING_SUPPORT_KEY","LAYOUT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","SPACING_SUPPORT_KEY","styleSupportKeys","hasAlignSupport","nameOrType","getAlignSupport","hasAlignWideSupport","getAlignWideSupport","hasBorderSupport","feature","OS","support","color","radius","width","style","getBorderSupport","hasColorSupport","colorSupport","link","gradient","background","text","hasLinkColorSupport","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","getColorSupport","hasCustomClassNameSupport","getCustomClassNameSupport","hasFontFamilySupport","getFontFamilySupport","hasFontSizeSupport","getFontSizeSupport","hasLayoutSupport","getLayoutSupport","hasStyleSupport","some","key"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,EA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sC,eAAe,GAAKjC,UAAF,IAC9BF,gBAAgB,CAACoC,IAAjB,CAAyBC,GAAF,IAAWzD,eAAe,CAAEsB,UAAF,EAAcmC,GAAd,CAAjD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\nconst ALIGN_SUPPORT_KEY = 'align';\nconst ALIGN_WIDE_SUPPORT_KEY = 'alignWide';\nconst BORDER_SUPPORT_KEY = '__experimentalBorder';\nconst COLOR_SUPPORT_KEY = 'color';\nconst CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';\nconst FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\nconst FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\nconst LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n/**\n * Key within block settings' support array indicating support for font style.\n */\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\n/**\n * Key within block settings' support array indicating support for font weight.\n */\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\n/**\n * Key within block settings' supports array indicating support for text\n * columns e.g. settings found in `block.json`.\n */\nconst TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\n/**\n * Key within block settings' supports array indicating support for text\n * decorations e.g. settings found in `block.json`.\n */\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\n/**\n * Key within block settings' supports array indicating support for writing mode\n * e.g. settings found in `block.json`.\n */\nconst WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';\n/**\n * Key within block settings' supports array indicating support for text\n * transforms e.g. settings found in `block.json`.\n */\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\n\n/**\n * Key within block settings' supports array indicating support for letter-spacing\n * e.g. settings found in `block.json`.\n */\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst LAYOUT_SUPPORT_KEY = 'layout';\nconst TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tWRITING_MODE_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\nconst SPACING_SUPPORT_KEY = 'spacing';\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\n/**\n * Returns true if the block defines support for align.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for align wide.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignWideSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align wide, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignWideSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( nameOrType, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( nameOrType, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Get block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getBorderSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ BORDER_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\n/**\n * Returns true if the block defines support for link color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLinkColorSupport = ( nameOrType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\n/**\n * Returns true if the block defines support for gradient color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasGradientSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasBackgroundColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasTextColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Get block support for color properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Color feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getColorSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ COLOR_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for custom class name.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasCustomClassNameSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns the block support value for custom class name, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getCustomClassNameSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns true if the block defines support for font family.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontFamilySupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font family, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontFamilySupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for font size.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontSizeSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font size, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontSizeSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for layout.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLayoutSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns the block support value for layout, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getLayoutSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for style.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n"]}
@@ -26,8 +26,9 @@ const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
26
26
  const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
27
27
  const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
28
28
  const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
29
+ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
29
30
  export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
30
- export const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
31
+ export const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
31
32
 
32
33
  function styleToAttributes(style) {
33
34
  const updatedStyle = { ...omit(style, ['fontFamily'])
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onChange","newStyle","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OAAO,IAAIC,qBADZ,EAECC,qBAFD,QAGO,8CAHP;AAKA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,qBAAT,QAAsC,aAAtC;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;;AAEA,SAASC,IAAT,CAAeC,MAAf,EAAuBC,IAAvB,EAA8B;AAC7B,SAAOC,MAAM,CAACC,WAAP,CACND,MAAM,CAACE,OAAP,CAAgBJ,MAAhB,EAAyBK,MAAzB,CAAiC,CAAE,CAAEC,GAAF,CAAF,KAAe,CAAEL,IAAI,CAACM,QAAL,CAAeD,GAAf,CAAlD,CADM,CAAP;AAGA;;AAED,MAAME,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,2BAA2B,GAAG,yCAApC;AACA,MAAMC,wBAAwB,GAAG,wBAAjC;AACA,MAAMC,sBAAsB,GAAG,oCAA/B;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA,OAAO,MAAMC,sBAAsB,GAAG,YAA/B;AACP,OAAO,MAAMC,uBAAuB,GAAG,CACtCrB,uBADsC,EAEtCE,qBAFsC,EAGtCgB,sBAHsC,EAItCC,uBAJsC,EAKtClB,uBALsC,E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AAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG7D,eAAe,CAAEqD,IAAF,EAAQ,CAC9CzB,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGkB,0BADN;AAEC,IAAA,OAAO,EAAGM,QAFX;AAGC,IAAA,QAAQ,EAAGI,QAHZ;AAIC,IAAA,KAAK,EAAGE,KAJT;AAKC,IAAA,QAAQ,EAAGC,QALZ;AAMC,IAAA,eAAe,EAAGE;AANnB,IADD;AAUA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgC5C,GAAF,IACpCnB,eAAe,CAAE8D,SAAF,EAAa3C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","WRITING_MODE_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onChange","newStyle","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OAAO,IAAIC,qBADZ,EAECC,qBAFD,QAGO,8CAHP;AAKA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,qBAAT,QAAsC,aAAtC;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;;A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B,eAAe,CAAE+D,SAAF,EAAa5C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nconst WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tWRITING_MODE_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
@@ -115,6 +115,7 @@ export function useBlockSettings(name, parentLayout) {
115
115
  const lineHeight = useSetting('typography.lineHeight');
116
116
  const textColumns = useSetting('typography.textColumns');
117
117
  const textDecoration = useSetting('typography.textDecoration');
118
+ const writingMode = useSetting('typography.writingMode');
118
119
  const textTransform = useSetting('typography.textTransform');
119
120
  const letterSpacing = useSetting('typography.letterSpacing');
120
121
  const padding = useSetting('spacing.padding');
@@ -188,7 +189,8 @@ export function useBlockSettings(name, parentLayout) {
188
189
  textColumns,
189
190
  textDecoration,
190
191
  textTransform,
191
- letterSpacing
192
+ letterSpacing,
193
+ writingMode
192
194
  },
193
195
  spacing: {
194
196
  spacingSizes: {
@@ -211,7 +213,7 @@ export function useBlockSettings(name, parentLayout) {
211
213
  layout,
212
214
  parentLayout
213
215
  };
214
- }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
216
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
215
217
  return useSettingsForBlockElement(rawSettings, name);
216
218
  }
217
219
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","setImmutably","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AAED,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,OAAP,CAAgBL,MAAhB,EAC3BM,GAD2B,CACtB,CAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF,KAAsB,CAAED,GAAF,EAAOR,gBAAgB,CAAES,KAAF,CAAvB,CADA,EAE3BC,MAF2B,CAEnB,CAAE,GAAID,KAAJ,CAAF,KAAmBA,KAAK,KAAKE,SAFV,CAA7B;AAGA,SAAO,CAAEP,oBAAoB,CAACQ,MAAvB,GACJD,SADI,GAEJN,MAAM,CAACQ,WAAP,CAAoBT,oBAApB,CAFH;AAGA,CAfM;AAiBP,OAAO,SAASU,eAAT,CACNC,cADM,EAENC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3B;AA4GA,SAAOlF,0BAA0B,CAAEmF,WAAF,EAAezC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { setImmutably } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","setImmutably","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","entries","map","key","value","filter","undefined","length","fromEntries","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","writingMode","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AAED,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,OAAP,CAAgBL,MAAhB,EAC3BM,GAD2B,CACtB,CAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF,KAAsB,CAAED,GAAF,EAAOR,gBAAgB,CAAES,KAAF,CAAvB,CADA,EAE3BC,MAF2B,CAEnB,CAAE,GAAID,KAAJ,CAAF,KAAmBA,KAAK,KAAKE,SAFV,CAA7B;AAGA,SAAO,CAAEP,oBAAoB,CAACQ,MAAvB,GACJD,SADI,GAEJN,MAAM,CAACQ,WAAP,CAAoBT,oBAApB,CAFH;AAGA,CAfM;AAiBP,OAAO,SAASU,eAAT,CACNC,cADM,EAENC,cAFM,EAGNC,MAHM,EAINC,MAJM,EAKNC,KALM,EAMNC,OANM,EAOL;AACD;AACA,MACCf,MAAM,CAACgB,MAAP,CAAeN,cAAf,aAAeA,cAAf,cAAeA,cAAf,GAAiC,EAAjC,EAAsCO,KAAtC,CACGC,QAAF,IA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n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { setImmutably } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\n\tconst cleanedNestedObjects = Object.entries( object )\n\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t.filter( ( [ , value ] ) => value !== undefined );\n\treturn ! cleanedNestedObjects.length\n\t\t? undefined\n\t\t: Object.fromEntries( cleanedNestedObjects );\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst writingMode = useSetting( 'typography.writingMode' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t\twritingMode,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\twritingMode,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}