@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
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = WritingModeControl;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _components = require("@wordpress/components");
15
+
16
+ var _i18n = require("@wordpress/i18n");
17
+
18
+ var _icons = require("@wordpress/icons");
19
+
20
+ /**
21
+ * External dependencies
22
+ */
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+ const WRITING_MODES = [{
28
+ name: (0, _i18n.__)('Horizontal'),
29
+ value: 'horizontal-tb',
30
+ icon: _icons.textHorizontal
31
+ }, {
32
+ name: (0, _i18n.__)('Vertical'),
33
+ value: (0, _i18n.isRTL)() ? 'vertical-lr' : 'vertical-rl',
34
+ icon: _icons.textVertical
35
+ }];
36
+ /**
37
+ * Control to facilitate writing mode selections.
38
+ *
39
+ * @param {Object} props Component props.
40
+ * @param {string} props.className Class name to add to the control.
41
+ * @param {string} props.value Currently selected writing mode.
42
+ * @param {Function} props.onChange Handles change in the writing mode selection.
43
+ *
44
+ * @return {WPElement} Writing Mode control.
45
+ */
46
+
47
+ function WritingModeControl({
48
+ className,
49
+ value,
50
+ onChange
51
+ }) {
52
+ return (0, _element.createElement)("fieldset", {
53
+ className: (0, _classnames.default)('block-editor-writing-mode-control', className)
54
+ }, (0, _element.createElement)(_components.BaseControl.VisualLabel, {
55
+ as: "legend"
56
+ }, (0, _i18n.__)('Orientation')), (0, _element.createElement)("div", {
57
+ className: "block-editor-writing-mode-control__buttons"
58
+ }, WRITING_MODES.map(writingMode => {
59
+ return (0, _element.createElement)(_components.Button, {
60
+ key: writingMode.value,
61
+ icon: writingMode.icon,
62
+ label: writingMode.name,
63
+ isPressed: writingMode.value === value,
64
+ onClick: () => {
65
+ onChange(writingMode.value === value ? undefined : writingMode.value);
66
+ }
67
+ });
68
+ })));
69
+ }
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"names":["WRITING_MODES","name","value","icon","textHorizontal","textVertical","WritingModeControl","className","onChange","map","writingMode","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,MAAMA,aAAa,GAAG,CACrB;AACCC,EAAAA,IAAI,EAAE,cAAI,YAAJ,CADP;AAECC,EAAAA,KAAK,EAAE,eAFR;AAGCC,EAAAA,IAAI,EAAEC;AAHP,CADqB,EAMrB;AACCH,EAAAA,IAAI,EAAE,cAAI,UAAJ,CADP;AAECC,EAAAA,KAAK,EAAE,qBAAU,aAAV,GAA0B,aAFlC;AAGCC,EAAAA,IAAI,EAAEE;AAHP,CANqB,CAAtB;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,kBAAT,CAA6B;AAAEC,EAAAA,SAAF;AAAaL,EAAAA,KAAb;AAAoBM,EAAAA;AAApB,CAA7B,EAA8D;AAC5E,SACC;AACC,IAAA,SAAS,EAAG,yBACX,mCADW,EAEXD,SAFW;AADb,KAMC,4BAAC,uBAAD,CAAa,WAAb;AAAyB,IAAA,EAAE,EAAC;AAA5B,KACG,cAAI,aAAJ,CADH,CAND,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGP,aAAa,CAACS,GAAd,CAAqBC,WAAF,IAAmB;AACvC,WACC,4BAAC,kBAAD;AACC,MAAA,GAAG,EAAGA,WAAW,CAACR,KADnB;AAEC,MAAA,IAAI,EAAGQ,WAAW,CAACP,IAFpB;AAGC,MAAA,KAAK,EAAGO,WAAW,CAACT,IAHrB;AAIC,MAAA,SAAS,EAAGS,WAAW,CAACR,KAAZ,KAAsBA,KAJnC;AAKC,MAAA,OAAO,EAAG,MAAM;AACfM,QAAAA,QAAQ,CACPE,WAAW,CAACR,KAAZ,KAAsBA,KAAtB,GACGS,SADH,GAEGD,WAAW,CAACR,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"]}
@@ -66,43 +66,48 @@ function BehaviorsControl({
66
66
  // Capitalize the first letter of the behavior name.
67
67
  label: `${behaviorName.charAt(0).toUpperCase()}${behaviorName.slice(1).toLowerCase()}`
68
68
  }));
69
- const options = [...Object.values(defaultBehaviors), ...behaviorsOptions]; // If every behavior is disabled, do not show the behaviors inspector control.
70
-
71
- if (behaviorsOptions.length === 0) {
72
- return null;
73
- } // Block behaviors take precedence over theme behaviors.
74
-
75
-
76
- const behaviors = { ...themeBehaviors,
77
- ...(blockBehaviors || {})
78
- };
79
- const helpText = disabled ? (0, _i18n.__)('The lightbox behavior is disabled for linked images.') : '';
69
+ const options = [...Object.values(defaultBehaviors), ...behaviorsOptions];
70
+ const {
71
+ behaviors,
72
+ behaviorsValue
73
+ } = (0, _element.useMemo)(() => {
74
+ const mergedBehaviors = { ...themeBehaviors,
75
+ ...(blockBehaviors || {})
76
+ };
77
+ let value = '';
80
78
 
81
- const value = () => {
82
79
  if (blockBehaviors === undefined) {
83
- return 'default';
80
+ value = 'default';
84
81
  }
85
82
 
86
- if (behaviors?.lightbox.enabled) {
87
- return 'lightbox';
83
+ if (blockBehaviors?.lightbox.enabled) {
84
+ value = 'lightbox';
88
85
  }
89
86
 
90
- return '';
91
- };
87
+ return {
88
+ behaviors: mergedBehaviors,
89
+ behaviorsValue: value
90
+ };
91
+ }, [blockBehaviors, themeBehaviors]); // If every behavior is disabled, do not show the behaviors inspector control.
92
92
 
93
+ if (behaviorsOptions.length === 0) {
94
+ return null;
95
+ }
96
+
97
+ const helpText = disabled ? (0, _i18n.__)('The lightbox behavior is disabled for linked images.') : '';
93
98
  return (0, _element.createElement)(_components2.InspectorControls, {
94
99
  group: "advanced"
95
100
  }, (0, _element.createElement)("div", null, (0, _element.createElement)(_components.SelectControl, {
96
101
  label: (0, _i18n.__)('Behaviors') // At the moment we are only supporting one behavior (Lightbox)
97
102
  ,
98
- value: value(),
103
+ value: behaviorsValue,
99
104
  options: options,
100
105
  onChange: onChangeBehavior,
101
106
  hideCancelButton: true,
102
107
  help: helpText,
103
108
  size: "__unstable-large",
104
109
  disabled: disabled
105
- }), behaviors?.lightbox.enabled && (0, _element.createElement)(_components.SelectControl, {
110
+ }), behaviorsValue === 'lightbox' && (0, _element.createElement)(_components.SelectControl, {
106
111
  label: (0, _i18n.__)('Animation') // At the moment we are only supporting one behavior (Lightbox)
107
112
  ,
108
113
  value: behaviors?.lightbox.animation ? behaviors?.lightbox.animation : '',
@@ -111,7 +116,7 @@ function BehaviorsControl({
111
116
  label: (0, _i18n.__)('Zoom')
112
117
  }, {
113
118
  value: 'fade',
114
- label: 'Fade'
119
+ label: (0, _i18n.__)('Fade')
115
120
  }],
116
121
  onChange: onChangeAnimation,
117
122
  hideCancelButton: false,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"names":["BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","themeBehaviors","select","getBehaviors","getSettings","blockEditorStore","__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":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,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+B,qBAClCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QAAgCF,MAAM,CAAEG,YAAF,CAA5C;AAEA,WAAO;AACNL,MAAAA,QAAQ,EACPI,WAAW,IAAIE,sBAAf,EAAuCC,MAAvC,GAAiDZ,SAAjD,GACGa,SAHE;AAINP,MAAAA,cAAc,EAAEE,YAAY,IAAII,MAAhB,GAA0BZ,SAA1B;AAJV,KAAP;AAMA,GAVmC,EAWpC,CAAEA,SAAF,CAXoC,CAArC;AAcA,QAAMc,gBAAgB,GAAG;AACxBC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b,EAA8C;AAC7C,wBACC,kBADD,EAEC,uCAFD,EAGCX,aAHD;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":["BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","themeBehaviors","select","getBehaviors","getSettings","blockEditorStore","__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":";;;;;;;AASA;;AANA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UAAN,CAAiBjC,SAFnC;AAGC,MAAA,gBAAgB,EAAKmC,SAAF,IAAiB;AACnC,YAAKA,SAAS,KAAK,SAAnB,EAA+B;AAC9BN,UAAAA,KAAK,CAACO,aAAN,CAAqB;AACpBpC,YAAAA,SAAS,EAAEqB;AADS,WAArB;AAGA,SAJD,MAIO;AACN;AACA;AACAQ,UAAAA,KAAK,CAACO,aAAN,CAAqB;AACpBpC,YAAAA,SAAS,EAAE;AACVsB,cAAAA,QAAQ,EAAE;AACTC,gBAAAA,OAAO,EAAEY,SAAS,KAAK,UADd;AAETT,gBAAAA,SAAS,EACRS,SAAS,KAAK,UAAd,GACG,MADH,GAEG;AALK;AADA;AADS,WAArB;AAWA;AACD,OAvBF;AAwBC,MAAA,iBAAiB,EAAKA,SAAF,IAAiB;AACpCN,QAAAA,KAAK,CAACO,aAAN,CAAqB;AACpBpC,UAAAA,SAAS,EAAE;AACVsB,YAAAA,QAAQ,EAAE;AACTC,cAAAA,OAAO,EACNM,KAAK,CAACI,UAAN,CAAiBjC,SAAjB,CAA2BsB,QAA3B,CACEC,OAHM;AAITG,cAAAA,SAAS,EAAES;AAJF;AADA;AADS,SAArB;AAUA,OAnCF;AAoCC,MAAA,QAAQ,EAAGH;AApCZ,MAFD,CADD;AA2CA,GApDD;AAqDA,CAtD4B,EAsD1B,eAtD0B,CAAtB;;;AAwDP,IAAKK,MAAM,EAAEC,8BAAb,EAA8C;AAC7C,wBACC,kBADD,EAEC,uCAFD,EAGCX,aAHD;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"]}
@@ -44,6 +44,12 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
44
44
  */
45
45
 
46
46
  const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
47
+ /**
48
+ * Key within block settings' supports array indicating support for writing mode
49
+ * e.g. settings found in `block.json`.
50
+ */
51
+
52
+ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
47
53
  /**
48
54
  * Key within block settings' supports array indicating support for text
49
55
  * transforms e.g. settings found in `block.json`.
@@ -57,7 +63,7 @@ const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
57
63
 
58
64
  const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
59
65
  const LAYOUT_SUPPORT_KEY = 'layout';
60
- 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];
66
+ 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];
61
67
  const SPACING_SUPPORT_KEY = 'spacing';
62
68
  const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY];
63
69
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/supports.js"],"names":["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","Platform","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":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,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,GAAG,wBAAjC;AACA;AACA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG,yCAApC;AACA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,kBAAkB,GAAG,QAA3B;AACA,MAAMC,uBAAuB,GAAG,CAC/BR,uBAD+B,EAE/BD,qBAF+B,EAG/BE,sBAH+B,EAI/BC,uBAJ+B,EAK/BJ,uBAL+B,EAM/BK,wBAN+B,EAO/BC,2BAP+B,EAQ/BC,0BAR+B,EAS/BC,0BAT+B,CAAhC;AAWA,MAAMG,mBAAmB,GAAG,SAA5B;AACA,MAAMC,gBAAgB,GAAG,CACxB,GAAGF,uBADqB,EAExBb,kBAFwB,EAGxBC,iBAHwB,EAIxBa,mBAJwB,CAAzB;AAOA;AACA;AACA;AACA;AACA;AACA;;AACO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AAgB,CAACqC,IAAjB,CAAyBC,GAAF,IAAW,6BAAiBpC,UAAjB,EAA6BoC,GAA7B,CAAlC,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":["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","Platform","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":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,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,GAAG,wBAAjC;AACA;AACA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG,yCAApC;AACA;AACA;AACA;AACA;;AACA,MAAMC,wBAAwB,GAAG,sCAAjC;AACA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AAEA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,kBAAkB,GAAG,QAA3B;AACA,MAAMC,uBAAuB,GAAG,CAC/BT,uBAD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B,EAA6Bd,qBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM8C,gBAAgB,GAAKhC,UAAF,IAC/B,6BAAiBA,UAAjB,EAA6BL,kBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMsC,gBAAgB,GAAKjC,UAAF,IAC/B,6BAAiBA,UAAjB,EAA6BL,kBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMuC,eAAe,GAAKlC,UAAF,IAC9BF,gBAAgB,CAACqC,IAAjB,CAAyBC,GAAF,IAAW,6BAAiBpC,UAAjB,EAA6BoC,GAA7B,CAAlC,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"]}
@@ -46,9 +46,10 @@ const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
46
46
  const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
47
47
  const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
48
48
  const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
49
+ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
49
50
  const TYPOGRAPHY_SUPPORT_KEY = 'typography';
50
51
  exports.TYPOGRAPHY_SUPPORT_KEY = TYPOGRAPHY_SUPPORT_KEY;
51
- const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, _fontFamily.FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
52
+ const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, _fontFamily.FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
52
53
  exports.TYPOGRAPHY_SUPPORT_KEYS = TYPOGRAPHY_SUPPORT_KEYS;
53
54
 
54
55
  function styleToAttributes(style) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","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":";;;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;AAYA,SAASA,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;AACO,MAAMC,sBAAsB,GAAG,YAA/B;;AACA,MAAMC,uBAAuB,GAAG,CACtCC,mCADsC,E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QAAQ,GAAKC,QAAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG,6BAAiBR,IAAjB,EAAuB,CAC9C5B,sBAD8C,EAE9C,+BAF8C,CAAvB,CAAxB;AAKA,SACC,4BAAC,wBAAD;AACC,IAAA,EAAE,EAAGqB,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;;AAEM,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOrC,uBAAuB,CAACsC,IAAxB,CAAgC/C,GAAF,IACpC,6BAAiB8C,SAAjB,EAA4B9C,GAA5B,CADM,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":["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","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","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":";;;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;AAYA,SAASA,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,MAA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,MAAAA,UAAU,EAAEQ,UAAU,CAACR,UAFE;AAGzBF,MAAAA,QAAQ,EAAEU,UAAU,CAACV;AAHI,KAAF,CAAxB;AAKA,GANa,EAMX,CAAEU,UAAU,CAACd,KAAb,EAAoBc,UAAU,CAACV,QAA/B,EAAyCU,UAAU,CAACR,UAApD,CANW,CAAd;;AAQA,QAAMsB,QAAQ,GAAKC,QAAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG,6BAAiBR,IAAjB,EAAuB,CAC9C5B,sBAD8C,EAE9C,+BAF8C,CAAvB,CAAxB;AAKA,SACC,4BAAC,wBAAD;AACC,IAAA,EAAE,EAAGqB,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;;AAEM,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOrC,uBAAuB,CAACsC,IAAxB,CAAgChD,GAAF,IACpC,6BAAiB+C,SAAjB,EAA4B/C,GAA5B,CADM,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"]}
@@ -136,6 +136,7 @@ function useBlockSettings(name, parentLayout) {
136
136
  const lineHeight = (0, _components.useSetting)('typography.lineHeight');
137
137
  const textColumns = (0, _components.useSetting)('typography.textColumns');
138
138
  const textDecoration = (0, _components.useSetting)('typography.textDecoration');
139
+ const writingMode = (0, _components.useSetting)('typography.writingMode');
139
140
  const textTransform = (0, _components.useSetting)('typography.textTransform');
140
141
  const letterSpacing = (0, _components.useSetting)('typography.letterSpacing');
141
142
  const padding = (0, _components.useSetting)('spacing.padding');
@@ -209,7 +210,8 @@ function useBlockSettings(name, parentLayout) {
209
210
  textColumns,
210
211
  textDecoration,
211
212
  textTransform,
212
- letterSpacing
213
+ letterSpacing,
214
+ writingMode
213
215
  },
214
216
  spacing: {
215
217
  spacingSizes: {
@@ -232,7 +234,7 @@ function useBlockSettings(name, parentLayout) {
232
234
  layout,
233
235
  parentLayout
234
236
  };
235
- }, [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]);
237
+ }, [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]);
236
238
  return (0, _hooks.useSettingsForBlockElement)(rawSettings, name);
237
239
  }
238
240
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["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":";;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;A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,YApBE,EAqBFC,WArBE,EAsBFC,WAtBE,EAuBFC,mBAvBE,EAwBFC,YAxBE,EAyBFC,aAzBE,EA0BFC,WA1BE,EA2BFC,aA3BE,EA4BFC,cA5BE,EA6BFC,cA7BE,EA8BFC,kBA9BE,EA+BFC,mBA/BE,EAgCFC,qBAhCE,EAiCFC,mBAjCE,EAkCFC,oBAlCE,EAmCFC,sBAnCE,EAoCFC,gBApCE,EAqCFC,yBArCE,EAsCFC,mBAtCE,EAuCFC,aAvCE,EAwCFC,aAxCE,CAjEiB,CAApB;AA4GA,SAAO,uCAA4BC,WAA5B,EAAyCzC,IAAzC,CAAP;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":["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":";;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,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;;;;AAiBA,SAASU,eAAT,CACNC,cADM,EAENC,cAFM,EAGNC,MAHM,EAINC,MAJM,EAKNC,KALM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A5CH;AAqDNuC,MAAAA,MAAM,EAAE;AACPb,QAAAA,KAAK,EAAEvB,WADA;AAEPqC,QAAAA,MAAM,EAAEpC,YAFD;AAGPqC,QAAAA,KAAK,EAAEpC,WAHA;AAIPqC,QAAAA,KAAK,EAAEpC;AAJA,OArDF;AA2DNqC,MAAAA,UAAU,EAAE;AACX1C,QAAAA;AADW,OA3DN;AA8DNC,MAAAA,MA9DM;AA+DNlB,MAAAA;AA/DM,KAAP;AAiEA,GAlEmB,EAkEjB,CACFC,YADE,EAEFC,SAFE,EAGFC,cAHE,EAIFC,SAJE,EAKFC,UALE,EAMFC,UANE,EAOFC,WAPE,EAQFC,cARE,EASFE,aATE,EAUFC,aAVE,EAWFF,WAXE,EAYFG,OAZE,EAaFC,MAbE,EAcFC,QAdE,EAeFC,YAfE,EAgBFC,KAhBE,EAiBFC,SAjBE,EAkBFC,MAlBE,EAmBFlB,YAnBE,EAoBFmB,WApBE,EAqBFC,YArBE,EAsBFC,WAtBE,EAuBFC,WAvBE,EAwBFC,mBAxBE,EAyBFC,YAzBE,EA0BFC,aA1BE,EA2BFC,WA3BE,EA4BFC,aA5BE,EA6BFC,cA7BE,EA8BFC,cA9BE,EA+BFC,kBA/BE,EAgCFC,mBAhCE,EAiCFC,qBAjCE,EAkCFC,mBAlCE,EAmCFC,oBAnCE,EAoCFC,sBApCE,EAqCFC,gBArCE,EAsCFC,yBAtCE,EAuCFC,mBAvCE,EAwCFC,aAxCE,EAyCFC,aAzCE,CAlEiB,CAApB;AA8GA,SAAO,uCAA4BC,WAA5B,EAAyC1C,IAAzC,CAAP;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 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"]}
@@ -15,6 +15,8 @@ var _lockUnlock = require("./lock-unlock");
15
15
 
16
16
  var _content = require("./components/rich-text/content");
17
17
 
18
+ var _object = require("./utils/object");
19
+
18
20
  var _resizableBoxPopover = _interopRequireDefault(require("./components/resizable-box-popover"));
19
21
 
20
22
  var _inserter = require("./components/inserter");
@@ -37,6 +39,10 @@ var _blockRemovalWarningModal = require("./components/block-removal-warning-moda
37
39
 
38
40
  var _hooks = require("./hooks");
39
41
 
42
+ var _dimensionsTool = _interopRequireDefault(require("./components/dimensions-tool"));
43
+
44
+ var _resolutionTool = _interopRequireDefault(require("./components/resolution-tool"));
45
+
40
46
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
47
 
42
48
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -53,6 +59,7 @@ exports.privateApis = privateApis;
53
59
  (0, _lockUnlock.lock)(privateApis, { ...globalStyles,
54
60
  ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider,
55
61
  getRichTextValues: _content.getRichTextValues,
62
+ kebabCase: _object.kebabCase,
56
63
  PrivateInserter: _inserter.ComposedPrivateInserter,
57
64
  PrivateListView: _listView.PrivateListView,
58
65
  ResizableBoxPopover: _resizableBoxPopover.default,
@@ -64,6 +71,8 @@ exports.privateApis = privateApis;
64
71
  LayoutStyle: _layout.LayoutStyle,
65
72
  BlockRemovalWarningModal: _blockRemovalWarningModal.BlockRemovalWarningModal,
66
73
  useLayoutClasses: _hooks.useLayoutClasses,
67
- useLayoutStyles: _hooks.useLayoutStyles
74
+ useLayoutStyles: _hooks.useLayoutStyles,
75
+ DimensionsTool: _dimensionsTool.default,
76
+ ResolutionTool: _resolutionTool.default
68
77
  });
69
78
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider","getRichTextValues","PrivateInserter","PrivateListView","ResizableBoxPopover","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","useBlockEditingMode","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAjBA;AACA;AACA;;AAiBA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,iBAAiB,EAAjBA,0BAHkB;AAIlBC,EAAAA,eAAe,EAAfA,iCAJkB;AAKlBC,EAAAA,eAAe,EAAfA,yBALkB;AAMlBC,EAAAA,mBAAmB,EAAnBA,4BANkB;AAOlBC,EAAAA,SAAS,EAATA,0BAPkB;AAQlBC,EAAAA,8BAA8B,EAA9BA,8DARkB;AASlBC,EAAAA,gBAAgB,EAAhBA,uBATkB;AAUlBC,EAAAA,mBAAmB,EAAnBA,qCAVkB;AAWlBC,EAAAA,oBAAoB,EAApBA,6BAXkB;AAYlBC,EAAAA,WAAW,EAAXA,mBAZkB;AAalBC,EAAAA,wBAAwB,EAAxBA,kDAbkB;AAclBC,EAAAA,gBAAgB,EAAhBA,uBAdkB;AAelBC,EAAAA,eAAe,EAAfA;AAfkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/content';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport { useBlockEditingMode } from './components/block-editing-mode';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tgetRichTextValues,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tuseBlockEditingMode,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider","getRichTextValues","kebabCase","PrivateInserter","PrivateListView","ResizableBoxPopover","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","useBlockEditingMode","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AApBA;AACA;AACA;;AAoBA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,iBAAiB,EAAjBA,0BAHkB;AAIlBC,EAAAA,SAAS,EAATA,iBAJkB;AAKlBC,EAAAA,eAAe,EAAfA,iCALkB;AAMlBC,EAAAA,eAAe,EAAfA,yBANkB;AAOlBC,EAAAA,mBAAmB,EAAnBA,4BAPkB;AAQlBC,EAAAA,SAAS,EAATA,0BARkB;AASlBC,EAAAA,8BAA8B,EAA9BA,8DATkB;AAUlBC,EAAAA,gBAAgB,EAAhBA,uBAVkB;AAWlBC,EAAAA,mBAAmB,EAAnBA,qCAXkB;AAYlBC,EAAAA,oBAAoB,EAApBA,6BAZkB;AAalBC,EAAAA,WAAW,EAAXA,mBAbkB;AAclBC,EAAAA,wBAAwB,EAAxBA,kDAdkB;AAelBC,EAAAA,gBAAgB,EAAhBA,uBAfkB;AAgBlBC,EAAAA,eAAe,EAAfA,sBAhBkB;AAiBlBC,EAAAA,cAAc,EAAdA,uBAjBkB;AAkBlBC,EAAAA,cAAc,EAAdA;AAlBkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/content';\nimport { kebabCase } from './utils/object';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport { useBlockEditingMode } from './components/block-editing-mode';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tgetRichTextValues,\n\tkebabCase,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tuseBlockEditingMode,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n} );\n"]}
@@ -9,6 +9,8 @@ var globalStyles = _interopRequireWildcard(require("./components/global-styles")
9
9
 
10
10
  var _provider = require("./components/provider");
11
11
 
12
+ var _object = require("./utils/object");
13
+
12
14
  var _lockUnlock = require("./lock-unlock");
13
15
 
14
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -25,6 +27,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
27
  const privateApis = {};
26
28
  exports.privateApis = privateApis;
27
29
  (0, _lockUnlock.lock)(privateApis, { ...globalStyles,
30
+ kebabCase: _object.kebabCase,
28
31
  ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider
29
32
  });
30
33
  //# sourceMappingURL=private-apis.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;;;;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA;AAFkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["privateApis","globalStyles","kebabCase","ExperimentalBlockEditorProvider"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;;;;;AANA;AACA;AACA;;AAMA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,SAAS,EAATA,iBAFkB;AAGlBC,EAAAA,+BAA+B,EAA/BA;AAHkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { kebabCase } from './utils/object';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tkebabCase,\n\tExperimentalBlockEditorProvider,\n} );\n"]}