@wordpress/block-editor 13.2.0 → 13.3.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 (367) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +0 -1
  3. package/build/components/block-breadcrumb/index.js +12 -1
  4. package/build/components/block-breadcrumb/index.js.map +1 -1
  5. package/build/components/block-lock/toolbar.js +0 -1
  6. package/build/components/block-lock/toolbar.js.map +1 -1
  7. package/build/components/block-mover/button.js +1 -1
  8. package/build/components/block-mover/button.js.map +1 -1
  9. package/build/components/block-mover/index.js +1 -1
  10. package/build/components/block-mover/index.js.map +1 -1
  11. package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
  12. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  13. package/build/components/block-patterns-paging/index.js +5 -7
  14. package/build/components/block-patterns-paging/index.js.map +1 -1
  15. package/build/components/block-quick-navigation/index.js +20 -17
  16. package/build/components/block-quick-navigation/index.js.map +1 -1
  17. package/build/components/block-rename/modal.js +4 -12
  18. package/build/components/block-rename/modal.js.map +1 -1
  19. package/build/components/block-toolbar/shuffle.js +1 -0
  20. package/build/components/block-toolbar/shuffle.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +7 -58
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  24. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  25. package/build/components/block-tools/index.js +14 -1
  26. package/build/components/block-tools/index.js.map +1 -1
  27. package/build/components/block-tools/use-show-block-tools.js +4 -2
  28. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  29. package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
  30. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  31. package/build/components/block-tools/zoom-out-popover.js +57 -0
  32. package/build/components/block-tools/zoom-out-popover.js.map +1 -0
  33. package/build/components/block-tools/zoom-out-toolbar.js +138 -0
  34. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
  35. package/build/components/button-block-appender/index.js +3 -1
  36. package/build/components/button-block-appender/index.js.map +1 -1
  37. package/build/components/child-layout-control/index.js +26 -18
  38. package/build/components/child-layout-control/index.js.map +1 -1
  39. package/build/components/date-format-picker/index.js +10 -1
  40. package/build/components/date-format-picker/index.js.map +1 -1
  41. package/build/components/dimensions-tool/index.js +6 -4
  42. package/build/components/dimensions-tool/index.js.map +1 -1
  43. package/build/components/font-appearance-control/index.js +26 -61
  44. package/build/components/font-appearance-control/index.js.map +1 -1
  45. package/build/components/global-styles/background-panel.js +178 -116
  46. package/build/components/global-styles/background-panel.js.map +1 -1
  47. package/build/components/global-styles/border-panel.js +2 -1
  48. package/build/components/global-styles/border-panel.js.map +1 -1
  49. package/build/components/global-styles/color-panel.js +2 -1
  50. package/build/components/global-styles/color-panel.js.map +1 -1
  51. package/build/components/global-styles/dimensions-panel.js +2 -1
  52. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  53. package/build/components/global-styles/filters-panel.js +2 -1
  54. package/build/components/global-styles/filters-panel.js.map +1 -1
  55. package/build/components/global-styles/hooks.js +8 -0
  56. package/build/components/global-styles/hooks.js.map +1 -1
  57. package/build/components/global-styles/image-settings-panel.js +2 -1
  58. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  59. package/build/components/global-styles/typography-panel.js +50 -12
  60. package/build/components/global-styles/typography-panel.js.map +1 -1
  61. package/build/components/global-styles/typography-utils.js +50 -0
  62. package/build/components/global-styles/typography-utils.js.map +1 -1
  63. package/build/components/global-styles/use-global-styles-output.js +23 -8
  64. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  65. package/build/components/global-styles/utils.js +17 -7
  66. package/build/components/global-styles/utils.js.map +1 -1
  67. package/build/components/grid/grid-item-movers.js +11 -14
  68. package/build/components/grid/grid-item-movers.js.map +1 -1
  69. package/build/components/grid/grid-item-resizer.js +2 -2
  70. package/build/components/grid/grid-item-resizer.js.map +1 -1
  71. package/build/components/grid/grid-visualizer.js +116 -36
  72. package/build/components/grid/grid-visualizer.js.map +1 -1
  73. package/build/components/grid/use-grid-layout-sync.js +29 -22
  74. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  75. package/build/components/inner-blocks/index.js +1 -1
  76. package/build/components/inner-blocks/index.js.map +1 -1
  77. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  78. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  79. package/build/components/inserter/menu.js +26 -4
  80. package/build/components/inserter/menu.js.map +1 -1
  81. package/build/components/inserter/quick-inserter.js +2 -1
  82. package/build/components/inserter/quick-inserter.js.map +1 -1
  83. package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
  84. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  85. package/build/components/link-control/link-preview.js +1 -1
  86. package/build/components/link-control/link-preview.js.map +1 -1
  87. package/build/components/media-placeholder/index.js +19 -23
  88. package/build/components/media-placeholder/index.js.map +1 -1
  89. package/build/components/navigable-toolbar/index.js +3 -1
  90. package/build/components/navigable-toolbar/index.js.map +1 -1
  91. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
  92. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  93. package/build/components/tabbed-sidebar/index.js +66 -0
  94. package/build/components/tabbed-sidebar/index.js.map +1 -0
  95. package/build/components/url-popover/index.js +3 -0
  96. package/build/components/url-popover/index.js.map +1 -1
  97. package/build/hooks/background.js +26 -4
  98. package/build/hooks/background.js.map +1 -1
  99. package/build/hooks/block-hooks.js +11 -17
  100. package/build/hooks/block-hooks.js.map +1 -1
  101. package/build/hooks/block-style-variation.js +169 -4
  102. package/build/hooks/block-style-variation.js.map +1 -1
  103. package/build/hooks/duotone.js +16 -11
  104. package/build/hooks/duotone.js.map +1 -1
  105. package/build/hooks/grid-visualizer.js +65 -0
  106. package/build/hooks/grid-visualizer.js.map +1 -0
  107. package/build/hooks/index.js +15 -2
  108. package/build/hooks/index.js.map +1 -1
  109. package/build/hooks/layout-child.js +39 -22
  110. package/build/hooks/layout-child.js.map +1 -1
  111. package/build/hooks/position.js +2 -9
  112. package/build/hooks/position.js.map +1 -1
  113. package/build/hooks/use-bindings-attributes.js +16 -6
  114. package/build/hooks/use-bindings-attributes.js.map +1 -1
  115. package/build/hooks/utils.js +2 -0
  116. package/build/hooks/utils.js.map +1 -1
  117. package/build/layouts/constrained.js +44 -2
  118. package/build/layouts/constrained.js.map +1 -1
  119. package/build/layouts/grid.js +90 -51
  120. package/build/layouts/grid.js.map +1 -1
  121. package/build/private-apis.js +6 -1
  122. package/build/private-apis.js.map +1 -1
  123. package/build/store/defaults.js +0 -2
  124. package/build/store/defaults.js.map +1 -1
  125. package/build/store/defaults.native.js +0 -3
  126. package/build/store/defaults.native.js.map +1 -1
  127. package/build/store/private-keys.js +2 -1
  128. package/build/store/private-keys.js.map +1 -1
  129. package/build/utils/format-font-style.js +45 -0
  130. package/build/utils/format-font-style.js.map +1 -0
  131. package/build/utils/format-font-weight.js +68 -0
  132. package/build/utils/format-font-weight.js.map +1 -0
  133. package/build/utils/get-editor-region.js +34 -0
  134. package/build/utils/get-editor-region.js.map +1 -0
  135. package/build/utils/get-font-styles-and-weights.js +167 -0
  136. package/build/utils/get-font-styles-and-weights.js.map +1 -0
  137. package/build/utils/pasting.js +5 -13
  138. package/build/utils/pasting.js.map +1 -1
  139. package/build-module/components/block-breadcrumb/index.js +12 -1
  140. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  141. package/build-module/components/block-lock/toolbar.js +0 -1
  142. package/build-module/components/block-lock/toolbar.js.map +1 -1
  143. package/build-module/components/block-mover/button.js +1 -1
  144. package/build-module/components/block-mover/button.js.map +1 -1
  145. package/build-module/components/block-mover/index.js +1 -1
  146. package/build-module/components/block-mover/index.js.map +1 -1
  147. package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
  148. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  149. package/build-module/components/block-patterns-paging/index.js +5 -7
  150. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  151. package/build-module/components/block-quick-navigation/index.js +20 -17
  152. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  153. package/build-module/components/block-rename/modal.js +5 -13
  154. package/build-module/components/block-rename/modal.js.map +1 -1
  155. package/build-module/components/block-toolbar/shuffle.js +1 -0
  156. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  157. package/build-module/components/block-tools/block-selection-button.js +10 -61
  158. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  159. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
  160. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
  161. package/build-module/components/block-tools/index.js +14 -1
  162. package/build-module/components/block-tools/index.js.map +1 -1
  163. package/build-module/components/block-tools/use-show-block-tools.js +4 -2
  164. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  165. package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
  166. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  167. package/build-module/components/block-tools/zoom-out-popover.js +48 -0
  168. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
  169. package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
  170. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
  171. package/build-module/components/button-block-appender/index.js +3 -1
  172. package/build-module/components/button-block-appender/index.js.map +1 -1
  173. package/build-module/components/child-layout-control/index.js +27 -19
  174. package/build-module/components/child-layout-control/index.js.map +1 -1
  175. package/build-module/components/date-format-picker/index.js +11 -3
  176. package/build-module/components/date-format-picker/index.js.map +1 -1
  177. package/build-module/components/dimensions-tool/index.js +6 -4
  178. package/build-module/components/dimensions-tool/index.js.map +1 -1
  179. package/build-module/components/font-appearance-control/index.js +28 -63
  180. package/build-module/components/font-appearance-control/index.js.map +1 -1
  181. package/build-module/components/global-styles/background-panel.js +181 -119
  182. package/build-module/components/global-styles/background-panel.js.map +1 -1
  183. package/build-module/components/global-styles/border-panel.js +3 -2
  184. package/build-module/components/global-styles/border-panel.js.map +1 -1
  185. package/build-module/components/global-styles/color-panel.js +3 -2
  186. package/build-module/components/global-styles/color-panel.js.map +1 -1
  187. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  188. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  189. package/build-module/components/global-styles/filters-panel.js +3 -2
  190. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +8 -0
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/image-settings-panel.js +3 -2
  194. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  195. package/build-module/components/global-styles/typography-panel.js +52 -14
  196. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  197. package/build-module/components/global-styles/typography-utils.js +48 -0
  198. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  199. package/build-module/components/global-styles/use-global-styles-output.js +23 -8
  200. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  201. package/build-module/components/global-styles/utils.js +15 -6
  202. package/build-module/components/global-styles/utils.js.map +1 -1
  203. package/build-module/components/grid/grid-item-movers.js +11 -14
  204. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  205. package/build-module/components/grid/grid-item-resizer.js +2 -2
  206. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  207. package/build-module/components/grid/grid-visualizer.js +117 -37
  208. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  209. package/build-module/components/grid/use-grid-layout-sync.js +29 -22
  210. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  211. package/build-module/components/inner-blocks/index.js +1 -1
  212. package/build-module/components/inner-blocks/index.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
  214. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
  215. package/build-module/components/inserter/menu.js +26 -4
  216. package/build-module/components/inserter/menu.js.map +1 -1
  217. package/build-module/components/inserter/quick-inserter.js +2 -1
  218. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  219. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
  220. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  221. package/build-module/components/link-control/link-preview.js +1 -1
  222. package/build-module/components/link-control/link-preview.js.map +1 -1
  223. package/build-module/components/media-placeholder/index.js +19 -23
  224. package/build-module/components/media-placeholder/index.js.map +1 -1
  225. package/build-module/components/navigable-toolbar/index.js +3 -1
  226. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  227. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
  228. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  229. package/build-module/components/tabbed-sidebar/index.js +60 -0
  230. package/build-module/components/tabbed-sidebar/index.js.map +1 -0
  231. package/build-module/components/url-popover/index.js +3 -0
  232. package/build-module/components/url-popover/index.js.map +1 -1
  233. package/build-module/hooks/background.js +26 -4
  234. package/build-module/hooks/background.js.map +1 -1
  235. package/build-module/hooks/block-hooks.js +11 -17
  236. package/build-module/hooks/block-hooks.js.map +1 -1
  237. package/build-module/hooks/block-style-variation.js +168 -4
  238. package/build-module/hooks/block-style-variation.js.map +1 -1
  239. package/build-module/hooks/duotone.js +16 -11
  240. package/build-module/hooks/duotone.js.map +1 -1
  241. package/build-module/hooks/grid-visualizer.js +64 -0
  242. package/build-module/hooks/grid-visualizer.js.map +1 -0
  243. package/build-module/hooks/index.js +3 -0
  244. package/build-module/hooks/index.js.map +1 -1
  245. package/build-module/hooks/layout-child.js +39 -22
  246. package/build-module/hooks/layout-child.js.map +1 -1
  247. package/build-module/hooks/position.js +2 -9
  248. package/build-module/hooks/position.js.map +1 -1
  249. package/build-module/hooks/use-bindings-attributes.js +16 -6
  250. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  251. package/build-module/hooks/utils.js +2 -0
  252. package/build-module/hooks/utils.js.map +1 -1
  253. package/build-module/layouts/constrained.js +44 -2
  254. package/build-module/layouts/constrained.js.map +1 -1
  255. package/build-module/layouts/grid.js +90 -51
  256. package/build-module/layouts/grid.js.map +1 -1
  257. package/build-module/private-apis.js +8 -3
  258. package/build-module/private-apis.js.map +1 -1
  259. package/build-module/store/defaults.js +0 -2
  260. package/build-module/store/defaults.js.map +1 -1
  261. package/build-module/store/defaults.native.js +0 -3
  262. package/build-module/store/defaults.native.js.map +1 -1
  263. package/build-module/store/private-keys.js +1 -0
  264. package/build-module/store/private-keys.js.map +1 -1
  265. package/build-module/utils/format-font-style.js +39 -0
  266. package/build-module/utils/format-font-style.js.map +1 -0
  267. package/build-module/utils/format-font-weight.js +62 -0
  268. package/build-module/utils/format-font-weight.js.map +1 -0
  269. package/build-module/utils/get-editor-region.js +28 -0
  270. package/build-module/utils/get-editor-region.js.map +1 -0
  271. package/build-module/utils/get-font-styles-and-weights.js +160 -0
  272. package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
  273. package/build-module/utils/pasting.js +5 -13
  274. package/build-module/utils/pasting.js.map +1 -1
  275. package/build-style/content-rtl.css +1 -0
  276. package/build-style/content.css +1 -0
  277. package/build-style/style-rtl.css +207 -96
  278. package/build-style/style.css +207 -96
  279. package/package.json +32 -32
  280. package/src/components/block-breadcrumb/index.js +16 -1
  281. package/src/components/block-lock/toolbar.js +0 -1
  282. package/src/components/block-mover/button.js +1 -1
  283. package/src/components/block-mover/index.js +1 -1
  284. package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
  285. package/src/components/block-patterns-paging/index.js +8 -11
  286. package/src/components/block-patterns-paging/style.scss +18 -0
  287. package/src/components/block-quick-navigation/index.js +21 -28
  288. package/src/components/block-rename/modal.js +2 -8
  289. package/src/components/block-switcher/test/index.js +6 -6
  290. package/src/components/block-toolbar/shuffle.js +1 -0
  291. package/src/components/block-toolbar/style.scss +1 -11
  292. package/src/components/block-tools/block-selection-button.js +11 -83
  293. package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
  294. package/src/components/block-tools/index.js +21 -1
  295. package/src/components/block-tools/style.scss +15 -0
  296. package/src/components/block-tools/use-show-block-tools.js +14 -6
  297. package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
  298. package/src/components/block-tools/zoom-out-popover.js +49 -0
  299. package/src/components/block-tools/zoom-out-toolbar.js +140 -0
  300. package/src/components/button-block-appender/index.js +2 -1
  301. package/src/components/child-layout-control/index.js +41 -23
  302. package/src/components/date-format-picker/index.js +10 -1
  303. package/src/components/date-format-picker/style.scss +0 -9
  304. package/src/components/dimensions-tool/index.js +97 -89
  305. package/src/components/font-appearance-control/index.js +29 -83
  306. package/src/components/font-appearance-control/style.scss +3 -5
  307. package/src/components/global-styles/background-panel.js +249 -170
  308. package/src/components/global-styles/border-panel.js +3 -2
  309. package/src/components/global-styles/color-panel.js +3 -2
  310. package/src/components/global-styles/dimensions-panel.js +3 -2
  311. package/src/components/global-styles/filters-panel.js +3 -2
  312. package/src/components/global-styles/hooks.js +9 -0
  313. package/src/components/global-styles/image-settings-panel.js +3 -2
  314. package/src/components/global-styles/style.scss +105 -20
  315. package/src/components/global-styles/test/typography-utils.js +269 -0
  316. package/src/components/global-styles/typography-panel.js +49 -12
  317. package/src/components/global-styles/typography-utils.js +63 -0
  318. package/src/components/global-styles/use-global-styles-output.js +23 -8
  319. package/src/components/global-styles/utils.js +17 -6
  320. package/src/components/grid/grid-item-movers.js +11 -27
  321. package/src/components/grid/grid-item-resizer.js +3 -2
  322. package/src/components/grid/grid-visualizer.js +171 -54
  323. package/src/components/grid/style.scss +43 -8
  324. package/src/components/grid/use-grid-layout-sync.js +31 -28
  325. package/src/components/iframe/content.scss +1 -0
  326. package/src/components/inner-blocks/index.js +2 -1
  327. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
  328. package/src/components/inserter/menu.js +47 -13
  329. package/src/components/inserter/quick-inserter.js +6 -1
  330. package/src/components/inserter/style.scss +1 -49
  331. package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
  332. package/src/components/link-control/link-preview.js +1 -1
  333. package/src/components/media-placeholder/index.js +22 -32
  334. package/src/components/navigable-toolbar/index.js +3 -1
  335. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
  336. package/src/components/tabbed-sidebar/README.md +76 -0
  337. package/src/components/tabbed-sidebar/index.js +70 -0
  338. package/src/components/tabbed-sidebar/style.scss +53 -0
  339. package/src/components/url-popover/index.js +3 -0
  340. package/src/hooks/background.js +25 -10
  341. package/src/hooks/block-hooks.js +9 -16
  342. package/src/hooks/block-style-variation.js +202 -3
  343. package/src/hooks/duotone.js +16 -12
  344. package/src/hooks/grid-visualizer.js +64 -0
  345. package/src/hooks/index.js +3 -0
  346. package/src/hooks/layout-child.js +53 -37
  347. package/src/hooks/position.js +3 -10
  348. package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
  349. package/src/hooks/use-bindings-attributes.js +18 -4
  350. package/src/hooks/utils.js +2 -0
  351. package/src/layouts/constrained.js +43 -2
  352. package/src/layouts/grid.js +146 -51
  353. package/src/private-apis.js +12 -1
  354. package/src/store/defaults.js +0 -2
  355. package/src/store/defaults.native.js +0 -3
  356. package/src/store/private-keys.js +1 -0
  357. package/src/style.scss +1 -1
  358. package/src/utils/format-font-style.js +40 -0
  359. package/src/utils/format-font-weight.js +63 -0
  360. package/src/utils/get-editor-region.js +31 -0
  361. package/src/utils/get-font-styles-and-weights.js +191 -0
  362. package/src/utils/pasting.js +5 -12
  363. package/src/utils/test/format-font-style.js +34 -0
  364. package/src/utils/test/format-font-weight.js +66 -0
  365. package/src/utils/test/get-font-styles-and-weights.js +513 -0
  366. package/tsconfig.tsbuildinfo +1 -1
  367. package/src/hooks/position.scss +0 -18
@@ -33,7 +33,6 @@ export const PREFERENCES_DEFAULTS = {
33
33
  * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
34
34
  * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
35
35
  * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
36
- * @property {boolean} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks
37
36
  */
38
37
  export const SETTINGS_DEFAULTS = {
39
38
  alignWide: false,
@@ -168,7 +167,6 @@ export const SETTINGS_DEFAULTS = {
168
167
  __mobileEnablePageTemplates: false,
169
168
  __experimentalBlockPatterns: [],
170
169
  __experimentalBlockPatternCategories: [],
171
- __unstableGalleryWithImageBlocks: false,
172
170
  __unstableIsPreviewMode: false,
173
171
 
174
172
  // These settings will be completely revamped in the future.
@@ -10,9 +10,6 @@ const SETTINGS_DEFAULTS = {
10
10
  ...SETTINGS,
11
11
  // Don't add the default font sizes for standard themes
12
12
  fontSizes: undefined,
13
- // FOR TESTING ONLY - Later, this will come from a REST API
14
- // eslint-disable-next-line no-undef
15
- __unstableGalleryWithImageBlocks: __DEV__,
16
13
  alignWide: true,
17
14
  supportsLayout: false,
18
15
  __experimentalFeatures: {
@@ -1,3 +1,4 @@
1
1
  export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );
2
+ export const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );
2
3
  export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
3
4
  export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );
package/src/style.scss CHANGED
@@ -42,6 +42,7 @@
42
42
  @import "./components/rich-text/style.scss";
43
43
  @import "./components/segmented-text-control/style.scss";
44
44
  @import "./components/skip-to-selected-block/style.scss";
45
+ @import "./components/tabbed-sidebar/style.scss";
45
46
  @import "./components/tool-selector/style.scss";
46
47
  @import "./components/url-input/style.scss";
47
48
  @import "./components/url-popover/style.scss";
@@ -51,7 +52,6 @@
51
52
  @import "./hooks/color.scss";
52
53
  @import "./hooks/dimensions.scss";
53
54
  @import "./hooks/layout.scss";
54
- @import "./hooks/position.scss";
55
55
  @import "./hooks/spacing.scss";
56
56
  @import "./hooks/typography.scss";
57
57
 
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { _x } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Formats font styles to human readable names.
8
+ *
9
+ * @param {string} fontStyle font style string
10
+ * @return {Object} new object with formatted font style
11
+ */
12
+ export function formatFontStyle( fontStyle ) {
13
+ if ( ! fontStyle ) {
14
+ return {};
15
+ }
16
+
17
+ if ( typeof fontStyle === 'object' ) {
18
+ return fontStyle;
19
+ }
20
+
21
+ let name;
22
+
23
+ switch ( fontStyle ) {
24
+ case 'normal':
25
+ name = _x( 'Regular', 'font style' );
26
+ break;
27
+ case 'italic':
28
+ name = _x( 'Italic', 'font style' );
29
+ break;
30
+ case 'oblique':
31
+ name = _x( 'Oblique', 'font style' );
32
+ break;
33
+
34
+ default:
35
+ name = fontStyle;
36
+ break;
37
+ }
38
+
39
+ return { name, value: fontStyle };
40
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { _x } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Formats font weights to human readable names.
8
+ *
9
+ * @param {string} fontWeight font weight string
10
+ * @return {Object} new object with formatted font weight
11
+ */
12
+ export function formatFontWeight( fontWeight ) {
13
+ if ( ! fontWeight ) {
14
+ return {};
15
+ }
16
+
17
+ if ( typeof fontWeight === 'object' ) {
18
+ return fontWeight;
19
+ }
20
+
21
+ let name;
22
+
23
+ switch ( fontWeight ) {
24
+ case 'normal':
25
+ case '400':
26
+ name = _x( 'Regular', 'font weight' );
27
+ break;
28
+ case 'bold':
29
+ case '700':
30
+ name = _x( 'Bold', 'font weight' );
31
+ break;
32
+ case '100':
33
+ name = _x( 'Thin', 'font weight' );
34
+ break;
35
+ case '200':
36
+ name = _x( 'Extra Light', 'font weight' );
37
+ break;
38
+ case '300':
39
+ name = _x( 'Light', 'font weight' );
40
+ break;
41
+ case '500':
42
+ name = _x( 'Medium', 'font weight' );
43
+ break;
44
+ case '600':
45
+ name = _x( 'Semi Bold', 'font weight' );
46
+ break;
47
+ case '800':
48
+ name = _x( 'Extra Bold', 'font weight' );
49
+ break;
50
+ case '900':
51
+ name = _x( 'Black', 'font weight' );
52
+ break;
53
+ case '1000':
54
+ name = _x( 'Extra Black', 'font weight' );
55
+ break;
56
+
57
+ default:
58
+ name = fontWeight;
59
+ break;
60
+ }
61
+
62
+ return { name, value: fontWeight };
63
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Gets the editor region for a given editor canvas element or
3
+ * returns the passed element if no region is found
4
+ *
5
+ * @param { Object } editor The editor canvas element.
6
+ * @return { Object } The editor region or given editor element
7
+ */
8
+ export default function getEditorRegion( editor ) {
9
+ if ( ! editor ) {
10
+ return null;
11
+ }
12
+
13
+ // If there are multiple editors, we need to find the iframe that contains our contentRef to make sure
14
+ // we're focusing the region that contains this editor.
15
+ const editorCanvas =
16
+ Array.from(
17
+ document.querySelectorAll( 'iframe[name="editor-canvas"]' ).values()
18
+ ).find( ( iframe ) => {
19
+ // Find the iframe that contains our contentRef
20
+ const iframeDocument =
21
+ iframe.contentDocument || iframe.contentWindow.document;
22
+
23
+ return iframeDocument === editor.ownerDocument;
24
+ } ) ?? editor;
25
+
26
+ // The region is provivided by the editor, not the block-editor.
27
+ // We should send focus to the region if one is available to reuse the
28
+ // same interface for navigating landmarks. If no region is available,
29
+ // use the canvas instead.
30
+ return editorCanvas?.closest( '[role="region"]' ) ?? editorCanvas;
31
+ }
@@ -0,0 +1,191 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { _x, __, sprintf } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { formatFontStyle } from './format-font-style';
10
+ import { formatFontWeight } from './format-font-weight';
11
+
12
+ const FONT_STYLES = [
13
+ {
14
+ name: _x( 'Regular', 'font style' ),
15
+ value: 'normal',
16
+ },
17
+ {
18
+ name: _x( 'Italic', 'font style' ),
19
+ value: 'italic',
20
+ },
21
+ ];
22
+
23
+ const FONT_WEIGHTS = [
24
+ {
25
+ name: _x( 'Thin', 'font weight' ),
26
+ value: '100',
27
+ },
28
+ {
29
+ name: _x( 'Extra Light', 'font weight' ),
30
+ value: '200',
31
+ },
32
+ {
33
+ name: _x( 'Light', 'font weight' ),
34
+ value: '300',
35
+ },
36
+ {
37
+ name: _x( 'Regular', 'font weight' ),
38
+ value: '400',
39
+ },
40
+ {
41
+ name: _x( 'Medium', 'font weight' ),
42
+ value: '500',
43
+ },
44
+ {
45
+ name: _x( 'Semi Bold', 'font weight' ),
46
+ value: '600',
47
+ },
48
+ {
49
+ name: _x( 'Bold', 'font weight' ),
50
+ value: '700',
51
+ },
52
+ {
53
+ name: _x( 'Extra Bold', 'font weight' ),
54
+ value: '800',
55
+ },
56
+ {
57
+ name: _x( 'Black', 'font weight' ),
58
+ value: '900',
59
+ },
60
+ {
61
+ name: _x( 'Extra Black', 'font weight' ),
62
+ value: '1000',
63
+ },
64
+ ];
65
+
66
+ /**
67
+ * Builds a list of font style and weight options based on font family faces.
68
+ * Defaults to the standard font styles and weights if no font family faces are provided.
69
+ *
70
+ * @param {Array} fontFamilyFaces font family faces array
71
+ * @return {Object} new object with combined and separated font style and weight properties
72
+ */
73
+ export function getFontStylesAndWeights( fontFamilyFaces ) {
74
+ let fontStyles = [];
75
+ let fontWeights = [];
76
+ const combinedStyleAndWeightOptions = [];
77
+ const isSystemFont = ! fontFamilyFaces || fontFamilyFaces?.length === 0;
78
+ let isVariableFont = false;
79
+
80
+ fontFamilyFaces?.forEach( ( face ) => {
81
+ // Check for variable font by looking for a space in the font weight value. e.g. "100 900"
82
+ if ( /\s/.test( face.fontWeight.trim() ) ) {
83
+ isVariableFont = true;
84
+
85
+ // Find font weight start and end values.
86
+ let [ startValue, endValue ] = face.fontWeight.split( ' ' );
87
+ startValue = parseInt( startValue.slice( 0, 1 ) );
88
+ if ( endValue === '1000' ) {
89
+ endValue = 10;
90
+ } else {
91
+ endValue = parseInt( endValue.slice( 0, 1 ) );
92
+ }
93
+
94
+ // Create font weight options for available variable weights.
95
+ for ( let i = startValue; i <= endValue; i++ ) {
96
+ const fontWeightValue = `${ i.toString() }00`;
97
+ if (
98
+ ! fontWeights.some(
99
+ ( weight ) => weight.value === fontWeightValue
100
+ )
101
+ ) {
102
+ fontWeights.push( formatFontWeight( fontWeightValue ) );
103
+ }
104
+ }
105
+ }
106
+
107
+ // Format font style and weight values.
108
+ const fontWeight = formatFontWeight( face.fontWeight );
109
+ const fontStyle = formatFontStyle( face.fontStyle );
110
+
111
+ // Create font style and font weight lists without duplicates.
112
+ if ( fontStyle ) {
113
+ if (
114
+ ! fontStyles.some(
115
+ ( style ) => style.value === fontStyle.value
116
+ )
117
+ ) {
118
+ fontStyles.push( fontStyle );
119
+ }
120
+ }
121
+ if ( fontWeight ) {
122
+ if (
123
+ ! fontWeights.some(
124
+ ( weight ) => weight.value === fontWeight.value
125
+ )
126
+ ) {
127
+ if ( ! isVariableFont ) {
128
+ fontWeights.push( fontWeight );
129
+ }
130
+ }
131
+ }
132
+ } );
133
+
134
+ // If there is no font weight of 600 or above, then include faux bold as an option.
135
+ if ( ! fontWeights.some( ( weight ) => weight.value >= '600' ) ) {
136
+ fontWeights.push( {
137
+ name: _x( 'Bold', 'font weight' ),
138
+ value: '700',
139
+ } );
140
+ }
141
+
142
+ // If there is no italic font style, then include faux italic as an option.
143
+ if ( ! fontStyles.some( ( style ) => style.value === 'italic' ) ) {
144
+ fontStyles.push( {
145
+ name: _x( 'Italic', 'font style' ),
146
+ value: 'italic',
147
+ } );
148
+ }
149
+
150
+ // Use default font styles and weights for system fonts.
151
+ if ( isSystemFont ) {
152
+ fontStyles = FONT_STYLES;
153
+ fontWeights = FONT_WEIGHTS;
154
+ }
155
+
156
+ // Use default styles and weights if there are no available styles or weights from the provided font faces.
157
+ fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;
158
+ fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;
159
+
160
+ // Generate combined font style and weight options for available fonts.
161
+ fontStyles.forEach( ( { name: styleName, value: styleValue } ) => {
162
+ fontWeights.forEach( ( { name: weightName, value: weightValue } ) => {
163
+ const optionName =
164
+ styleValue === 'normal'
165
+ ? weightName
166
+ : sprintf(
167
+ /* translators: 1: Font weight name. 2: Font style name. */
168
+ __( '%1$s %2$s' ),
169
+ weightName,
170
+ styleName
171
+ );
172
+
173
+ combinedStyleAndWeightOptions.push( {
174
+ key: `${ styleValue }-${ weightValue }`,
175
+ name: optionName,
176
+ style: {
177
+ fontStyle: styleValue,
178
+ fontWeight: weightValue,
179
+ },
180
+ } );
181
+ } );
182
+ } );
183
+
184
+ return {
185
+ fontStyles,
186
+ fontWeights,
187
+ combinedStyleAndWeightOptions,
188
+ isSystemFont,
189
+ isVariableFont,
190
+ };
191
+ }
@@ -52,21 +52,14 @@ export function getPasteEventData( { clipboardData } ) {
52
52
  let plainText = '';
53
53
  let html = '';
54
54
 
55
- // IE11 only supports `Text` as an argument for `getData` and will
56
- // otherwise throw an invalid argument error, so we try the standard
57
- // arguments first, then fallback to `Text` if they fail.
58
55
  try {
59
56
  plainText = clipboardData.getData( 'text/plain' );
60
57
  html = clipboardData.getData( 'text/html' );
61
- } catch ( error1 ) {
62
- try {
63
- html = clipboardData.getData( 'Text' );
64
- } catch ( error2 ) {
65
- // Some browsers like UC Browser paste plain text by default and
66
- // don't support clipboardData at all, so allow default
67
- // behaviour.
68
- return;
69
- }
58
+ } catch ( error ) {
59
+ // Some browsers like UC Browser paste plain text by default and
60
+ // don't support clipboardData at all, so allow default
61
+ // behaviour.
62
+ return;
70
63
  }
71
64
 
72
65
  // Remove Windows-specific metadata appended within copied HTML text.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { formatFontStyle } from '../format-font-style';
5
+
6
+ describe( 'formatFontStyle', () => {
7
+ it( 'should return empty object if style is not available', () => {
8
+ expect( formatFontStyle() ).toEqual( {} );
9
+ } );
10
+
11
+ it( 'should return the same object if style is already an object', () => {
12
+ const fontStyle = { name: 'Italic', value: 'italic' };
13
+ expect( formatFontStyle( fontStyle ) ).toEqual( fontStyle );
14
+ } );
15
+
16
+ it( 'should return the formatted font style', () => {
17
+ expect( formatFontStyle( 'normal' ) ).toEqual( {
18
+ name: 'Regular',
19
+ value: 'normal',
20
+ } );
21
+ expect( formatFontStyle( 'italic' ) ).toEqual( {
22
+ name: 'Italic',
23
+ value: 'italic',
24
+ } );
25
+ expect( formatFontStyle( 'oblique' ) ).toEqual( {
26
+ name: 'Oblique',
27
+ value: 'oblique',
28
+ } );
29
+ expect( formatFontStyle( 'oblique 40deg' ) ).toEqual( {
30
+ name: 'oblique 40deg',
31
+ value: 'oblique 40deg',
32
+ } );
33
+ } );
34
+ } );
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { formatFontWeight } from '../format-font-weight';
5
+
6
+ describe( 'formatFontWeight', () => {
7
+ it( 'should return empty object if weight is not available', () => {
8
+ expect( formatFontWeight() ).toEqual( {} );
9
+ } );
10
+
11
+ it( 'should return the same object if weight is already an object', () => {
12
+ const fontWeight = { name: 'Thin', value: '100' };
13
+ expect( formatFontWeight( fontWeight ) ).toEqual( fontWeight );
14
+ } );
15
+
16
+ it( 'should return the formatted font weight', () => {
17
+ expect( formatFontWeight( '100' ) ).toEqual( {
18
+ name: 'Thin',
19
+ value: '100',
20
+ } );
21
+ expect( formatFontWeight( '200' ) ).toEqual( {
22
+ name: 'Extra Light',
23
+ value: '200',
24
+ } );
25
+ expect( formatFontWeight( '300' ) ).toEqual( {
26
+ name: 'Light',
27
+ value: '300',
28
+ } );
29
+ expect( formatFontWeight( '400' ) ).toEqual( {
30
+ name: 'Regular',
31
+ value: '400',
32
+ } );
33
+ expect( formatFontWeight( '500' ) ).toEqual( {
34
+ name: 'Medium',
35
+ value: '500',
36
+ } );
37
+ expect( formatFontWeight( '600' ) ).toEqual( {
38
+ name: 'Semi Bold',
39
+ value: '600',
40
+ } );
41
+ expect( formatFontWeight( '700' ) ).toEqual( {
42
+ name: 'Bold',
43
+ value: '700',
44
+ } );
45
+ expect( formatFontWeight( '800' ) ).toEqual( {
46
+ name: 'Extra Bold',
47
+ value: '800',
48
+ } );
49
+ expect( formatFontWeight( '900' ) ).toEqual( {
50
+ name: 'Black',
51
+ value: '900',
52
+ } );
53
+ expect( formatFontWeight( '1000' ) ).toEqual( {
54
+ name: 'Extra Black',
55
+ value: '1000',
56
+ } );
57
+ expect( formatFontWeight( 'normal' ) ).toEqual( {
58
+ name: 'Regular',
59
+ value: 'normal',
60
+ } );
61
+ expect( formatFontWeight( 'bold' ) ).toEqual( {
62
+ name: 'Bold',
63
+ value: 'bold',
64
+ } );
65
+ } );
66
+ } );