@wordpress/block-library 7.9.0 → 7.12.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 (756) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/archives/edit.js +7 -0
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/archives/index.js +4 -0
  5. package/build/archives/index.js.map +1 -1
  6. package/build/block/edit.js +4 -2
  7. package/build/block/edit.js.map +1 -1
  8. package/build/block/edit.native.js +4 -2
  9. package/build/block/edit.native.js.map +1 -1
  10. package/build/button/edit.js +2 -1
  11. package/build/button/edit.js.map +1 -1
  12. package/build/buttons/edit.js +1 -1
  13. package/build/buttons/edit.js.map +1 -1
  14. package/build/calendar/edit.js +12 -5
  15. package/build/calendar/edit.js.map +1 -1
  16. package/build/columns/edit.native.js +3 -2
  17. package/build/columns/edit.native.js.map +1 -1
  18. package/build/comment-template/index.js +1 -1
  19. package/build/comments/deprecated.js +65 -0
  20. package/build/comments/deprecated.js.map +1 -0
  21. package/build/comments/edit/comments-legacy.js +73 -0
  22. package/build/comments/edit/comments-legacy.js.map +1 -0
  23. package/build/comments/{edit.js → edit/index.js} +17 -38
  24. package/build/comments/edit/index.js.map +1 -0
  25. package/build/comments/edit/placeholder.js +117 -0
  26. package/build/comments/edit/placeholder.js.map +1 -0
  27. package/build/comments/edit/template.js +39 -0
  28. package/build/comments/edit/template.js.map +1 -0
  29. package/build/comments/index.js +11 -3
  30. package/build/comments/index.js.map +1 -1
  31. package/build/comments/save.js +12 -4
  32. package/build/comments/save.js.map +1 -1
  33. package/build/comments-pagination/index.js +1 -1
  34. package/build/comments-title/deprecated.js +1 -1
  35. package/build/comments-title/index.js +1 -1
  36. package/build/cover/edit/block-controls.js +2 -12
  37. package/build/cover/edit/block-controls.js.map +1 -1
  38. package/build/cover/edit/cover-placeholder.js +3 -1
  39. package/build/cover/edit/cover-placeholder.js.map +1 -1
  40. package/build/cover/edit/index.js +19 -4
  41. package/build/cover/edit/index.js.map +1 -1
  42. package/build/cover/edit/resizable-cover.js +6 -0
  43. package/build/cover/edit/resizable-cover.js.map +1 -1
  44. package/build/cover/transforms.js +3 -2
  45. package/build/cover/transforms.js.map +1 -1
  46. package/build/embed/embed-placeholder.native.js +1 -3
  47. package/build/embed/embed-placeholder.native.js.map +1 -1
  48. package/build/gallery/edit.js +11 -19
  49. package/build/gallery/edit.js.map +1 -1
  50. package/build/gallery/transforms.js +30 -20
  51. package/build/gallery/transforms.js.map +1 -1
  52. package/build/gallery/use-get-media.js +7 -18
  53. package/build/gallery/use-get-media.js.map +1 -1
  54. package/build/gallery/use-get-media.native.js +59 -0
  55. package/build/gallery/use-get-media.native.js.map +1 -0
  56. package/build/group/edit.js +1 -3
  57. package/build/group/edit.js.map +1 -1
  58. package/build/group/index.js +1 -0
  59. package/build/group/index.js.map +1 -1
  60. package/build/group/transforms.js +5 -0
  61. package/build/group/transforms.js.map +1 -1
  62. package/build/group/variations.js +1 -1
  63. package/build/group/variations.js.map +1 -1
  64. package/build/heading/heading-level-dropdown.js +2 -1
  65. package/build/heading/heading-level-dropdown.js.map +1 -1
  66. package/build/heading/index.js +9 -4
  67. package/build/heading/index.js.map +1 -1
  68. package/build/image/deprecated.js +77 -9
  69. package/build/image/deprecated.js.map +1 -1
  70. package/build/image/edit.js +3 -1
  71. package/build/image/edit.js.map +1 -1
  72. package/build/image/edit.native.js +18 -8
  73. package/build/image/edit.native.js.map +1 -1
  74. package/build/image/image.js +27 -20
  75. package/build/image/image.js.map +1 -1
  76. package/build/image/index.js +7 -1
  77. package/build/image/index.js.map +1 -1
  78. package/build/image/save.js +8 -2
  79. package/build/image/save.js.map +1 -1
  80. package/build/index.js +1 -3
  81. package/build/index.js.map +1 -1
  82. package/build/index.native.js +10 -7
  83. package/build/index.native.js.map +1 -1
  84. package/build/latest-posts/edit.js +1 -1
  85. package/build/latest-posts/edit.js.map +1 -1
  86. package/build/list/index.js +6 -0
  87. package/build/list/index.js.map +1 -1
  88. package/build/list/transforms.js +4 -63
  89. package/build/list/transforms.js.map +1 -1
  90. package/build/list/v2/edit.js +16 -5
  91. package/build/list/v2/edit.js.map +1 -1
  92. package/build/list/v2/tag-name.js +31 -0
  93. package/build/list/v2/tag-name.js.map +1 -0
  94. package/build/list/v2/tag-name.native.js +32 -0
  95. package/build/list/v2/tag-name.native.js.map +1 -0
  96. package/build/list/v2/transforms.js +1 -38
  97. package/build/list/v2/transforms.js.map +1 -1
  98. package/build/list-item/edit.js +15 -9
  99. package/build/list-item/edit.js.map +1 -1
  100. package/build/list-item/edit.native.js +158 -0
  101. package/build/list-item/edit.native.js.map +1 -0
  102. package/build/list-item/hooks/index.js +8 -8
  103. package/build/list-item/hooks/index.js.map +1 -1
  104. package/build/list-item/hooks/use-merge.js +174 -0
  105. package/build/list-item/hooks/use-merge.js.map +1 -0
  106. package/build/list-item/hooks/use-outdent-list-item.js +86 -50
  107. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  108. package/build/list-item/icons.native.js +53 -0
  109. package/build/list-item/icons.native.js.map +1 -0
  110. package/build/list-item/list-style-type.native.js +136 -0
  111. package/build/list-item/list-style-type.native.js.map +1 -0
  112. package/build/list-item/utils.js +125 -1
  113. package/build/list-item/utils.js.map +1 -1
  114. package/build/media-text/deprecated.js +265 -16
  115. package/build/media-text/deprecated.js.map +1 -1
  116. package/build/media-text/edit.js +4 -3
  117. package/build/media-text/edit.js.map +1 -1
  118. package/build/media-text/media-container.js +1 -1
  119. package/build/media-text/media-container.js.map +1 -1
  120. package/build/media-text/save.js +13 -0
  121. package/build/media-text/save.js.map +1 -1
  122. package/build/more/edit.js +2 -4
  123. package/build/more/edit.js.map +1 -1
  124. package/build/more/save.js +1 -7
  125. package/build/more/save.js.map +1 -1
  126. package/build/navigation/edit/index.js +68 -123
  127. package/build/navigation/edit/index.js.map +1 -1
  128. package/build/navigation/edit/navigation-menu-selector.js +11 -14
  129. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  130. package/build/navigation/edit/placeholder/index.js +4 -2
  131. package/build/navigation/edit/placeholder/index.js.map +1 -1
  132. package/build/navigation/edit/responsive-wrapper.js +13 -3
  133. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  134. package/build/navigation/edit/use-create-navigation-menu.js +5 -1
  135. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  136. package/build/navigation/edit/use-inner-blocks.js +43 -0
  137. package/build/navigation/edit/use-inner-blocks.js.map +1 -0
  138. package/build/navigation/edit/utils.js +28 -0
  139. package/build/navigation/edit/utils.js.map +1 -0
  140. package/build/navigation/use-navigation-menu.js +7 -3
  141. package/build/navigation/use-navigation-menu.js.map +1 -1
  142. package/build/navigation/view.js +7 -4
  143. package/build/navigation/view.js.map +1 -1
  144. package/build/navigation-link/edit.js +5 -4
  145. package/build/navigation-link/edit.js.map +1 -1
  146. package/build/navigation-link/hooks.js +0 -16
  147. package/build/navigation-link/hooks.js.map +1 -1
  148. package/build/navigation-link/index.js +1 -1
  149. package/build/navigation-link/index.js.map +1 -1
  150. package/build/navigation-submenu/edit.js +2 -1
  151. package/build/navigation-submenu/edit.js.map +1 -1
  152. package/build/navigation-submenu/view.js +7 -4
  153. package/build/navigation-submenu/view.js.map +1 -1
  154. package/build/nextpage/edit.js +1 -3
  155. package/build/nextpage/edit.js.map +1 -1
  156. package/build/page-list/edit.js +10 -3
  157. package/build/page-list/edit.js.map +1 -1
  158. package/build/paragraph/edit.js +7 -11
  159. package/build/paragraph/edit.js.map +1 -1
  160. package/build/post-author/edit.js +5 -2
  161. package/build/post-author/edit.js.map +1 -1
  162. package/build/post-author-biography/edit.js +7 -1
  163. package/build/post-author-biography/edit.js.map +1 -1
  164. package/build/post-comments-form/edit.js +4 -47
  165. package/build/post-comments-form/edit.js.map +1 -1
  166. package/build/post-comments-form/form.js +47 -3
  167. package/build/post-comments-form/form.js.map +1 -1
  168. package/build/post-content/edit.js +4 -2
  169. package/build/post-content/edit.js.map +1 -1
  170. package/build/post-featured-image/edit.js +16 -2
  171. package/build/post-featured-image/edit.js.map +1 -1
  172. package/build/post-featured-image/index.js +9 -0
  173. package/build/post-featured-image/index.js.map +1 -1
  174. package/build/post-terms/edit.js +3 -2
  175. package/build/post-terms/edit.js.map +1 -1
  176. package/build/post-terms/index.js +1 -1
  177. package/build/post-terms/index.js.map +1 -1
  178. package/build/post-title/index.js +1 -0
  179. package/build/post-title/index.js.map +1 -1
  180. package/build/query/edit/inspector-controls/index.js +43 -10
  181. package/build/query/edit/inspector-controls/index.js.map +1 -1
  182. package/build/query/edit/inspector-controls/taxonomy-controls.js +21 -14
  183. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  184. package/build/query/index.js +1 -1
  185. package/build/query/index.js.map +1 -1
  186. package/build/query-no-results/edit.js +1 -1
  187. package/build/query-no-results/edit.js.map +1 -1
  188. package/build/query-pagination-next/edit.js +2 -1
  189. package/build/query-pagination-next/edit.js.map +1 -1
  190. package/build/query-pagination-previous/edit.js +2 -1
  191. package/build/query-pagination-previous/edit.js.map +1 -1
  192. package/build/query-title/edit.js +20 -7
  193. package/build/query-title/edit.js.map +1 -1
  194. package/build/query-title/index.js +4 -0
  195. package/build/query-title/index.js.map +1 -1
  196. package/build/query-title/variations.js +10 -0
  197. package/build/query-title/variations.js.map +1 -1
  198. package/build/quote/deprecated.js +168 -36
  199. package/build/quote/deprecated.js.map +1 -1
  200. package/build/quote/edit.js +76 -39
  201. package/build/quote/edit.js.map +1 -1
  202. package/build/quote/index.js +9 -45
  203. package/build/quote/index.js.map +1 -1
  204. package/build/quote/save.js +1 -5
  205. package/build/quote/save.js.map +1 -1
  206. package/build/quote/transforms.js +110 -158
  207. package/build/quote/transforms.js.map +1 -1
  208. package/build/separator/edit.js +1 -1
  209. package/build/separator/edit.js.map +1 -1
  210. package/build/site-logo/edit.js +5 -13
  211. package/build/site-logo/edit.js.map +1 -1
  212. package/build/site-title/edit/level-toolbar.js +2 -1
  213. package/build/site-title/edit/level-toolbar.js.map +1 -1
  214. package/build/social-link/icons/index.js +13 -0
  215. package/build/social-link/icons/index.js.map +1 -1
  216. package/build/social-link/icons/whatsapp.js +25 -0
  217. package/build/social-link/icons/whatsapp.js.map +1 -0
  218. package/build/social-link/variations.js +7 -0
  219. package/build/social-link/variations.js.map +1 -1
  220. package/build/social-links/edit.js +1 -0
  221. package/build/social-links/edit.js.map +1 -1
  222. package/build/template-part/edit/index.js +21 -10
  223. package/build/template-part/edit/index.js.map +1 -1
  224. package/build/template-part/edit/selection-modal.js +33 -13
  225. package/build/template-part/edit/selection-modal.js.map +1 -1
  226. package/build/template-part/edit/utils/search.js +94 -0
  227. package/build/template-part/edit/utils/search.js.map +1 -0
  228. package/build/template-part/index.js +1 -1
  229. package/build/template-part/index.js.map +1 -1
  230. package/build/template-part/variations.js +0 -16
  231. package/build/template-part/variations.js.map +1 -1
  232. package/build/utils/clean-empty-object.js +5 -3
  233. package/build/utils/clean-empty-object.js.map +1 -1
  234. package/build/video/tracks-editor.js +9 -11
  235. package/build/video/tracks-editor.js.map +1 -1
  236. package/build-module/archives/edit.js +7 -0
  237. package/build-module/archives/edit.js.map +1 -1
  238. package/build-module/archives/index.js +4 -0
  239. package/build-module/archives/index.js.map +1 -1
  240. package/build-module/block/edit.js +5 -3
  241. package/build-module/block/edit.js.map +1 -1
  242. package/build-module/block/edit.native.js +5 -3
  243. package/build-module/block/edit.native.js.map +1 -1
  244. package/build-module/button/edit.js +2 -1
  245. package/build-module/button/edit.js.map +1 -1
  246. package/build-module/buttons/edit.js +2 -2
  247. package/build-module/buttons/edit.js.map +1 -1
  248. package/build-module/calendar/edit.js +12 -4
  249. package/build-module/calendar/edit.js.map +1 -1
  250. package/build-module/columns/edit.native.js +4 -3
  251. package/build-module/columns/edit.native.js.map +1 -1
  252. package/build-module/comment-template/index.js +1 -1
  253. package/build-module/comments/deprecated.js +54 -0
  254. package/build-module/comments/deprecated.js.map +1 -0
  255. package/build-module/comments/edit/comments-legacy.js +59 -0
  256. package/build-module/comments/edit/comments-legacy.js.map +1 -0
  257. package/build-module/comments/edit/index.js +37 -0
  258. package/build-module/comments/edit/index.js.map +1 -0
  259. package/build-module/comments/edit/placeholder.js +102 -0
  260. package/build-module/comments/edit/placeholder.js.map +1 -0
  261. package/build-module/comments/edit/template.js +32 -0
  262. package/build-module/comments/edit/template.js.map +1 -0
  263. package/build-module/comments/index.js +10 -3
  264. package/build-module/comments/index.js.map +1 -1
  265. package/build-module/comments/save.js +9 -4
  266. package/build-module/comments/save.js.map +1 -1
  267. package/build-module/comments-pagination/index.js +1 -1
  268. package/build-module/comments-title/deprecated.js +1 -1
  269. package/build-module/comments-title/index.js +1 -1
  270. package/build-module/cover/edit/block-controls.js +3 -13
  271. package/build-module/cover/edit/block-controls.js.map +1 -1
  272. package/build-module/cover/edit/cover-placeholder.js +3 -1
  273. package/build-module/cover/edit/cover-placeholder.js.map +1 -1
  274. package/build-module/cover/edit/index.js +19 -4
  275. package/build-module/cover/edit/index.js.map +1 -1
  276. package/build-module/cover/edit/resizable-cover.js +6 -0
  277. package/build-module/cover/edit/resizable-cover.js.map +1 -1
  278. package/build-module/cover/transforms.js +3 -2
  279. package/build-module/cover/transforms.js.map +1 -1
  280. package/build-module/embed/embed-placeholder.native.js +1 -2
  281. package/build-module/embed/embed-placeholder.native.js.map +1 -1
  282. package/build-module/gallery/edit.js +11 -18
  283. package/build-module/gallery/edit.js.map +1 -1
  284. package/build-module/gallery/transforms.js +30 -20
  285. package/build-module/gallery/transforms.js.map +1 -1
  286. package/build-module/gallery/use-get-media.js +6 -16
  287. package/build-module/gallery/use-get-media.js.map +1 -1
  288. package/build-module/gallery/use-get-media.native.js +50 -0
  289. package/build-module/gallery/use-get-media.native.js.map +1 -0
  290. package/build-module/group/edit.js +1 -3
  291. package/build-module/group/edit.js.map +1 -1
  292. package/build-module/group/index.js +1 -0
  293. package/build-module/group/index.js.map +1 -1
  294. package/build-module/group/transforms.js +5 -0
  295. package/build-module/group/transforms.js.map +1 -1
  296. package/build-module/group/variations.js +2 -2
  297. package/build-module/group/variations.js.map +1 -1
  298. package/build-module/heading/heading-level-dropdown.js +2 -1
  299. package/build-module/heading/heading-level-dropdown.js.map +1 -1
  300. package/build-module/heading/index.js +9 -4
  301. package/build-module/heading/index.js.map +1 -1
  302. package/build-module/image/deprecated.js +77 -9
  303. package/build-module/image/deprecated.js.map +1 -1
  304. package/build-module/image/edit.js +5 -3
  305. package/build-module/image/edit.js.map +1 -1
  306. package/build-module/image/edit.native.js +18 -8
  307. package/build-module/image/edit.native.js.map +1 -1
  308. package/build-module/image/image.js +29 -22
  309. package/build-module/image/image.js.map +1 -1
  310. package/build-module/image/index.js +7 -1
  311. package/build-module/image/index.js.map +1 -1
  312. package/build-module/image/save.js +9 -3
  313. package/build-module/image/save.js.map +1 -1
  314. package/build-module/index.js +1 -2
  315. package/build-module/index.js.map +1 -1
  316. package/build-module/index.native.js +9 -7
  317. package/build-module/index.native.js.map +1 -1
  318. package/build-module/latest-posts/edit.js +2 -2
  319. package/build-module/latest-posts/edit.js.map +1 -1
  320. package/build-module/list/index.js +1 -1
  321. package/build-module/list/index.js.map +1 -1
  322. package/build-module/list/transforms.js +4 -63
  323. package/build-module/list/transforms.js.map +1 -1
  324. package/build-module/list/v2/edit.js +15 -5
  325. package/build-module/list/v2/edit.js.map +1 -1
  326. package/build-module/list/v2/tag-name.js +21 -0
  327. package/build-module/list/v2/tag-name.js.map +1 -0
  328. package/build-module/list/v2/tag-name.native.js +21 -0
  329. package/build-module/list/v2/tag-name.native.js.map +1 -0
  330. package/build-module/list/v2/transforms.js +3 -39
  331. package/build-module/list/v2/transforms.js.map +1 -1
  332. package/build-module/list-item/edit.js +15 -13
  333. package/build-module/list-item/edit.js.map +1 -1
  334. package/build-module/list-item/edit.native.js +141 -0
  335. package/build-module/list-item/edit.native.js.map +1 -0
  336. package/build-module/list-item/hooks/index.js +1 -1
  337. package/build-module/list-item/hooks/index.js.map +1 -1
  338. package/build-module/list-item/hooks/use-merge.js +160 -0
  339. package/build-module/list-item/hooks/use-merge.js.map +1 -0
  340. package/build-module/list-item/hooks/use-outdent-list-item.js +82 -46
  341. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  342. package/build-module/list-item/icons.native.js +37 -0
  343. package/build-module/list-item/icons.native.js.map +1 -0
  344. package/build-module/list-item/list-style-type.native.js +124 -0
  345. package/build-module/list-item/list-style-type.native.js.map +1 -0
  346. package/build-module/list-item/utils.js +123 -2
  347. package/build-module/list-item/utils.js.map +1 -1
  348. package/build-module/media-text/deprecated.js +267 -17
  349. package/build-module/media-text/deprecated.js.map +1 -1
  350. package/build-module/media-text/edit.js +4 -3
  351. package/build-module/media-text/edit.js.map +1 -1
  352. package/build-module/media-text/media-container.js +1 -1
  353. package/build-module/media-text/media-container.js.map +1 -1
  354. package/build-module/media-text/save.js +13 -0
  355. package/build-module/media-text/save.js.map +1 -1
  356. package/build-module/more/edit.js +2 -4
  357. package/build-module/more/edit.js.map +1 -1
  358. package/build-module/more/save.js +1 -6
  359. package/build-module/more/save.js.map +1 -1
  360. package/build-module/navigation/edit/index.js +66 -122
  361. package/build-module/navigation/edit/index.js.map +1 -1
  362. package/build-module/navigation/edit/navigation-menu-selector.js +12 -15
  363. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  364. package/build-module/navigation/edit/placeholder/index.js +4 -2
  365. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  366. package/build-module/navigation/edit/responsive-wrapper.js +12 -3
  367. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  368. package/build-module/navigation/edit/use-create-navigation-menu.js +5 -1
  369. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  370. package/build-module/navigation/edit/use-inner-blocks.js +33 -0
  371. package/build-module/navigation/edit/use-inner-blocks.js.map +1 -0
  372. package/build-module/navigation/edit/utils.js +21 -0
  373. package/build-module/navigation/edit/utils.js.map +1 -0
  374. package/build-module/navigation/use-navigation-menu.js +7 -3
  375. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  376. package/build-module/navigation/view.js +7 -4
  377. package/build-module/navigation/view.js.map +1 -1
  378. package/build-module/navigation-link/edit.js +5 -4
  379. package/build-module/navigation-link/edit.js.map +1 -1
  380. package/build-module/navigation-link/hooks.js +0 -13
  381. package/build-module/navigation-link/hooks.js.map +1 -1
  382. package/build-module/navigation-link/index.js +1 -1
  383. package/build-module/navigation-link/index.js.map +1 -1
  384. package/build-module/navigation-submenu/edit.js +2 -1
  385. package/build-module/navigation-submenu/edit.js.map +1 -1
  386. package/build-module/navigation-submenu/view.js +7 -4
  387. package/build-module/navigation-submenu/view.js.map +1 -1
  388. package/build-module/nextpage/edit.js +1 -3
  389. package/build-module/nextpage/edit.js.map +1 -1
  390. package/build-module/page-list/edit.js +10 -3
  391. package/build-module/page-list/edit.js.map +1 -1
  392. package/build-module/paragraph/edit.js +8 -12
  393. package/build-module/paragraph/edit.js.map +1 -1
  394. package/build-module/post-author/edit.js +5 -2
  395. package/build-module/post-author/edit.js.map +1 -1
  396. package/build-module/post-author-biography/edit.js +6 -1
  397. package/build-module/post-author-biography/edit.js.map +1 -1
  398. package/build-module/post-comments-form/edit.js +5 -44
  399. package/build-module/post-comments-form/edit.js.map +1 -1
  400. package/build-module/post-comments-form/form.js +46 -5
  401. package/build-module/post-comments-form/form.js.map +1 -1
  402. package/build-module/post-content/edit.js +5 -3
  403. package/build-module/post-content/edit.js.map +1 -1
  404. package/build-module/post-featured-image/edit.js +17 -3
  405. package/build-module/post-featured-image/edit.js.map +1 -1
  406. package/build-module/post-featured-image/index.js +9 -0
  407. package/build-module/post-featured-image/index.js.map +1 -1
  408. package/build-module/post-terms/edit.js +3 -2
  409. package/build-module/post-terms/edit.js.map +1 -1
  410. package/build-module/post-terms/index.js +1 -1
  411. package/build-module/post-terms/index.js.map +1 -1
  412. package/build-module/post-title/index.js +1 -0
  413. package/build-module/post-title/index.js.map +1 -1
  414. package/build-module/query/edit/inspector-controls/index.js +43 -10
  415. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  416. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +16 -12
  417. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  418. package/build-module/query/index.js +1 -1
  419. package/build-module/query/index.js.map +1 -1
  420. package/build-module/query-no-results/edit.js +2 -2
  421. package/build-module/query-no-results/edit.js.map +1 -1
  422. package/build-module/query-pagination-next/edit.js +2 -1
  423. package/build-module/query-pagination-next/edit.js.map +1 -1
  424. package/build-module/query-pagination-previous/edit.js +2 -1
  425. package/build-module/query-pagination-previous/edit.js.map +1 -1
  426. package/build-module/query-title/edit.js +20 -8
  427. package/build-module/query-title/edit.js.map +1 -1
  428. package/build-module/query-title/index.js +4 -0
  429. package/build-module/query-title/index.js.map +1 -1
  430. package/build-module/query-title/variations.js +10 -0
  431. package/build-module/query-title/variations.js.map +1 -1
  432. package/build-module/quote/deprecated.js +162 -36
  433. package/build-module/quote/deprecated.js.map +1 -1
  434. package/build-module/quote/edit.js +77 -43
  435. package/build-module/quote/edit.js.map +1 -1
  436. package/build-module/quote/index.js +9 -39
  437. package/build-module/quote/index.js.map +1 -1
  438. package/build-module/quote/save.js +4 -8
  439. package/build-module/quote/save.js.map +1 -1
  440. package/build-module/quote/transforms.js +111 -158
  441. package/build-module/quote/transforms.js.map +1 -1
  442. package/build-module/separator/edit.js +1 -1
  443. package/build-module/separator/edit.js.map +1 -1
  444. package/build-module/site-logo/edit.js +5 -13
  445. package/build-module/site-logo/edit.js.map +1 -1
  446. package/build-module/site-title/edit/level-toolbar.js +2 -1
  447. package/build-module/site-title/edit/level-toolbar.js.map +1 -1
  448. package/build-module/social-link/icons/index.js +1 -0
  449. package/build-module/social-link/icons/index.js.map +1 -1
  450. package/build-module/social-link/icons/whatsapp.js +15 -0
  451. package/build-module/social-link/icons/whatsapp.js.map +1 -0
  452. package/build-module/social-link/variations.js +8 -1
  453. package/build-module/social-link/variations.js.map +1 -1
  454. package/build-module/social-links/edit.js +1 -0
  455. package/build-module/social-links/edit.js.map +1 -1
  456. package/build-module/template-part/edit/index.js +24 -13
  457. package/build-module/template-part/edit/index.js.map +1 -1
  458. package/build-module/template-part/edit/selection-modal.js +33 -15
  459. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  460. package/build-module/template-part/edit/utils/search.js +84 -0
  461. package/build-module/template-part/edit/utils/search.js.map +1 -0
  462. package/build-module/template-part/index.js +1 -1
  463. package/build-module/template-part/index.js.map +1 -1
  464. package/build-module/template-part/variations.js +0 -13
  465. package/build-module/template-part/variations.js.map +1 -1
  466. package/build-module/utils/clean-empty-object.js +5 -2
  467. package/build-module/utils/clean-empty-object.js.map +1 -1
  468. package/build-module/video/tracks-editor.js +9 -11
  469. package/build-module/video/tracks-editor.js.map +1 -1
  470. package/build-style/button/style-rtl.css +1 -1
  471. package/build-style/button/style.css +1 -1
  472. package/build-style/comment-template/style-rtl.css +12 -0
  473. package/build-style/comment-template/style.css +12 -0
  474. package/build-style/comments/editor-rtl.css +122 -0
  475. package/build-style/comments/editor.css +122 -0
  476. package/build-style/{post-comments → comments}/style-rtl.css +1 -0
  477. package/build-style/{post-comments → comments}/style.css +1 -0
  478. package/build-style/common-rtl.css +7 -0
  479. package/build-style/common.css +7 -0
  480. package/build-style/cover/style-rtl.css +2 -2
  481. package/build-style/cover/style.css +2 -2
  482. package/build-style/editor-elements-rtl.css +85 -0
  483. package/build-style/editor-elements.css +85 -0
  484. package/build-style/editor-rtl.css +162 -11
  485. package/build-style/editor.css +162 -11
  486. package/build-style/{post-comments/editor-rtl.css → elements-rtl.css} +5 -2
  487. package/build-style/{post-comments/editor.css → elements.css} +5 -2
  488. package/build-style/gallery/style-rtl.css +7 -2
  489. package/build-style/gallery/style.css +7 -2
  490. package/build-style/image/editor-rtl.css +4 -3
  491. package/build-style/image/editor.css +4 -3
  492. package/build-style/image/style-rtl.css +33 -3
  493. package/build-style/image/style.css +33 -3
  494. package/build-style/latest-posts/editor-rtl.css +3 -0
  495. package/build-style/latest-posts/editor.css +3 -0
  496. package/build-style/navigation/style-rtl.css +17 -19
  497. package/build-style/navigation/style.css +17 -19
  498. package/build-style/post-comments-form/style-rtl.css +0 -1
  499. package/build-style/post-comments-form/style.css +0 -1
  500. package/build-style/query/editor-rtl.css +8 -1
  501. package/build-style/query/editor.css +8 -1
  502. package/build-style/query-pagination/style-rtl.css +6 -0
  503. package/build-style/query-pagination/style.css +6 -0
  504. package/build-style/search/style-rtl.css +2 -0
  505. package/build-style/search/style.css +2 -0
  506. package/build-style/search/theme-rtl.css +5 -0
  507. package/build-style/search/theme.css +5 -0
  508. package/build-style/social-link/editor-rtl.css +1 -0
  509. package/build-style/social-link/editor.css +1 -0
  510. package/build-style/social-links/style-rtl.css +8 -0
  511. package/build-style/social-links/style.css +8 -0
  512. package/build-style/style-rtl.css +208 -139
  513. package/build-style/style.css +208 -139
  514. package/build-style/tag-cloud/style-rtl.css +1 -0
  515. package/build-style/tag-cloud/style.css +1 -0
  516. package/build-style/template-part/editor-rtl.css +14 -3
  517. package/build-style/template-part/editor.css +14 -3
  518. package/build-style/theme-rtl.css +5 -0
  519. package/build-style/theme.css +5 -0
  520. package/package.json +28 -29
  521. package/src/archives/block.json +4 -0
  522. package/src/archives/edit.js +12 -1
  523. package/src/archives/index.php +5 -3
  524. package/src/audio/test/__snapshots__/edit.native.js.snap +16 -2
  525. package/src/block/edit.js +4 -4
  526. package/src/block/edit.native.js +4 -4
  527. package/src/button/edit.js +1 -0
  528. package/src/button/style.scss +3 -1
  529. package/src/buttons/edit.js +1 -5
  530. package/src/calendar/edit.js +11 -4
  531. package/src/columns/edit.native.js +5 -3
  532. package/src/comment-template/block.json +1 -1
  533. package/src/comment-template/style.scss +14 -0
  534. package/src/comments/block.json +7 -2
  535. package/src/comments/deprecated.js +53 -0
  536. package/src/comments/edit/comments-legacy.js +71 -0
  537. package/src/comments/edit/index.js +35 -0
  538. package/src/comments/edit/placeholder.js +124 -0
  539. package/src/comments/{edit.js → edit/template.js} +1 -28
  540. package/src/comments/editor.scss +9 -0
  541. package/src/comments/index.js +2 -0
  542. package/src/comments/index.php +219 -0
  543. package/src/comments/save.js +8 -7
  544. package/src/{post-comments → comments}/style.scss +7 -0
  545. package/src/comments-pagination/block.json +1 -1
  546. package/src/comments-title/block.json +1 -1
  547. package/src/common.scss +2 -0
  548. package/src/cover/edit/block-controls.js +4 -20
  549. package/src/cover/edit/cover-placeholder.js +2 -0
  550. package/src/cover/edit/index.js +16 -0
  551. package/src/cover/edit/resizable-cover.js +6 -0
  552. package/src/cover/index.php +2 -2
  553. package/src/cover/style.scss +2 -2
  554. package/src/cover/transforms.js +2 -2
  555. package/src/editor-elements.scss +10 -0
  556. package/src/editor.scss +2 -1
  557. package/src/elements.scss +6 -0
  558. package/src/embed/embed-placeholder.native.js +2 -3
  559. package/src/file/test/__snapshots__/edit.native.js.snap +32 -4
  560. package/src/gallery/edit.js +12 -23
  561. package/src/gallery/index.php +1 -1
  562. package/src/gallery/style.scss +10 -1
  563. package/src/gallery/transforms.js +25 -10
  564. package/src/gallery/use-get-media.js +11 -28
  565. package/src/gallery/use-get-media.native.js +44 -0
  566. package/src/group/block.json +1 -0
  567. package/src/group/edit.js +1 -3
  568. package/src/group/transforms.js +7 -0
  569. package/src/group/variations.js +2 -2
  570. package/src/heading/heading-level-dropdown.js +1 -0
  571. package/src/heading/index.js +8 -2
  572. package/src/home-link/index.php +8 -17
  573. package/src/image/block.json +7 -1
  574. package/src/image/deprecated.js +86 -0
  575. package/src/image/edit.js +6 -1
  576. package/src/image/edit.native.js +18 -7
  577. package/src/image/editor.scss +9 -4
  578. package/src/image/image.js +26 -16
  579. package/src/image/save.js +10 -1
  580. package/src/image/style.scss +39 -3
  581. package/src/image/test/edit.native.js +6 -10
  582. package/src/index.js +0 -2
  583. package/src/index.native.js +11 -7
  584. package/src/latest-posts/edit.js +2 -6
  585. package/src/latest-posts/editor.scss +5 -0
  586. package/src/list/index.js +1 -1
  587. package/src/list/test/__snapshots__/edit.native.js.snap +133 -0
  588. package/src/list/test/edit.native.js +511 -7
  589. package/src/list/transforms.js +0 -47
  590. package/src/list/v2/edit.js +12 -4
  591. package/src/list/v2/tag-name.js +13 -0
  592. package/src/list/v2/tag-name.native.js +12 -0
  593. package/src/list/v2/transforms.js +3 -49
  594. package/src/list-item/edit.js +11 -13
  595. package/src/list-item/edit.native.js +148 -0
  596. package/src/list-item/hooks/index.js +1 -1
  597. package/src/list-item/hooks/use-merge.js +141 -0
  598. package/src/list-item/hooks/use-outdent-list-item.js +72 -74
  599. package/src/list-item/icons.native.js +34 -0
  600. package/src/list-item/list-style-type.native.js +139 -0
  601. package/src/list-item/style.native.scss +45 -0
  602. package/src/list-item/utils.js +27 -3
  603. package/src/media-text/deprecated.js +581 -288
  604. package/src/media-text/edit.js +3 -1
  605. package/src/media-text/media-container.js +3 -1
  606. package/src/media-text/save.js +18 -0
  607. package/src/media-text/test/media-container.js +24 -0
  608. package/src/more/edit.js +9 -11
  609. package/src/more/save.js +3 -6
  610. package/src/navigation/edit/index.js +83 -164
  611. package/src/navigation/edit/navigation-menu-selector.js +12 -26
  612. package/src/navigation/edit/placeholder/index.js +4 -2
  613. package/src/navigation/edit/responsive-wrapper.js +24 -3
  614. package/src/navigation/edit/use-create-navigation-menu.js +4 -0
  615. package/src/navigation/edit/use-inner-blocks.js +39 -0
  616. package/src/navigation/edit/utils.js +30 -0
  617. package/src/navigation/index.php +6 -0
  618. package/src/navigation/style.scss +13 -23
  619. package/src/navigation/use-navigation-menu.js +9 -5
  620. package/src/navigation/view.js +6 -6
  621. package/src/navigation-link/edit.js +4 -3
  622. package/src/navigation-link/hooks.js +0 -14
  623. package/src/navigation-link/index.js +1 -1
  624. package/src/navigation-link/index.php +1 -1
  625. package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
  626. package/src/navigation-link/test/hooks.js +0 -12
  627. package/src/navigation-submenu/edit.js +1 -0
  628. package/src/navigation-submenu/index.php +1 -1
  629. package/src/navigation-submenu/view.js +6 -6
  630. package/src/nextpage/edit.js +1 -3
  631. package/src/page-list/edit.js +12 -5
  632. package/src/page-list/index.php +4 -4
  633. package/src/paragraph/edit.js +8 -14
  634. package/src/post-author/edit.js +6 -3
  635. package/src/post-author-biography/edit.js +4 -1
  636. package/src/post-comments-form/edit.js +2 -74
  637. package/src/post-comments-form/form.js +80 -5
  638. package/src/post-comments-form/index.php +1 -1
  639. package/src/post-comments-form/style.scss +0 -1
  640. package/src/post-content/edit.js +4 -4
  641. package/src/post-featured-image/block.json +9 -0
  642. package/src/post-featured-image/edit.js +23 -1
  643. package/src/post-featured-image/index.php +3 -1
  644. package/src/post-template/index.php +8 -14
  645. package/src/post-terms/edit.js +3 -2
  646. package/src/post-terms/index.js +1 -1
  647. package/src/post-title/block.json +1 -0
  648. package/src/post-title/index.php +2 -1
  649. package/src/preformatted/test/__snapshots__/edit.native.js.snap +16 -2
  650. package/src/query/edit/inspector-controls/index.js +129 -65
  651. package/src/query/edit/inspector-controls/taxonomy-controls.js +17 -10
  652. package/src/query/editor.scss +10 -1
  653. package/src/query/index.js +1 -1
  654. package/src/query-no-results/edit.js +2 -5
  655. package/src/query-no-results/index.php +10 -8
  656. package/src/query-pagination/style.scss +14 -0
  657. package/src/query-pagination-next/edit.js +1 -0
  658. package/src/query-pagination-previous/edit.js +1 -0
  659. package/src/query-title/block.json +4 -0
  660. package/src/query-title/edit.js +33 -6
  661. package/src/query-title/index.php +17 -1
  662. package/src/query-title/variations.js +13 -0
  663. package/src/quote/deprecated.js +213 -99
  664. package/src/quote/edit.js +77 -52
  665. package/src/quote/index.js +10 -33
  666. package/src/quote/save.js +5 -5
  667. package/src/quote/{v2/test → test}/migrate.js +2 -7
  668. package/src/quote/transforms.js +113 -147
  669. package/src/search/style.scss +2 -0
  670. package/src/search/test/__snapshots__/edit.native.js.snap +56 -7
  671. package/src/search/theme.scss +5 -0
  672. package/src/separator/edit.js +1 -1
  673. package/src/separator/test/edit.js +5 -3
  674. package/src/site-logo/edit.js +2 -11
  675. package/src/site-title/edit/level-toolbar.js +1 -0
  676. package/src/site-title/index.php +8 -9
  677. package/src/social-link/editor.scss +3 -0
  678. package/src/social-link/icons/index.js +1 -0
  679. package/src/social-link/icons/whatsapp.js +10 -0
  680. package/src/social-link/index.php +21 -1
  681. package/src/social-link/socials-with-bg.scss +5 -0
  682. package/src/social-link/socials-without-bg.scss +5 -0
  683. package/src/social-link/variations.js +7 -0
  684. package/src/social-links/edit.js +1 -0
  685. package/src/style.scss +1 -1
  686. package/src/tag-cloud/style.scss +1 -0
  687. package/src/template-part/edit/index.js +40 -27
  688. package/src/template-part/edit/selection-modal.js +68 -40
  689. package/src/template-part/edit/utils/search.js +76 -0
  690. package/src/template-part/editor.scss +21 -9
  691. package/src/template-part/index.js +1 -1
  692. package/src/template-part/index.php +56 -2
  693. package/src/template-part/variations.js +0 -11
  694. package/src/utils/clean-empty-object.js +8 -2
  695. package/src/video/tracks-editor.js +1 -1
  696. package/build/comments/edit.js.map +0 -1
  697. package/build/gallery/use-short-code-transform.js +0 -64
  698. package/build/gallery/use-short-code-transform.js.map +0 -1
  699. package/build/list-item/hooks/use-backspace.js +0 -59
  700. package/build/list-item/hooks/use-backspace.js.map +0 -1
  701. package/build/navigation-link/fallback-variations.js +0 -75
  702. package/build/navigation-link/fallback-variations.js.map +0 -1
  703. package/build/post-comments/edit.js +0 -184
  704. package/build/post-comments/edit.js.map +0 -1
  705. package/build/post-comments/index.js +0 -72
  706. package/build/post-comments/index.js.map +0 -1
  707. package/build/quote/v2/deprecated.js +0 -133
  708. package/build/quote/v2/deprecated.js.map +0 -1
  709. package/build/quote/v2/edit.js +0 -139
  710. package/build/quote/v2/edit.js.map +0 -1
  711. package/build/quote/v2/index.js +0 -49
  712. package/build/quote/v2/index.js.map +0 -1
  713. package/build/quote/v2/save.js +0 -43
  714. package/build/quote/v2/save.js.map +0 -1
  715. package/build/quote/v2/transforms.js +0 -156
  716. package/build/quote/v2/transforms.js.map +0 -1
  717. package/build/template-part/fallback-variations.js +0 -59
  718. package/build/template-part/fallback-variations.js.map +0 -1
  719. package/build-module/comments/edit.js +0 -59
  720. package/build-module/comments/edit.js.map +0 -1
  721. package/build-module/gallery/use-short-code-transform.js +0 -54
  722. package/build-module/gallery/use-short-code-transform.js.map +0 -1
  723. package/build-module/list-item/hooks/use-backspace.js +0 -44
  724. package/build-module/list-item/hooks/use-backspace.js.map +0 -1
  725. package/build-module/navigation-link/fallback-variations.js +0 -65
  726. package/build-module/navigation-link/fallback-variations.js.map +0 -1
  727. package/build-module/post-comments/edit.js +0 -171
  728. package/build-module/post-comments/edit.js.map +0 -1
  729. package/build-module/post-comments/index.js +0 -59
  730. package/build-module/post-comments/index.js.map +0 -1
  731. package/build-module/quote/v2/deprecated.js +0 -116
  732. package/build-module/quote/v2/deprecated.js.map +0 -1
  733. package/build-module/quote/v2/edit.js +0 -122
  734. package/build-module/quote/v2/edit.js.map +0 -1
  735. package/build-module/quote/v2/index.js +0 -33
  736. package/build-module/quote/v2/index.js.map +0 -1
  737. package/build-module/quote/v2/save.js +0 -30
  738. package/build-module/quote/v2/save.js.map +0 -1
  739. package/build-module/quote/v2/transforms.js +0 -147
  740. package/build-module/quote/v2/transforms.js.map +0 -1
  741. package/build-module/template-part/fallback-variations.js +0 -47
  742. package/build-module/template-part/fallback-variations.js.map +0 -1
  743. package/src/gallery/use-short-code-transform.js +0 -55
  744. package/src/list-item/hooks/use-backspace.js +0 -51
  745. package/src/navigation-link/fallback-variations.js +0 -65
  746. package/src/post-comments/block.json +0 -45
  747. package/src/post-comments/edit.js +0 -247
  748. package/src/post-comments/editor.scss +0 -3
  749. package/src/post-comments/index.js +0 -18
  750. package/src/post-comments/index.php +0 -87
  751. package/src/quote/v2/deprecated.js +0 -107
  752. package/src/quote/v2/edit.js +0 -139
  753. package/src/quote/v2/index.js +0 -36
  754. package/src/quote/v2/save.js +0 -26
  755. package/src/quote/v2/transforms.js +0 -155
  756. package/src/template-part/fallback-variations.js +0 -51
@@ -0,0 +1,174 @@
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 = useMerge;
9
+
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _blockEditor = require("@wordpress/block-editor");
13
+
14
+ var _blocks = require("@wordpress/blocks");
15
+
16
+ var _useOutdentListItem = _interopRequireDefault(require("./use-outdent-list-item"));
17
+
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+ const {
26
+ name: listItemName
27
+ } = {
28
+ $schema: "https://schemas.wp.org/trunk/block.json",
29
+ apiVersion: 2,
30
+ __experimental: "list-v2",
31
+ name: "core/list-item",
32
+ title: "List item",
33
+ category: "text",
34
+ parent: ["core/list"],
35
+ description: "Create a list item.",
36
+ textdomain: "default",
37
+ attributes: {
38
+ placeholder: {
39
+ type: "string"
40
+ },
41
+ content: {
42
+ type: "string",
43
+ source: "html",
44
+ selector: "li",
45
+ "default": "",
46
+ __experimentalRole: "content"
47
+ }
48
+ },
49
+ supports: {
50
+ className: false,
51
+ __experimentalSelector: "li"
52
+ }
53
+ };
54
+
55
+ function useMerge(clientId) {
56
+ const registry = (0, _data.useRegistry)();
57
+ const {
58
+ getPreviousBlockClientId,
59
+ getNextBlockClientId,
60
+ getBlockOrder,
61
+ getBlockRootClientId,
62
+ getBlockName,
63
+ getBlock
64
+ } = (0, _data.useSelect)(_blockEditor.store);
65
+ const {
66
+ mergeBlocks,
67
+ moveBlocksToPosition,
68
+ replaceBlock,
69
+ selectBlock
70
+ } = (0, _data.useDispatch)(_blockEditor.store);
71
+ const [, outdentListItem] = (0, _useOutdentListItem.default)(clientId);
72
+
73
+ function getTrailingId(id) {
74
+ const order = getBlockOrder(id);
75
+
76
+ if (!order.length) {
77
+ return id;
78
+ }
79
+
80
+ return getTrailingId(order[order.length - 1]);
81
+ }
82
+
83
+ function getParentListItemId(id) {
84
+ const listId = getBlockRootClientId(id);
85
+ const parentListItemId = getBlockRootClientId(listId);
86
+ if (!parentListItemId) return;
87
+ if (getBlockName(parentListItemId) !== listItemName) return;
88
+ return parentListItemId;
89
+ }
90
+ /**
91
+ * Return the next list item with respect to the given list item. If none,
92
+ * return the next list item of the parent list item if it exists.
93
+ *
94
+ * @param {string} id A list item client ID.
95
+ * @return {string?} The client ID of the next list item.
96
+ */
97
+
98
+
99
+ function _getNextId(id) {
100
+ const next = getNextBlockClientId(id);
101
+ if (next) return next;
102
+ const parentListItemId = getParentListItemId(id);
103
+ if (!parentListItemId) return;
104
+ return _getNextId(parentListItemId);
105
+ }
106
+ /**
107
+ * Given a client ID, return the client ID of the list item on the next
108
+ * line, regardless of indentation level.
109
+ *
110
+ * @param {string} id The client ID of the current list item.
111
+ * @return {string?} The client ID of the next list item.
112
+ */
113
+
114
+
115
+ function getNextId(id) {
116
+ const order = getBlockOrder(id); // If the list item does not have a nested list, return the next list
117
+ // item.
118
+
119
+ if (!order.length) {
120
+ return _getNextId(id);
121
+ } // Get the first list item in the nested list.
122
+
123
+
124
+ return getBlockOrder(order[0])[0];
125
+ }
126
+
127
+ function switchToDefaultBlockType(forward) {
128
+ const rootClientId = getBlockRootClientId(clientId);
129
+ const replacement = (0, _blocks.switchToBlockType)(getBlock(rootClientId), (0, _blocks.getDefaultBlockName)());
130
+ const indexToSelect = forward ? replacement.length - 1 : 0;
131
+ const initialPosition = forward ? -1 : 0;
132
+ registry.batch(() => {
133
+ replaceBlock(rootClientId, replacement);
134
+ selectBlock(replacement[indexToSelect].clientId, initialPosition);
135
+ });
136
+ }
137
+
138
+ return forward => {
139
+ if (forward) {
140
+ const nextBlockClientId = getNextId(clientId);
141
+
142
+ if (!nextBlockClientId) {
143
+ switchToDefaultBlockType(forward);
144
+ return;
145
+ }
146
+
147
+ if (getParentListItemId(nextBlockClientId)) {
148
+ outdentListItem(nextBlockClientId);
149
+ } else {
150
+ registry.batch(() => {
151
+ moveBlocksToPosition(getBlockOrder(nextBlockClientId), nextBlockClientId, getPreviousBlockClientId(nextBlockClientId));
152
+ mergeBlocks(clientId, nextBlockClientId);
153
+ });
154
+ }
155
+ } else {
156
+ // Merging is only done from the top level. For lowel levels, the
157
+ // list item is outdented instead.
158
+ const previousBlockClientId = getPreviousBlockClientId(clientId);
159
+
160
+ if (getParentListItemId(clientId)) {
161
+ outdentListItem(clientId);
162
+ } else if (previousBlockClientId) {
163
+ const trailingId = getTrailingId(previousBlockClientId);
164
+ registry.batch(() => {
165
+ moveBlocksToPosition(getBlockOrder(clientId), clientId, previousBlockClientId);
166
+ mergeBlocks(trailingId, clientId);
167
+ });
168
+ } else {
169
+ switchToDefaultBlockType(forward);
170
+ }
171
+ }
172
+ };
173
+ }
174
+ //# sourceMappingURL=use-merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"names":["useMerge","clientId","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","getBlock","blockEditorStore","mergeBlocks","moveBlocksToPosition","replaceBlock","selectBlock","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","listItemName","_getNextId","next","getNextId","switchToDefaultBlockType","forward","rootClientId","replacement","indexToSelect","initialPosition","batch","nextBlockClientId","previousBlockClientId","trailingId"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKe,SAASA,QAAT,CAAmBC,QAAnB,EAA8B;AAC5C,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AACLC,IAAAA,wBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,aAHK;AAILC,IAAAA,oBAJK;AAKLC,IAAAA,YALK;AAMLC,IAAAA;AANK,MAOF,qBAAWC,kBAAX,CAPJ;AAQA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,oBAAf;AA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AEF,QAAF,CAAtD;;AACA,UAAKkB,mBAAmB,CAAElB,QAAF,CAAxB,EAAuC;AACtCa,QAAAA,eAAe,CAAEb,QAAF,CAAf;AACA,OAFD,MAEO,IAAKiC,qBAAL,EAA6B;AACnC,cAAMC,UAAU,GAAGpB,aAAa,CAAEmB,qBAAF,CAAhC;AACAhC,QAAAA,QAAQ,CAAC8B,KAAT,CAAgB,MAAM;AACrBrB,UAAAA,oBAAoB,CACnBN,aAAa,CAAEJ,QAAF,CADM,EAEnBA,QAFmB,EAGnBiC,qBAHmB,CAApB;AAKAxB,UAAAA,WAAW,CAAEyB,UAAF,EAAclC,QAAd,CAAX;AACA,SAPD;AAQA,OAVM,MAUA;AACNyB,QAAAA,wBAAwB,CAAEC,OAAF,CAAxB;AACA;AACD;AACD,GAzCD;AA0CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getDefaultBlockName, switchToBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nimport { name as listItemName } from '../block.json';\n\nexport default function useMerge( clientId ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition, replaceBlock, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ , outdentListItem ] = useOutdentListItem( clientId );\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== listItemName ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\tfunction switchToDefaultBlockType( forward ) {\n\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\tconst replacement = switchToBlockType(\n\t\t\tgetBlock( rootClientId ),\n\t\t\tgetDefaultBlockName()\n\t\t);\n\t\tconst indexToSelect = forward ? replacement.length - 1 : 0;\n\t\tconst initialPosition = forward ? -1 : 0;\n\t\tregistry.batch( () => {\n\t\t\treplaceBlock( rootClientId, replacement );\n\t\t\tselectBlock(\n\t\t\t\treplacement[ indexToSelect ].clientId,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn ( forward ) => {\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tswitchToDefaultBlockType( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nextBlockClientId ),\n\t\t\t\t\t\tnextBlockClientId,\n\t\t\t\t\t\tgetPreviousBlockClientId( nextBlockClientId )\n\t\t\t\t\t);\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( clientId ),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tpreviousBlockClientId\n\t\t\t\t\t);\n\t\t\t\t\tmergeBlocks( trailingId, clientId );\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tswitchToDefaultBlockType( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -15,8 +15,6 @@ var _blockEditor = require("@wordpress/block-editor");
15
15
 
16
16
  var _blocks = require("@wordpress/blocks");
17
17
 
18
- var _utils = require("../utils");
19
-
20
18
  /**
21
19
  * External dependencies
22
20
  */
@@ -28,7 +26,38 @@ var _utils = require("../utils");
28
26
  /**
29
27
  * Internal dependencies
30
28
  */
29
+ const {
30
+ name: listItemName
31
+ } = {
32
+ $schema: "https://schemas.wp.org/trunk/block.json",
33
+ apiVersion: 2,
34
+ __experimental: "list-v2",
35
+ name: "core/list-item",
36
+ title: "List item",
37
+ category: "text",
38
+ parent: ["core/list"],
39
+ description: "Create a list item.",
40
+ textdomain: "default",
41
+ attributes: {
42
+ placeholder: {
43
+ type: "string"
44
+ },
45
+ content: {
46
+ type: "string",
47
+ source: "html",
48
+ selector: "li",
49
+ "default": "",
50
+ __experimentalRole: "content"
51
+ }
52
+ },
53
+ supports: {
54
+ className: false,
55
+ __experimentalSelector: "li"
56
+ }
57
+ };
58
+
31
59
  function useOutdentListItem(clientId) {
60
+ const registry = (0, _data.useRegistry)();
32
61
  const {
33
62
  canOutdent
34
63
  } = (0, _data.useSelect)(innerSelect => {
@@ -41,58 +70,65 @@ function useOutdentListItem(clientId) {
41
70
  };
42
71
  }, [clientId]);
43
72
  const {
44
- replaceBlocks,
45
- selectionChange,
46
- multiSelect
73
+ moveBlocksToPosition,
74
+ removeBlock,
75
+ insertBlock,
76
+ updateBlockListSettings
47
77
  } = (0, _data.useDispatch)(_blockEditor.store);
48
78
  const {
49
79
  getBlockRootClientId,
50
- getBlockAttributes,
51
- getBlock,
80
+ getBlockName,
81
+ getBlockOrder,
52
82
  getBlockIndex,
53
- getSelectionStart,
54
- getSelectionEnd,
55
- hasMultiSelection,
56
- getMultiSelectedBlockClientIds
83
+ getSelectedBlockClientIds,
84
+ getBlock,
85
+ getBlockListSettings
57
86
  } = (0, _data.useSelect)(_blockEditor.store);
58
- return [canOutdent, (0, _element.useCallback)(() => {
59
- const _hasMultiSelection = hasMultiSelection();
60
-
61
- const clientIds = _hasMultiSelection ? getMultiSelectedBlockClientIds() : [clientId];
62
- const selectionStart = getSelectionStart();
63
- const selectionEnd = getSelectionEnd();
64
- const listParentId = getBlockRootClientId(clientId);
65
- const listAttributes = getBlockAttributes(listParentId);
66
- const listItemParentId = getBlockRootClientId(listParentId);
67
- const listItemParentAttributes = getBlockAttributes(listItemParentId);
68
- const firstIndex = getBlockIndex((0, _lodash.first)(clientIds));
69
- const lastIndex = getBlockIndex((0, _lodash.last)(clientIds));
70
- const siblingBlocks = getBlock(listParentId).innerBlocks;
71
- const previousSiblings = siblingBlocks.slice(0, firstIndex);
72
- const afterSiblings = siblingBlocks.slice(lastIndex + 1); // Create a new parent list item block with just the siblings
73
- // that existed before the first child item being outdent.
74
-
75
- const newListItemParent = (0, _utils.createListItem)(listItemParentAttributes, listAttributes, previousSiblings);
76
- const lastBlock = getBlock((0, _lodash.last)(clientIds));
77
- const childList = lastBlock.innerBlocks[0];
78
- const childItems = (childList === null || childList === void 0 ? void 0 : childList.innerBlocks) || [];
79
- const hasChildItems = !!childItems.length;
80
- const newBlocksExcludingLast = clientIds.slice(0, -1).map(_clientId => (0, _blocks.cloneBlock)(getBlock(_clientId))); // Create a new list item block whose attributes are equal to the
81
- // last block being outdent and whose children are the children that it had (if any)
82
- // followed by the siblings that existed after it.
83
-
84
- const newLastItem = (0, _utils.createListItem)(lastBlock.attributes, hasChildItems ? childList.attributes : listAttributes, [...childItems, ...afterSiblings]); // Replace the parent list item block, with a new block containing
85
- // the previous siblings before the first block being outdent,
86
- // followed by the blocks being outdent with the after siblings added
87
- // as children of the last block.
88
-
89
- replaceBlocks([listItemParentId], [newListItemParent, ...newBlocksExcludingLast, newLastItem]); // Restore the selection state.
90
-
91
- if (!_hasMultiSelection) {
92
- selectionChange(newLastItem.clientId, selectionEnd.attributeKey, selectionEnd.clientId === selectionStart.clientId ? selectionStart.offset : selectionEnd.offset, selectionEnd.offset);
93
- } else {
94
- multiSelect((0, _lodash.first)(newBlocksExcludingLast).clientId, newLastItem.clientId);
95
- }
96
- }, [clientId])];
87
+
88
+ function getParentListItemId(id) {
89
+ const listId = getBlockRootClientId(id);
90
+ const parentListItemId = getBlockRootClientId(listId);
91
+ if (!parentListItemId) return;
92
+ if (getBlockName(parentListItemId) !== listItemName) return;
93
+ return parentListItemId;
94
+ }
95
+
96
+ return [canOutdent, (0, _element.useCallback)(function () {
97
+ let clientIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSelectedBlockClientIds();
98
+ clientIds = (0, _lodash.castArray)(clientIds);
99
+ if (!clientIds.length) return;
100
+ const firstClientId = (0, _lodash.first)(clientIds); // Can't outdent if it's not a list item.
101
+
102
+ if (getBlockName(firstClientId) !== listItemName) return;
103
+ const parentListItemId = getParentListItemId(firstClientId); // Can't outdent if it's at the top level.
104
+
105
+ if (!parentListItemId) return;
106
+ const parentListId = getBlockRootClientId(firstClientId);
107
+ const lastClientId = (0, _lodash.last)(clientIds);
108
+ const order = getBlockOrder(parentListId);
109
+ const followingListItems = order.slice(getBlockIndex(lastClientId) + 1);
110
+ registry.batch(() => {
111
+ if (followingListItems.length) {
112
+ let nestedListId = (0, _lodash.first)(getBlockOrder(firstClientId));
113
+
114
+ if (!nestedListId) {
115
+ const nestedListBlock = (0, _blocks.cloneBlock)(getBlock(parentListId), {}, []);
116
+ nestedListId = nestedListBlock.clientId;
117
+ insertBlock(nestedListBlock, 0, firstClientId, false); // Immediately update the block list settings, otherwise
118
+ // blocks can't be moved here due to canInsert checks.
119
+
120
+ updateBlockListSettings(nestedListId, getBlockListSettings(parentListId));
121
+ }
122
+
123
+ moveBlocksToPosition(followingListItems, parentListId, nestedListId);
124
+ }
125
+
126
+ moveBlocksToPosition(clientIds, parentListId, getBlockRootClientId(parentListItemId), getBlockIndex(parentListItemId) + 1);
127
+
128
+ if (!getBlockOrder(parentListId).length) {
129
+ removeBlock(parentListId);
130
+ }
131
+ });
132
+ }, [])];
97
133
  }
98
134
  //# sourceMappingURL=use-outdent-list-item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-outdent-list-item.js"],"names":["useOutdentListItem","clientId","canOutdent","innerSelect","getBlockRootClientId","blockEditorStore","grandParentId","replaceBlocks","selectionChange","multiSelect","getBlockAttributes","getBlock","getBlockIndex","getSelectionStart","getSelectionEnd","hasMultiSelection","getMultiSelectedBlockClientIds","_hasMultiSelection","clientIds","selectionStart","selectionEnd","listParentId","listAttributes","listItemParentId","listItemParentAttributes","firstIndex","lastIndex","siblingBlocks","innerBlocks","previousSiblings","slice","afterSiblings","newListItemParent","lastBlock","childList","childItems","hasChildItems","length","newBlocksExcludingLast","map","_clientId","newLastItem","attributes","attributeKey","offset"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AACtD,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,WAAF,IAAmB;AAClB,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,WAAW,CAAEE,kBAAF,CAA5C;AACA,UAAMC,aAAa,GAAGF,oBAAoB,CACzCA,oBAAoB,CAAEH,QAAF,CADqB,CAA1C;AAGA,WAAO;AACNC,MAAAA,UAAU,EAAE,CAAC,CAAEI;AADT,KAAP;AAGA,GATqB,EAUtB,CAAEL,QAAF,CAVsB,CAAvB;AAYA,QAAM;AAAEM,IAAAA,aAAF;AAAiBC,IAAAA,eAAjB;AAAkCC,IAAAA;AAAlC,MACL,uBAAaJ,kBAAb,CADD;AAEA,QAAM;AACLD,IAAAA,oBADK;AAELM,IAAAA,kBAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA,iBALK;AAMLC,IAAAA,eANK;AAOLC,IAAAA,iBAPK;AAQLC,IAAAA;AARK,MASF,qBAAWX,kBAAX,CATJ;AAWA,SAAO,CACNH,UADM,EAEN,0BAAa,MAAM;AAClB,UAAMe,kBAAkB,GAAGF,iBAAiB,EAA5C;;AACA,UAAMG,SAAS,GAAGD,kBAAkB,GACjCD,8BAA8B,EADG,GAEjC,CAAEf,QAAF,CAFH;AAIA,UAAMkB,cAAc,GAAGN,iBAAiB,EAAxC;AACA,UAAMO,YAAY,GAAGN,eAAe,EAApC;AAEA,UAAMO,YAAY,GAAGjB,oBAAoB,CAAEH,QAAF,CAAzC;AACA,UAAMqB,cAAc,GAAGZ,kBAAkB,CAAEW,YAAF,CAAzC;AACA,UAAME,gBAAgB,GAAGnB,oBAAoB,CAAEiB,YA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,IAAAA,aAAa,CACZ,CAAEgB,gBAAF,CADY,EAEZ,CAAES,iBAAF,EAAqB,GAAGM,sBAAxB,EAAgDG,WAAhD,CAFY,CAAb,CAnDkB,CAwDlB;;AACA,QAAK,CAAExB,kBAAP,EAA4B;AAC3BT,MAAAA,eAAe,CACdiC,WAAW,CAACxC,QADE,EAEdmB,YAAY,CAACuB,YAFC,EAGdvB,YAAY,CAACnB,QAAb,KAA0BkB,cAAc,CAAClB,QAAzC,GACGkB,cAAc,CAACyB,MADlB,GAEGxB,YAAY,CAACwB,MALF,EAMdxB,YAAY,CAACwB,MANC,CAAf;AAQA,KATD,MASO;AACNnC,MAAAA,WAAW,CACV,mBAAO6B,sBAAP,EAAgCrC,QADtB,EAEVwC,WAAW,CAACxC,QAFF,CAAX;AAIA;AACD,GAxED,EAwEG,CAAEA,QAAF,CAxEH,CAFM,CAAP;AA4EA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { createListItem } from '../utils';\n\nexport default function useOutdentListItem( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId } = innerSelect( blockEditorStore );\n\t\t\tconst grandParentId = getBlockRootClientId(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcanOutdent: !! grandParentId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange, multiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockAttributes,\n\t\tgetBlock,\n\t\tgetBlockIndex,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\thasMultiSelection,\n\t\tgetMultiSelectedBlockClientIds,\n\t} = useSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst _hasMultiSelection = hasMultiSelection();\n\t\t\tconst clientIds = _hasMultiSelection\n\t\t\t\t? getMultiSelectedBlockClientIds()\n\t\t\t\t: [ clientId ];\n\n\t\t\tconst selectionStart = getSelectionStart();\n\t\t\tconst selectionEnd = getSelectionEnd();\n\n\t\t\tconst listParentId = getBlockRootClientId( clientId );\n\t\t\tconst listAttributes = getBlockAttributes( listParentId );\n\t\t\tconst listItemParentId = getBlockRootClientId( listParentId );\n\t\t\tconst listItemParentAttributes =\n\t\t\t\tgetBlockAttributes( listItemParentId );\n\n\t\t\tconst firstIndex = getBlockIndex( first( clientIds ) );\n\t\t\tconst lastIndex = getBlockIndex( last( clientIds ) );\n\t\t\tconst siblingBlocks = getBlock( listParentId ).innerBlocks;\n\t\t\tconst previousSiblings = siblingBlocks.slice( 0, firstIndex );\n\t\t\tconst afterSiblings = siblingBlocks.slice( lastIndex + 1 );\n\n\t\t\t// Create a new parent list item block with just the siblings\n\t\t\t// that existed before the first child item being outdent.\n\t\t\tconst newListItemParent = createListItem(\n\t\t\t\tlistItemParentAttributes,\n\t\t\t\tlistAttributes,\n\t\t\t\tpreviousSiblings\n\t\t\t);\n\n\t\t\tconst lastBlock = getBlock( last( clientIds ) );\n\t\t\tconst childList = lastBlock.innerBlocks[ 0 ];\n\t\t\tconst childItems = childList?.innerBlocks || [];\n\t\t\tconst hasChildItems = !! childItems.length;\n\n\t\t\tconst newBlocksExcludingLast = clientIds\n\t\t\t\t.slice( 0, -1 )\n\t\t\t\t.map( ( _clientId ) => cloneBlock( getBlock( _clientId ) ) );\n\n\t\t\t// Create a new list item block whose attributes are equal to the\n\t\t\t// last block being outdent and whose children are the children that it had (if any)\n\t\t\t// followed by the siblings that existed after it.\n\t\t\tconst newLastItem = createListItem(\n\t\t\t\tlastBlock.attributes,\n\t\t\t\thasChildItems ? childList.attributes : listAttributes,\n\t\t\t\t[ ...childItems, ...afterSiblings ]\n\t\t\t);\n\n\t\t\t// Replace the parent list item block, with a new block containing\n\t\t\t// the previous siblings before the first block being outdent,\n\t\t\t// followed by the blocks being outdent with the after siblings added\n\t\t\t// as children of the last block.\n\t\t\treplaceBlocks(\n\t\t\t\t[ listItemParentId ],\n\t\t\t\t[ newListItemParent, ...newBlocksExcludingLast, newLastItem ]\n\t\t\t);\n\n\t\t\t// Restore the selection state.\n\t\t\tif ( ! _hasMultiSelection ) {\n\t\t\t\tselectionChange(\n\t\t\t\t\tnewLastItem.clientId,\n\t\t\t\t\tselectionEnd.attributeKey,\n\t\t\t\t\tselectionEnd.clientId === selectionStart.clientId\n\t\t\t\t\t\t? selectionStart.offset\n\t\t\t\t\t\t: selectionEnd.offset,\n\t\t\t\t\tselectionEnd.offset\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmultiSelect(\n\t\t\t\t\tfirst( newBlocksExcludingLast ).clientId,\n\t\t\t\t\tnewLastItem.clientId\n\t\t\t\t);\n\t\t\t}\n\t\t}, [ clientId ] ),\n\t];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-outdent-list-item.js"],"names":["useOutdentListItem","clientId","registry","canOutdent","innerSelect","getBlockRootClientId","blockEditorStore","grandParentId","moveBlocksToPosition","removeBlock","insertBlock","updateBlockListSettings","getBlockName","getBlockOrder","getBlockIndex","getSelectedBlockClientIds","getBlock","getBlockListSettings","getParentListItemId","id","listId","parentListItemId","listItemName","clientIds","length","firstClientId","parentListId","lastClientId","order","followingListItems","slice","batch","nestedListId","nestedListBlock"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AACtD,QAAMC,QAAQ,GA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oCA,GA1DD,EA0DG,EA1DH,CAFM,CAAP;AA8DA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name as listItemName } from '../block.json';\n\nexport default function useOutdentListItem( clientId ) {\n\tconst registry = useRegistry();\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId } = innerSelect( blockEditorStore );\n\t\t\tconst grandParentId = getBlockRootClientId(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcanOutdent: !! grandParentId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t\tinsertBlock,\n\t\tupdateBlockListSettings,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tgetBlockOrder,\n\t\tgetBlockIndex,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlock,\n\t\tgetBlockListSettings,\n\t} = useSelect( blockEditorStore );\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== listItemName ) return;\n\t\treturn parentListItemId;\n\t}\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( ( clientIds = getSelectedBlockClientIds() ) => {\n\t\t\tclientIds = castArray( clientIds );\n\n\t\t\tif ( ! clientIds.length ) return;\n\n\t\t\tconst firstClientId = first( clientIds );\n\n\t\t\t// Can't outdent if it's not a list item.\n\t\t\tif ( getBlockName( firstClientId ) !== listItemName ) return;\n\n\t\t\tconst parentListItemId = getParentListItemId( firstClientId );\n\n\t\t\t// Can't outdent if it's at the top level.\n\t\t\tif ( ! parentListItemId ) return;\n\n\t\t\tconst parentListId = getBlockRootClientId( firstClientId );\n\t\t\tconst lastClientId = last( clientIds );\n\t\t\tconst order = getBlockOrder( parentListId );\n\t\t\tconst followingListItems = order.slice(\n\t\t\t\tgetBlockIndex( lastClientId ) + 1\n\t\t\t);\n\n\t\t\tregistry.batch( () => {\n\t\t\t\tif ( followingListItems.length ) {\n\t\t\t\t\tlet nestedListId = first( getBlockOrder( firstClientId ) );\n\n\t\t\t\t\tif ( ! nestedListId ) {\n\t\t\t\t\t\tconst nestedListBlock = cloneBlock(\n\t\t\t\t\t\t\tgetBlock( parentListId ),\n\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\tnestedListId = nestedListBlock.clientId;\n\t\t\t\t\t\tinsertBlock( nestedListBlock, 0, firstClientId, false );\n\t\t\t\t\t\t// Immediately update the block list settings, otherwise\n\t\t\t\t\t\t// blocks can't be moved here due to canInsert checks.\n\t\t\t\t\t\tupdateBlockListSettings(\n\t\t\t\t\t\t\tnestedListId,\n\t\t\t\t\t\t\tgetBlockListSettings( parentListId )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tfollowingListItems,\n\t\t\t\t\t\tparentListId,\n\t\t\t\t\t\tnestedListId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tclientIds,\n\t\t\t\t\tparentListId,\n\t\t\t\t\tgetBlockRootClientId( parentListItemId ),\n\t\t\t\t\tgetBlockIndex( parentListItemId ) + 1\n\t\t\t\t);\n\t\t\t\tif ( ! getBlockOrder( parentListId ).length ) {\n\t\t\t\t\tremoveBlock( parentListId );\n\t\t\t\t}\n\t\t\t} );\n\t\t}, [] ),\n\t];\n}\n"]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.square = exports.circleOutline = exports.circle = void 0;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ const circle = (size, color) => (0, _element.createElement)(_components.SVG, {
16
+ fill: "none",
17
+ xmlns: "http://www.w3.org/2000/svg"
18
+ }, (0, _element.createElement)(_components.Rect, {
19
+ width: size,
20
+ height: size,
21
+ rx: size / 2,
22
+ fill: color
23
+ }));
24
+
25
+ exports.circle = circle;
26
+
27
+ const circleOutline = (size, color) => (0, _element.createElement)(_components.SVG, {
28
+ width: size,
29
+ height: size,
30
+ fill: "none",
31
+ xmlns: "http://www.w3.org/2000/svg"
32
+ }, (0, _element.createElement)(_components.Rect, {
33
+ x: "0.5",
34
+ y: "0.5",
35
+ width: size - 1,
36
+ height: size - 1,
37
+ rx: size / 2,
38
+ stroke: color
39
+ }));
40
+
41
+ exports.circleOutline = circleOutline;
42
+
43
+ const square = (size, color) => (0, _element.createElement)(_components.SVG, {
44
+ fill: "none",
45
+ xmlns: "http://www.w3.org/2000/svg"
46
+ }, (0, _element.createElement)(_components.Rect, {
47
+ width: size,
48
+ height: size,
49
+ fill: color
50
+ }));
51
+
52
+ exports.square = square;
53
+ //# sourceMappingURL=icons.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/list-item/icons.native.js"],"names":["circle","size","color","circleOutline","square"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,MAAM,GAAG,CAAEC,IAAF,EAAQC,KAAR,KACrB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC;AAAvB,GACC,4BAAC,gBAAD;AAAM,EAAA,KAAK,EAAGD,IAAd;AAAqB,EAAA,MAAM,EAAGA,IAA9B;AAAqC,EAAA,EAAE,EAAGA,IAAI,GAAG,CAAjD;AAAqD,EAAA,IAAI,EAAGC;AAA5D,EADD,CADM;;;;AAMA,MAAMC,aAAa,GAAG,CAAEF,IAAF,EAAQC,KAAR,KAC5B,4BAAC,eAAD;AACC,EAAA,KAAK,EAAGD,IADT;AAEC,EAAA,MAAM,EAAGA,IAFV;AAGC,EAAA,IAAI,EAAC,MAHN;AAIC,EAAA,KAAK,EAAC;AAJP,GAMC,4BAAC,gBAAD;AACC,EAAA,CAAC,EAAC,KADH;AAEC,EAAA,CAAC,EAAC,KAFH;AAGC,EAAA,KAAK,EAAGA,IAAI,GAAG,CAHhB;AAIC,EAAA,MAAM,EAAGA,IAAI,GAAG,CAJjB;AAKC,EAAA,EAAE,EAAGA,IAAI,GAAG,CALb;AAMC,EAAA,MAAM,EAAGC;AANV,EAND,CADM;;;;AAkBA,MAAME,MAAM,GAAG,CAAEH,IAAF,EAAQC,KAAR,KACrB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC;AAAvB,GACC,4BAAC,gBAAD;AAAM,EAAA,KAAK,EAAGD,IAAd;AAAqB,EAAA,MAAM,EAAGA,IAA9B;AAAqC,EAAA,IAAI,EAAGC;AAA5C,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/components';\n\nexport const circle = ( size, color ) => (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Rect width={ size } height={ size } rx={ size / 2 } fill={ color } />\n\t</SVG>\n);\n\nexport const circleOutline = ( size, color ) => (\n\t<SVG\n\t\twidth={ size }\n\t\theight={ size }\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<Rect\n\t\t\tx=\"0.5\"\n\t\t\ty=\"0.5\"\n\t\t\twidth={ size - 1 }\n\t\t\theight={ size - 1 }\n\t\t\trx={ size / 2 }\n\t\t\tstroke={ color }\n\t\t/>\n\t</SVG>\n);\n\nexport const square = ( size, color ) => (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Rect width={ size } height={ size } fill={ color } />\n\t</SVG>\n);\n"]}
@@ -0,0 +1,136 @@
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 = ListStyleType;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _reactNative = require("react-native");
13
+
14
+ var _components = require("@wordpress/components");
15
+
16
+ var _style = _interopRequireDefault(require("./style.scss"));
17
+
18
+ var _icons = require("./icons");
19
+
20
+ /**
21
+ * External dependencies
22
+ */
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ const DEFAULT_ICON_SIZE = 6;
32
+
33
+ function getListNumberIndex(start, blockIndex, reversed, numberOfListItems) {
34
+ if (start) {
35
+ return reversed ? numberOfListItems - 1 + start - blockIndex : start + blockIndex;
36
+ }
37
+
38
+ if (reversed) {
39
+ return numberOfListItems - blockIndex;
40
+ }
41
+
42
+ return blockIndex + 1;
43
+ }
44
+
45
+ function OrderedList(_ref) {
46
+ let {
47
+ blockIndex,
48
+ color,
49
+ fontSize,
50
+ numberOfListItems,
51
+ reversed,
52
+ start,
53
+ style
54
+ } = _ref;
55
+ const orderedStyles = [_style.default['wp-block-list-item__list-item-container--ordered'], _element.Platform.isIOS && _style.default['wp-block-list-item__list-item-ordered--default'], _element.Platform.isIOS && (style === null || style === void 0 ? void 0 : style.fontSize) && _style.default['wp-block-list-item__list-item-ordered--custom']];
56
+ const numberStyle = [{
57
+ fontSize,
58
+ color
59
+ }];
60
+ const currentIndex = getListNumberIndex(start, blockIndex, reversed, numberOfListItems);
61
+ return (0, _element.createElement)(_reactNative.View, {
62
+ style: orderedStyles
63
+ }, (0, _element.createElement)(_reactNative.Text, {
64
+ style: numberStyle
65
+ }, currentIndex, "."));
66
+ }
67
+
68
+ function IconList(_ref2) {
69
+ let {
70
+ fontSize,
71
+ color,
72
+ defaultFontSize,
73
+ indentationLevel
74
+ } = _ref2;
75
+ const iconSize = parseInt(fontSize * DEFAULT_ICON_SIZE / defaultFontSize, 10);
76
+ let listIcon = (0, _icons.circle)(iconSize, color);
77
+
78
+ if (indentationLevel === 1) {
79
+ listIcon = (0, _icons.circleOutline)(iconSize, color);
80
+ } else if (indentationLevel > 1) {
81
+ listIcon = (0, _icons.square)(iconSize, color);
82
+ }
83
+
84
+ const listStyles = [_style.default['wp-block-list-item__list-item-container'], {
85
+ marginTop: fontSize / 2
86
+ }];
87
+ return (0, _element.createElement)(_reactNative.View, {
88
+ style: listStyles
89
+ }, (0, _element.createElement)(_components.Icon, {
90
+ icon: listIcon,
91
+ size: iconSize
92
+ }));
93
+ }
94
+
95
+ function ListStyleType(_ref3) {
96
+ var _style$baseColors, _style$baseColors$typ, _style$baseColors2, _style$baseColors2$co;
97
+
98
+ let {
99
+ blockIndex,
100
+ indentationLevel,
101
+ numberOfListItems,
102
+ ordered,
103
+ reversed,
104
+ start,
105
+ style
106
+ } = _ref3;
107
+ let defaultFontSize = _style.default['wp-block-list-item__list-item--default'].fontSize;
108
+
109
+ if (style !== null && style !== void 0 && (_style$baseColors = style.baseColors) !== null && _style$baseColors !== void 0 && (_style$baseColors$typ = _style$baseColors.typography) !== null && _style$baseColors$typ !== void 0 && _style$baseColors$typ.fontSize) {
110
+ defaultFontSize = parseInt(style.baseColors.typography.fontSize, 10);
111
+ }
112
+
113
+ const fontSize = parseInt(style !== null && style !== void 0 && style.fontSize ? style.fontSize : defaultFontSize, 10);
114
+ const defaultColor = style !== null && style !== void 0 && (_style$baseColors2 = style.baseColors) !== null && _style$baseColors2 !== void 0 && (_style$baseColors2$co = _style$baseColors2.color) !== null && _style$baseColors2$co !== void 0 && _style$baseColors2$co.text ? style.baseColors.color.text : _style.default['wp-block-list-item__list-item--default'].color;
115
+ const color = style !== null && style !== void 0 && style.color ? style.color : defaultColor;
116
+
117
+ if (ordered) {
118
+ return (0, _element.createElement)(OrderedList, {
119
+ blockIndex: blockIndex,
120
+ color: color,
121
+ fontSize: fontSize,
122
+ numberOfListItems: numberOfListItems,
123
+ reversed: reversed,
124
+ start: start,
125
+ style: style
126
+ });
127
+ }
128
+
129
+ return (0, _element.createElement)(IconList, {
130
+ color: color,
131
+ defaultFontSize: defaultFontSize,
132
+ fontSize: fontSize,
133
+ indentationLevel: indentationLevel
134
+ });
135
+ }
136
+ //# sourceMappingURL=list-style-type.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/list-item/list-style-type.native.js"],"names":["DEFAULT_ICON_SIZE","getListNumberIndex","start","blockIndex","reversed","numberOfListItems","OrderedList","color","fontSize","style","orderedStyles","styles","Platform","isIOS","numberStyle","currentIndex","IconList","defaultFontSize","indentationLevel","iconSize","parseInt","listIcon","listStyles","marginTop","ListStyleType","ordered","baseColors","typography","defaultColor","text"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAMA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,CAA1B;;AAEA,SAASC,kBAAT,CAA6BC,KAA7B,EAAoCC,UAApC,EAAgDC,QAAhD,EAA0DC,iBAA1D,EAA8E;AAC7E,MAAKH,KAAL,EAAa;AACZ,WAAOE,QAAQ,GACZC,iBAAiB,GAAG,CAApB,GAAwBH,KAAxB,GAAgCC,UADpB,GAEZD,KAAK,GAAGC,UAFX;AAGA;;AAED,MAAKC,QAAL,EAAgB;AACf,WAAOC,iBAAiB,GAAGF,UAA3B;AACA;;AAED,SAAOA,UAAU,GAAG,CAApB;AACA;;AAED,SAASG,WAAT,OAQI;AAAA,MARkB;AACrBH,IAAAA,UADqB;AAErBI,IAAAA,KAFqB;AAGrBC,IAAAA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AAKH,OAAL,EAAe;AACd,WACC,4BAAC,WAAD;AACC,MAAA,UAAU,EAAGtB,UADd;AAEC,MAAA,KAAK,EAAGI,KAFT;AAGC,MAAA,QAAQ,EAAGC,QAHZ;AAIC,MAAA,iBAAiB,EAAGH,iBAJrB;AAKC,MAAA,QAAQ,EAAGD,QALZ;AAMC,MAAA,KAAK,EAAGF,KANT;AAOC,MAAA,KAAK,EAAGO;AAPT,MADD;AAWA;;AAED,SACC,4BAAC,QAAD;AACC,IAAA,KAAK,EAAGF,KADT;AAEC,IAAA,eAAe,EAAGU,eAFnB;AAGC,IAAA,QAAQ,EAAGT,QAHZ;AAIC,IAAA,gBAAgB,EAAGU;AAJpB,IADD;AAQA","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { circle, circleOutline, square } from './icons';\n\nconst DEFAULT_ICON_SIZE = 6;\n\nfunction getListNumberIndex( start, blockIndex, reversed, numberOfListItems ) {\n\tif ( start ) {\n\t\treturn reversed\n\t\t\t? numberOfListItems - 1 + start - blockIndex\n\t\t\t: start + blockIndex;\n\t}\n\n\tif ( reversed ) {\n\t\treturn numberOfListItems - blockIndex;\n\t}\n\n\treturn blockIndex + 1;\n}\n\nfunction OrderedList( {\n\tblockIndex,\n\tcolor,\n\tfontSize,\n\tnumberOfListItems,\n\treversed,\n\tstart,\n\tstyle,\n} ) {\n\tconst orderedStyles = [\n\t\tstyles[ 'wp-block-list-item__list-item-container--ordered' ],\n\t\tPlatform.isIOS &&\n\t\t\tstyles[ 'wp-block-list-item__list-item-ordered--default' ],\n\t\tPlatform.isIOS &&\n\t\t\tstyle?.fontSize &&\n\t\t\tstyles[ 'wp-block-list-item__list-item-ordered--custom' ],\n\t];\n\tconst numberStyle = [ { fontSize, color } ];\n\n\tconst currentIndex = getListNumberIndex(\n\t\tstart,\n\t\tblockIndex,\n\t\treversed,\n\t\tnumberOfListItems\n\t);\n\n\treturn (\n\t\t<View style={ orderedStyles }>\n\t\t\t<Text style={ numberStyle }>{ currentIndex }.</Text>\n\t\t</View>\n\t);\n}\n\nfunction IconList( { fontSize, color, defaultFontSize, indentationLevel } ) {\n\tconst iconSize = parseInt(\n\t\t( fontSize * DEFAULT_ICON_SIZE ) / defaultFontSize,\n\t\t10\n\t);\n\n\tlet listIcon = circle( iconSize, color );\n\tif ( indentationLevel === 1 ) {\n\t\tlistIcon = circleOutline( iconSize, color );\n\t} else if ( indentationLevel > 1 ) {\n\t\tlistIcon = square( iconSize, color );\n\t}\n\n\tconst listStyles = [\n\t\tstyles[ 'wp-block-list-item__list-item-container' ],\n\t\t{ marginTop: fontSize / 2 },\n\t];\n\n\treturn (\n\t\t<View style={ listStyles }>\n\t\t\t<Icon icon={ listIcon } size={ iconSize } />\n\t\t</View>\n\t);\n}\n\nexport default function ListStyleType( {\n\tblockIndex,\n\tindentationLevel,\n\tnumberOfListItems,\n\tordered,\n\treversed,\n\tstart,\n\tstyle,\n} ) {\n\tlet defaultFontSize =\n\t\tstyles[ 'wp-block-list-item__list-item--default' ].fontSize;\n\n\tif ( style?.baseColors?.typography?.fontSize ) {\n\t\tdefaultFontSize = parseInt( style.baseColors.typography.fontSize, 10 );\n\t}\n\n\tconst fontSize = parseInt(\n\t\tstyle?.fontSize ? style.fontSize : defaultFontSize,\n\t\t10\n\t);\n\tconst defaultColor = style?.baseColors?.color?.text\n\t\t? style.baseColors.color.text\n\t\t: styles[ 'wp-block-list-item__list-item--default' ].color;\n\tconst color = style?.color ? style.color : defaultColor;\n\n\tif ( ordered ) {\n\t\treturn (\n\t\t\t<OrderedList\n\t\t\t\tblockIndex={ blockIndex }\n\t\t\t\tcolor={ color }\n\t\t\t\tfontSize={ fontSize }\n\t\t\t\tnumberOfListItems={ numberOfListItems }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\tstyle={ style }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<IconList\n\t\t\tcolor={ color }\n\t\t\tdefaultFontSize={ defaultFontSize }\n\t\t\tfontSize={ fontSize }\n\t\t\tindentationLevel={ indentationLevel }\n\t\t/>\n\t);\n}\n"]}