@wordpress/block-library 7.0.0 → 7.0.2

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 (230) hide show
  1. package/README.md +16 -0
  2. package/build/button/edit.native.js +2 -2
  3. package/build/button/edit.native.js.map +1 -1
  4. package/build/columns/index.js +12 -0
  5. package/build/columns/index.js.map +1 -1
  6. package/build/comment-author-avatar/edit.js +17 -4
  7. package/build/comment-author-avatar/edit.js.map +1 -1
  8. package/build/comment-template/edit.js +94 -36
  9. package/build/comment-template/edit.js.map +1 -1
  10. package/build/comment-template/hooks.js +175 -0
  11. package/build/comment-template/hooks.js.map +1 -0
  12. package/build/comment-template/index.js +1 -1
  13. package/build/comment-template/util.js.map +1 -1
  14. package/build/comments-pagination-next/index.js +1 -1
  15. package/build/comments-pagination-numbers/index.js +1 -1
  16. package/build/comments-query-loop/edit/comments-inspector-controls.js +20 -9
  17. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  18. package/build/comments-query-loop/edit.js +1 -19
  19. package/build/comments-query-loop/edit.js.map +1 -1
  20. package/build/comments-query-loop/index.js +5 -0
  21. package/build/comments-query-loop/index.js.map +1 -1
  22. package/build/cover/edit.js +21 -22
  23. package/build/cover/edit.js.map +1 -1
  24. package/build/cover/edit.native.js +7 -5
  25. package/build/cover/edit.native.js.map +1 -1
  26. package/build/cover/overlay-color-settings.native.js +4 -3
  27. package/build/cover/overlay-color-settings.native.js.map +1 -1
  28. package/build/cover/transforms.js +4 -2
  29. package/build/cover/transforms.js.map +1 -1
  30. package/build/group/index.js +1 -0
  31. package/build/group/index.js.map +1 -1
  32. package/build/heading/edit.js +14 -2
  33. package/build/heading/edit.js.map +1 -1
  34. package/build/image/deprecated.js +89 -5
  35. package/build/image/deprecated.js.map +1 -1
  36. package/build/image/save.js +0 -7
  37. package/build/image/save.js.map +1 -1
  38. package/build/latest-posts/edit.js +1 -0
  39. package/build/latest-posts/edit.js.map +1 -1
  40. package/build/navigation/edit/index.js +17 -15
  41. package/build/navigation/edit/index.js.map +1 -1
  42. package/build/navigation/edit/navigation-menu-selector.js +44 -27
  43. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  44. package/build/navigation/edit/placeholder/index.js +8 -22
  45. package/build/navigation/edit/placeholder/index.js.map +1 -1
  46. package/build/navigation/use-navigation-menu.js +6 -6
  47. package/build/navigation/use-navigation-menu.js.map +1 -1
  48. package/build/navigation-submenu/edit.js +41 -9
  49. package/build/navigation-submenu/edit.js.map +1 -1
  50. package/build/page-list/edit.js +11 -17
  51. package/build/page-list/edit.js.map +1 -1
  52. package/build/social-links/deprecated.js +1 -62
  53. package/build/social-links/deprecated.js.map +1 -1
  54. package/build/template-part/edit/index.js +36 -64
  55. package/build/template-part/edit/index.js.map +1 -1
  56. package/build/template-part/edit/placeholder.js +64 -0
  57. package/build/template-part/edit/placeholder.js.map +1 -0
  58. package/build/template-part/edit/selection-modal.js +103 -0
  59. package/build/template-part/edit/selection-modal.js.map +1 -0
  60. package/build/template-part/edit/title-modal.js +54 -0
  61. package/build/template-part/edit/title-modal.js.map +1 -0
  62. package/build/template-part/edit/utils/hooks.js +156 -0
  63. package/build/template-part/edit/utils/hooks.js.map +1 -0
  64. package/build/template-part/index.js +3 -1
  65. package/build/template-part/index.js.map +1 -1
  66. package/build-module/button/edit.native.js +4 -4
  67. package/build-module/button/edit.native.js.map +1 -1
  68. package/build-module/columns/index.js +12 -0
  69. package/build-module/columns/index.js.map +1 -1
  70. package/build-module/comment-author-avatar/edit.js +18 -6
  71. package/build-module/comment-author-avatar/edit.js.map +1 -1
  72. package/build-module/comment-template/edit.js +95 -37
  73. package/build-module/comment-template/edit.js.map +1 -1
  74. package/build-module/comment-template/hooks.js +156 -0
  75. package/build-module/comment-template/hooks.js.map +1 -0
  76. package/build-module/comment-template/index.js +1 -1
  77. package/build-module/comment-template/util.js.map +1 -1
  78. package/build-module/comments-pagination-next/index.js +1 -1
  79. package/build-module/comments-pagination-numbers/index.js +1 -1
  80. package/build-module/comments-query-loop/edit/comments-inspector-controls.js +20 -9
  81. package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  82. package/build-module/comments-query-loop/edit.js +2 -19
  83. package/build-module/comments-query-loop/edit.js.map +1 -1
  84. package/build-module/comments-query-loop/index.js +5 -0
  85. package/build-module/comments-query-loop/index.js.map +1 -1
  86. package/build-module/cover/edit.js +23 -24
  87. package/build-module/cover/edit.js.map +1 -1
  88. package/build-module/cover/edit.native.js +10 -8
  89. package/build-module/cover/edit.native.js.map +1 -1
  90. package/build-module/cover/overlay-color-settings.native.js +4 -4
  91. package/build-module/cover/overlay-color-settings.native.js.map +1 -1
  92. package/build-module/cover/transforms.js +4 -2
  93. package/build-module/cover/transforms.js.map +1 -1
  94. package/build-module/group/index.js +1 -0
  95. package/build-module/group/index.js.map +1 -1
  96. package/build-module/heading/edit.js +15 -3
  97. package/build-module/heading/edit.js.map +1 -1
  98. package/build-module/image/deprecated.js +90 -7
  99. package/build-module/image/deprecated.js.map +1 -1
  100. package/build-module/image/save.js +0 -7
  101. package/build-module/image/save.js.map +1 -1
  102. package/build-module/latest-posts/edit.js +1 -0
  103. package/build-module/latest-posts/edit.js.map +1 -1
  104. package/build-module/navigation/edit/index.js +17 -15
  105. package/build-module/navigation/edit/index.js.map +1 -1
  106. package/build-module/navigation/edit/navigation-menu-selector.js +45 -27
  107. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  108. package/build-module/navigation/edit/placeholder/index.js +8 -21
  109. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  110. package/build-module/navigation/use-navigation-menu.js +6 -6
  111. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  112. package/build-module/navigation-submenu/edit.js +41 -10
  113. package/build-module/navigation-submenu/edit.js.map +1 -1
  114. package/build-module/page-list/edit.js +12 -18
  115. package/build-module/page-list/edit.js.map +1 -1
  116. package/build-module/social-links/deprecated.js +1 -62
  117. package/build-module/social-links/deprecated.js.map +1 -1
  118. package/build-module/template-part/edit/index.js +37 -65
  119. package/build-module/template-part/edit/index.js.map +1 -1
  120. package/build-module/template-part/edit/placeholder.js +52 -0
  121. package/build-module/template-part/edit/placeholder.js.map +1 -0
  122. package/build-module/template-part/edit/selection-modal.js +89 -0
  123. package/build-module/template-part/edit/selection-modal.js.map +1 -0
  124. package/build-module/template-part/edit/title-modal.js +46 -0
  125. package/build-module/template-part/edit/title-modal.js.map +1 -0
  126. package/build-module/template-part/edit/utils/hooks.js +135 -0
  127. package/build-module/template-part/edit/utils/hooks.js.map +1 -0
  128. package/build-module/template-part/index.js +2 -1
  129. package/build-module/template-part/index.js.map +1 -1
  130. package/build-style/comment-author-avatar/editor-rtl.css +83 -0
  131. package/build-style/comment-author-avatar/editor.css +83 -0
  132. package/build-style/cover/style-rtl.css +4 -0
  133. package/build-style/cover/style.css +4 -0
  134. package/build-style/editor-rtl.css +27 -81
  135. package/build-style/editor.css +27 -81
  136. package/build-style/image/editor-rtl.css +0 -16
  137. package/build-style/image/editor.css +0 -16
  138. package/build-style/image/style-rtl.css +2 -0
  139. package/build-style/image/style.css +2 -0
  140. package/build-style/navigation/style-rtl.css +14 -3
  141. package/build-style/navigation/style.css +14 -3
  142. package/build-style/page-list/editor-rtl.css +0 -9
  143. package/build-style/page-list/editor.css +0 -9
  144. package/build-style/style-rtl.css +20 -3
  145. package/build-style/style.css +20 -3
  146. package/build-style/template-part/editor-rtl.css +19 -56
  147. package/build-style/template-part/editor.css +19 -56
  148. package/package.json +15 -15
  149. package/src/archives/index.php +1 -1
  150. package/src/button/edit.native.js +3 -3
  151. package/src/columns/block.json +12 -0
  152. package/src/comment-author-avatar/edit.js +13 -8
  153. package/src/comment-author-avatar/editor.scss +7 -0
  154. package/src/comment-template/block.json +7 -1
  155. package/src/comment-template/edit.js +102 -40
  156. package/src/comment-template/hooks.js +151 -0
  157. package/src/comment-template/index.php +8 -0
  158. package/src/comment-template/util.js +1 -0
  159. package/src/comments-pagination-next/block.json +8 -1
  160. package/src/comments-pagination-next/index.php +6 -8
  161. package/src/comments-pagination-numbers/block.json +7 -1
  162. package/src/comments-pagination-numbers/index.php +3 -10
  163. package/src/comments-query-loop/block.json +5 -0
  164. package/src/comments-query-loop/edit/comments-inspector-controls.js +22 -4
  165. package/src/comments-query-loop/edit.js +1 -16
  166. package/src/cover/edit.js +15 -28
  167. package/src/cover/edit.native.js +15 -7
  168. package/src/cover/overlay-color-settings.native.js +3 -4
  169. package/src/cover/style.scss +4 -0
  170. package/src/cover/transforms.js +2 -0
  171. package/src/editor.scss +1 -0
  172. package/src/gallery/index.php +1 -8
  173. package/src/group/block.json +1 -0
  174. package/src/heading/edit.js +18 -5
  175. package/src/home-link/index.php +1 -19
  176. package/src/image/deprecated.js +105 -1
  177. package/src/image/editor.scss +0 -18
  178. package/src/image/save.js +0 -8
  179. package/src/image/style.scss +3 -0
  180. package/src/image/test/edit.native.js +0 -10
  181. package/src/latest-posts/edit.js +1 -0
  182. package/src/latest-posts/index.php +1 -1
  183. package/src/navigation/edit/index.js +25 -26
  184. package/src/navigation/edit/navigation-menu-selector.js +73 -28
  185. package/src/navigation/edit/placeholder/index.js +8 -32
  186. package/src/navigation/index.php +4 -4
  187. package/src/navigation/style.scss +22 -3
  188. package/src/navigation/use-navigation-menu.js +6 -6
  189. package/src/navigation-link/index.php +3 -22
  190. package/src/navigation-submenu/edit.js +50 -12
  191. package/src/navigation-submenu/index.php +3 -21
  192. package/src/page-list/edit.js +21 -25
  193. package/src/page-list/editor.scss +0 -10
  194. package/src/page-list/index.php +4 -4
  195. package/src/post-navigation-link/index.php +3 -3
  196. package/src/search/index.php +6 -3
  197. package/src/site-logo/index.php +1 -1
  198. package/src/social-links/deprecated.js +0 -59
  199. package/src/template-part/edit/index.js +61 -71
  200. package/src/template-part/edit/placeholder.js +78 -0
  201. package/src/template-part/edit/selection-modal.js +115 -0
  202. package/src/template-part/edit/title-modal.js +59 -0
  203. package/src/template-part/edit/utils/hooks.js +158 -0
  204. package/src/template-part/editor.scss +16 -74
  205. package/src/template-part/index.js +4 -1
  206. package/build/navigation/edit/existing-menus-options.js +0 -62
  207. package/build/navigation/edit/existing-menus-options.js.map +0 -1
  208. package/build/template-part/edit/placeholder/index.js +0 -141
  209. package/build/template-part/edit/placeholder/index.js.map +0 -1
  210. package/build/template-part/edit/placeholder/patterns-setup.js +0 -100
  211. package/build/template-part/edit/placeholder/patterns-setup.js.map +0 -1
  212. package/build/template-part/edit/selection/index.js +0 -45
  213. package/build/template-part/edit/selection/index.js.map +0 -1
  214. package/build/template-part/edit/selection/template-part-previews.js +0 -317
  215. package/build/template-part/edit/selection/template-part-previews.js.map +0 -1
  216. package/build-module/navigation/edit/existing-menus-options.js +0 -53
  217. package/build-module/navigation/edit/existing-menus-options.js.map +0 -1
  218. package/build-module/template-part/edit/placeholder/index.js +0 -124
  219. package/build-module/template-part/edit/placeholder/index.js.map +0 -1
  220. package/build-module/template-part/edit/placeholder/patterns-setup.js +0 -91
  221. package/build-module/template-part/edit/placeholder/patterns-setup.js.map +0 -1
  222. package/build-module/template-part/edit/selection/index.js +0 -35
  223. package/build-module/template-part/edit/selection/index.js.map +0 -1
  224. package/build-module/template-part/edit/selection/template-part-previews.js +0 -298
  225. package/build-module/template-part/edit/selection/template-part-previews.js.map +0 -1
  226. package/src/navigation/edit/existing-menus-options.js +0 -70
  227. package/src/template-part/edit/placeholder/index.js +0 -172
  228. package/src/template-part/edit/placeholder/patterns-setup.js +0 -124
  229. package/src/template-part/edit/selection/index.js +0 -37
  230. package/src/template-part/edit/selection/template-part-previews.js +0 -372
@@ -34,6 +34,8 @@ var _coreData = require("@wordpress/core-data");
34
34
 
35
35
  var _a11y = require("@wordpress/a11y");
36
36
 
37
+ var _blocks = require("@wordpress/blocks");
38
+
37
39
  var _icons2 = require("./icons");
38
40
 
39
41
  /**
@@ -376,7 +378,8 @@ function NavigationSubmenuEdit(_ref) {
376
378
  saveEntityRecord
377
379
  } = (0, _data.useDispatch)(_coreData.store);
378
380
  const {
379
- __unstableMarkNextChangeAsNotPersistent
381
+ __unstableMarkNextChangeAsNotPersistent,
382
+ replaceBlock
380
383
  } = (0, _data.useDispatch)(_blockEditor.store);
381
384
  const [isLinkOpen, setIsLinkOpen] = (0, _element.useState)(false);
382
385
  const listItemRef = (0, _element.useRef)(null);
@@ -391,27 +394,42 @@ function NavigationSubmenuEdit(_ref) {
391
394
  hasDescendants,
392
395
  selectedBlockHasDescendants,
393
396
  userCanCreatePages,
394
- userCanCreatePosts
397
+ userCanCreatePosts,
398
+ onlyDescendantIsEmptyLink
395
399
  } = (0, _data.useSelect)(select => {
396
- var _getClientIdsOfDescen;
397
-
398
400
  const {
399
401
  getClientIdsOfDescendants,
400
402
  hasSelectedInnerBlock,
401
403
  getSelectedBlockClientId,
402
- getBlockParentsByBlockName
404
+ getBlockParentsByBlockName,
405
+ getBlock
403
406
  } = select(_blockEditor.store);
407
+
408
+ let _onlyDescendantIsEmptyLink;
409
+
404
410
  const selectedBlockId = getSelectedBlockClientId();
405
411
  const descendants = getClientIdsOfDescendants([clientId]).length;
412
+ const selectedBlockDescendants = getClientIdsOfDescendants([selectedBlockId]); // Check for a single descendant in the submenu. If that block
413
+ // is a link block in a "placeholder" state with no label then
414
+ // we can consider as an "empty" link.
415
+
416
+ if ((selectedBlockDescendants === null || selectedBlockDescendants === void 0 ? void 0 : selectedBlockDescendants.length) === 1) {
417
+ var _singleBlock$attribut;
418
+
419
+ const singleBlock = getBlock(selectedBlockDescendants[0]);
420
+ _onlyDescendantIsEmptyLink = (singleBlock === null || singleBlock === void 0 ? void 0 : singleBlock.name) === 'core/navigation-link' && !(singleBlock !== null && singleBlock !== void 0 && (_singleBlock$attribut = singleBlock.attributes) !== null && _singleBlock$attribut !== void 0 && _singleBlock$attribut.label);
421
+ }
422
+
406
423
  return {
407
424
  isAtMaxNesting: getBlockParentsByBlockName(clientId, name).length >= MAX_NESTING,
408
425
  isTopLevelItem: getBlockParentsByBlockName(clientId, name).length === 0,
409
426
  isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true),
410
427
  isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false),
411
428
  hasDescendants: !!descendants,
412
- selectedBlockHasDescendants: !!((_getClientIdsOfDescen = getClientIdsOfDescendants([selectedBlockId])) !== null && _getClientIdsOfDescen !== void 0 && _getClientIdsOfDescen.length),
429
+ selectedBlockHasDescendants: !!(selectedBlockDescendants !== null && selectedBlockDescendants !== void 0 && selectedBlockDescendants.length),
413
430
  userCanCreatePages: select(_coreData.store).canUser('create', 'pages'),
414
- userCanCreatePosts: select(_coreData.store).canUser('create', 'posts')
431
+ userCanCreatePosts: select(_coreData.store).canUser('create', 'posts'),
432
+ onlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink
415
433
  };
416
434
  }, [clientId]); // Show the LinkControl on mount if the URL is empty
417
435
  // ( When adding a new menu item)
@@ -564,12 +582,26 @@ function NavigationSubmenuEdit(_ref) {
564
582
  hasDescendants ? _blockEditor.InnerBlocks.ButtonBlockAppender : false
565
583
  });
566
584
  const ParentElement = openSubmenusOnClick ? 'button' : 'a';
585
+
586
+ function transformToLink() {
587
+ const newLinkBlock = (0, _blocks.createBlock)('core/navigation-link', attributes);
588
+ replaceBlock(clientId, newLinkBlock);
589
+ }
590
+
591
+ const canConvertToLink = !selectedBlockHasDescendants || onlyDescendantIsEmptyLink;
567
592
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, !openSubmenusOnClick && (0, _element.createElement)(_components.ToolbarButton, {
568
593
  name: "link",
569
594
  icon: _icons.link,
570
595
  title: (0, _i18n.__)('Link'),
571
596
  shortcut: _keycodes.displayShortcut.primary('k'),
572
597
  onClick: () => setIsLinkOpen(true)
598
+ }), (0, _element.createElement)(_components.ToolbarButton, {
599
+ name: "revert",
600
+ icon: _icons.removeSubmenu,
601
+ title: (0, _i18n.__)('Convert to Link'),
602
+ onClick: transformToLink,
603
+ className: "wp-block-navigation__submenu__revert",
604
+ isDisabled: !canConvertToLink
573
605
  }))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
574
606
  title: (0, _i18n.__)('Link settings')
575
607
  }, (0, _element.createElement)(_components.TextareaControl, {
@@ -655,8 +687,8 @@ function NavigationSubmenuEdit(_ref) {
655
687
  });
656
688
  (0, _a11y.speak)((0, _i18n.__)('Link removed.'), 'assertive');
657
689
  }
658
- })), (showSubmenuIcon || openSubmenusOnClick) && (0, _element.createElement)("span", {
690
+ }))), (showSubmenuIcon || openSubmenusOnClick) && (0, _element.createElement)("span", {
659
691
  className: "wp-block-navigation__submenu-icon"
660
- }, (0, _element.createElement)(_icons2.ItemSubmenuIcon, null))), (0, _element.createElement)("div", innerBlocksProps)));
692
+ }, (0, _element.createElement)(_icons2.ItemSubmenuIcon, null)), (0, _element.createElement)("div", innerBlocksProps)));
661
693
  }
662
694
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","link","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","coreStore","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","selectedBlockId","descendants","length","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","isKeyboardEvent","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","linkIcon","displayShortcut","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAgCA;;AA7BA;;AACA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AAWA;;AAQA;;AACA;;AACA;;AACA;;AAKA;;AA/CA;AACA;AACA;;AAIA;AACA;AACA;;AAoCA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,cAAc,GAAG,CAAE,sBAAF,EAA0B,yBAA1B,CAAvB;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,IAAI,EAAE;AADe,CAAtB;AAIA,MAAMC,WAAW,GAAG,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,mBAAmB,GAAKC,UAAF,IAAkB;AAC7C,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AAEA,0BAAW,MAAM;AAChB,UAAM;AAAEC,MAAAA;AAAF,QAAoBH,UAAU,CAACI,OAArC;;AAEA,aAASC,eAAT,CAA0BC,KAA1B,EAAkC;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,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CAhFF,CAFD,EAuFC,mCAAUmD,gBAAV,CAvFD,CA9CD,CADD;AA0IA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! getClientIdsOfDescendants( [\n\t\t\t\t\tselectedBlockId,\n\t\t\t\t] )?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","MAX_NESTING","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getSuggestionsQuery","type","kind","subtype","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","updateNavigationLinkBlockAttributes","updatedValue","setAttributes","blockAttributes","label","originalLabel","originalKind","originalType","title","url","opensInNewTab","id","newKind","newType","normalizedTitle","replace","normalizedURL","escapeTitle","isBuiltInType","indexOf","isCustomLink","encodeURI","undefined","Number","isInteger","NavigationSubmenuEdit","attributes","isSelected","mergeBlocks","onReplace","clientId","description","rel","link","showSubmenuIcon","openSubmenusOnClick","saveEntityRecord","coreStore","__unstableMarkNextChangeAsNotPersistent","replaceBlock","blockEditorStore","isLinkOpen","setIsLinkOpen","listItemRef","itemLabelPlaceholder","ref","isAtMaxNesting","isTopLevelItem","isParentOfSelectedBlock","isImmediateParentOfSelectedBlock","hasDescendants","selectedBlockHasDescendants","userCanCreatePages","userCanCreatePosts","onlyDescendantIsEmptyLink","select","getClientIdsOfDescendants","hasSelectedInnerBlock","getSelectedBlockClientId","getBlockParentsByBlockName","getBlock","_onlyDescendantIsEmptyLink","selectedBlockId","descendants","length","selectedBlockDescendants","singleBlock","canUser","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","userCanCreate","handleCreate","pageTitle","postType","page","status","rendered","onKeyDown","isKeyboardEvent","primary","blockProps","className","innerBlocksColors","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","__experimentalCaptureToolbars","renderAppender","InnerBlocks","ButtonBlockAppender","ParentElement","transformToLink","newLinkBlock","canConvertToLink","linkIcon","displayShortcut","removeSubmenu","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAgCA;;AA7BA;;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,CAAEpI,IAxBpB;AAyBC,IAAA,eAAe,EAAG,CAAC,CAAEA,IAzBtB;AA0BC,IAAA,gBAAgB,EAAGD,mBAAmB,CACrCC,IADqC,EAErCC,IAFqC,CA1BvC;AA8BC,IAAA,QAAQ,EAAKmB,YAAF,IACVD,mCAAmC,CAClCC,YADkC,EAElCC,aAFkC,EAGlCwB,UAHkC,CA/BrC;AAqCC,IAAA,QAAQ,EAAG,MAAM;AAChBxB,MAAAA,aAAa,CAAE;AAAEO,QAAAA,GAAG,EAAE;AAAP,OAAF,CAAb;AACA,uBAAO,cAAI,eAAJ,CAAP,EAA8B,WAA9B;AACA;AAxCF,IALD,CA9BF,CAFD,EAkFG,CAAEyB,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CAnFF,EAuFC,mCAAUyD,gBAAV,CAvFD,CAvDD,CADD;AAmJA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { escape, pull } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tPopover,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalLinkControl as LinkControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';\nimport {\n\tFragment,\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport { placeCaretAtHorizontalEdge } from '@wordpress/dom';\nimport { link as linkIcon, removeSubmenu } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { ItemSubmenuIcon } from './icons';\nimport { name } from './block.json';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation-link', 'core/navigation-submenu' ];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\nconst MAX_NESTING = 5;\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Given the Link block's type attribute, return the query params to give to\n * /wp/v2/search.\n *\n * @param {string} type Link block's type attribute.\n * @param {string} kind Link block's entity of kind (post-type|taxonomy)\n * @return {{ type?: string, subtype?: string }} Search query params.\n */\nfunction getSuggestionsQuery( type, kind ) {\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\tcase 'page':\n\t\t\treturn { type: 'post', subtype: type };\n\t\tcase 'category':\n\t\t\treturn { type: 'term', subtype: 'category' };\n\t\tcase 'tag':\n\t\t\treturn { type: 'term', subtype: 'post_tag' };\n\t\tcase 'post_format':\n\t\t\treturn { type: 'post-format' };\n\t\tdefault:\n\t\t\tif ( kind === 'taxonomy' ) {\n\t\t\t\treturn { type: 'term', subtype: type };\n\t\t\t}\n\t\t\tif ( kind === 'post-type' ) {\n\t\t\t\treturn { type: 'post', subtype: type };\n\t\t\t}\n\t\t\treturn {};\n\t}\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\n/**\n * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind\n */\n\n/**\n * Navigation Link Block Attributes\n *\n * @typedef {Object} WPNavigationLinkBlockAttributes\n *\n * @property {string} [label] Link text.\n * @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.\n * @property {string} [type] The type such as post, page, tag, category and other custom types.\n * @property {string} [rel] The relationship of the linked URL.\n * @property {number} [id] A post or term id.\n * @property {boolean} [opensInNewTab] Sets link target to _blank when true.\n * @property {string} [url] Link href.\n * @property {string} [title] Link title attribute.\n */\n\n/**\n * Link Control onChange handler that updates block attributes when a setting is changed.\n *\n * @param {Object} updatedValue New block attributes to update.\n * @param {Function} setAttributes Block attribute update function.\n * @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.\n *\n */\nexport const updateNavigationLinkBlockAttributes = (\n\tupdatedValue = {},\n\tsetAttributes,\n\tblockAttributes = {}\n) => {\n\tconst {\n\t\tlabel: originalLabel = '',\n\t\tkind: originalKind = '',\n\t\ttype: originalType = '',\n\t} = blockAttributes;\n\tconst {\n\t\ttitle = '',\n\t\turl = '',\n\t\topensInNewTab,\n\t\tid,\n\t\tkind: newKind = originalKind,\n\t\ttype: newType = originalType,\n\t} = updatedValue;\n\n\tconst normalizedTitle = title.replace( /http(s?):\\/\\//gi, '' );\n\tconst normalizedURL = url.replace( /http(s?):\\/\\//gi, '' );\n\tconst escapeTitle =\n\t\ttitle !== '' &&\n\t\tnormalizedTitle !== normalizedURL &&\n\t\toriginalLabel !== title;\n\tconst label = escapeTitle\n\t\t? escape( title )\n\t\t: originalLabel || escape( normalizedURL );\n\n\t// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use \"tag\" in favor of \"post_tag\"\n\tconst type = newType === 'post_tag' ? 'tag' : newType.replace( '-', '_' );\n\n\tconst isBuiltInType =\n\t\t[ 'post', 'page', 'tag', 'category' ].indexOf( type ) > -1;\n\n\tconst isCustomLink =\n\t\t( ! newKind && ! isBuiltInType ) || newKind === 'custom';\n\tconst kind = isCustomLink ? 'custom' : newKind;\n\n\tsetAttributes( {\n\t\t// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.\n\t\t...( url && { url: encodeURI( safeDecodeURI( url ) ) } ),\n\t\t...( label && { label } ),\n\t\t...( undefined !== opensInNewTab && { opensInNewTab } ),\n\t\t...( id && Number.isInteger( id ) && { id } ),\n\t\t...( kind && { kind } ),\n\t\t...( type && type !== 'URL' && { type } ),\n\t} );\n};\n\nexport default function NavigationSubmenuEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\ttype,\n\t\topensInNewTab,\n\t\turl,\n\t\tdescription,\n\t\trel,\n\t\ttitle,\n\t\tkind,\n\t} = attributes;\n\tconst link = {\n\t\turl,\n\t\topensInNewTab,\n\t};\n\tconst { showSubmenuIcon, openSubmenusOnClick } = context;\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add text…' );\n\tconst ref = useRef();\n\n\tconst {\n\t\tisAtMaxNesting,\n\t\tisTopLevelItem,\n\t\tisParentOfSelectedBlock,\n\t\tisImmediateParentOfSelectedBlock,\n\t\thasDescendants,\n\t\tselectedBlockHasDescendants,\n\t\tuserCanCreatePages,\n\t\tuserCanCreatePosts,\n\t\tonlyDescendantIsEmptyLink,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tlet _onlyDescendantIsEmptyLink;\n\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\tconst descendants = getClientIdsOfDescendants( [ clientId ] )\n\t\t\t\t.length;\n\n\t\t\tconst selectedBlockDescendants = getClientIdsOfDescendants( [\n\t\t\t\tselectedBlockId,\n\t\t\t] );\n\n\t\t\t// Check for a single descendant in the submenu. If that block\n\t\t\t// is a link block in a \"placeholder\" state with no label then\n\t\t\t// we can consider as an \"empty\" link.\n\t\t\tif ( selectedBlockDescendants?.length === 1 ) {\n\t\t\t\tconst singleBlock = getBlock( selectedBlockDescendants[ 0 ] );\n\n\t\t\t\t_onlyDescendantIsEmptyLink =\n\t\t\t\t\tsingleBlock?.name === 'core/navigation-link' &&\n\t\t\t\t\t! singleBlock?.attributes?.label;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length >=\n\t\t\t\t\tMAX_NESTING,\n\t\t\t\tisTopLevelItem:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, name ).length === 0,\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasDescendants: !! descendants,\n\t\t\t\tselectedBlockHasDescendants: !! selectedBlockDescendants?.length,\n\t\t\t\tuserCanCreatePages: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'pages'\n\t\t\t\t),\n\t\t\t\tuserCanCreatePosts: select( coreStore ).canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\t'posts'\n\t\t\t\t),\n\t\t\t\tonlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Show the LinkControl on mount if the URL is empty\n\t// ( When adding a new menu item)\n\t// This can't be done in the useState call because it conflicts\n\t// with the autofocus behavior of the BlockListBlock component.\n\tuseEffect( () => {\n\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [] );\n\n\t// Store the colors from context as attributes for rendering\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelItem } );\n\t}, [ isTopLevelItem ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = userCanCreatePages;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = userCanCreatePosts;\n\t}\n\n\tasync function handleCreate( pageTitle ) {\n\t\tconst postType = type || 'page';\n\n\t\tconst page = await saveEntityRecord( 'postType', postType, {\n\t\t\ttitle: pageTitle,\n\t\t\tstatus: 'draft',\n\t\t} );\n\n\t\treturn {\n\t\t\tid: page.id,\n\t\t\ttype: postType,\n\t\t\ttitle: page.title.rendered,\n\t\t\turl: page.link,\n\t\t\tkind: 'post-type',\n\t\t};\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelItem );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( isKeyboardEvent.primary( event, 'k' ) ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: listItemRef,\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasDescendants,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t) ]: !! backgroundColor,\n\t\t\t'open-on-click': openSubmenusOnClick,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\t// Always use overlay colors for submenus\n\tconst innerBlocksColors = getColors( context, true );\n\n\tif ( isAtMaxNesting ) {\n\t\tpull( ALLOWED_BLOCKS, 'core/navigation-submenu' );\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t\t'is-parent-of-selected-block': isParentOfSelectedBlock,\n\t\t\t\t'has-text-color': !! (\n\t\t\t\t\tinnerBlocksColors.textColor ||\n\t\t\t\t\tinnerBlocksColors.customTextColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]: !! innerBlocksColors.textColor,\n\t\t\t\t'has-background': !! (\n\t\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t\t),\n\t\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]: !! innerBlocksColors.backgroundColor,\n\t\t\t} ),\n\t\t\tstyle: {\n\t\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: true,\n\n\t\t\t// Ensure block toolbar is not too far removed from item\n\t\t\t// being edited.\n\t\t\t// see: https://github.com/WordPress/gutenberg/pull/34615.\n\t\t\t__experimentalCaptureToolbars: true,\n\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasDescendants ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\thasDescendants\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t}\n\t);\n\n\tconst ParentElement = openSubmenusOnClick ? 'button' : 'a';\n\n\tfunction transformToLink() {\n\t\tconst newLinkBlock = createBlock( 'core/navigation-link', attributes );\n\t\treplaceBlock( clientId, newLinkBlock );\n\t}\n\n\tconst canConvertToLink =\n\t\t! selectedBlockHasDescendants || onlyDescendantIsEmptyLink;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ ! openSubmenusOnClick && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"revert\"\n\t\t\t\t\t\ticon={ removeSubmenu }\n\t\t\t\t\t\ttitle={ __( 'Convert to Link' ) }\n\t\t\t\t\t\tonClick={ transformToLink }\n\t\t\t\t\t\tclassName=\"wp-block-navigation__submenu__revert\"\n\t\t\t\t\t\tisDisabled={ ! canConvertToLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdescription: descriptionValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<ParentElement className=\"wp-block-navigation-item__content\">\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: labelValue } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\taria-label={ __( 'Navigation link text' ) }\n\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif ( ! openSubmenusOnClick && ! url ) {\n\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\t{ ! openSubmenusOnClick && isLinkOpen && (\n\t\t\t\t\t\t<Popover\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchorRef={ listItemRef.current }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\t\tvalue={ link }\n\t\t\t\t\t\t\t\tshowInitialSuggestions={ true }\n\t\t\t\t\t\t\t\twithCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\t\tcreateSuggestion={ handleCreate }\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText={ ( searchTerm ) => {\n\t\t\t\t\t\t\t\t\tlet format;\n\t\t\t\t\t\t\t\t\tif ( type === 'post' ) {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft post: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t\t\t\t\t\t\tformat = __(\n\t\t\t\t\t\t\t\t\t\t\t'Create draft page: <mark>%s</mark>'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\tsprintf( format, searchTerm ),\n\t\t\t\t\t\t\t\t\t\t{ mark: <mark /> }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tnoDirectEntry={ !! type }\n\t\t\t\t\t\t\t\tnoURLSuggestion={ !! type }\n\t\t\t\t\t\t\t\tsuggestionsQuery={ getSuggestionsQuery(\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( updatedValue ) =>\n\t\t\t\t\t\t\t\t\tupdateNavigationLinkBlockAttributes(\n\t\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { url: '' } );\n\t\t\t\t\t\t\t\t\tspeak( __( 'Link removed.' ), 'assertive' );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover>\n\t\t\t\t\t) }\n\t\t\t\t</ParentElement>\n\t\t\t\t{ ( showSubmenuIcon || openSubmenusOnClick ) && (\n\t\t\t\t\t<span className=\"wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
@@ -80,7 +80,7 @@ function PageListEdit(_ref) {
80
80
  }, (0, _i18n.__)('Edit'))), allowConvertToLinks && isOpen && (0, _element.createElement)(_convertToLinksModal.default, {
81
81
  onClose: closeModal,
82
82
  clientId: clientId
83
- }), !hasResolvedPages && (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_components.Placeholder, null, (0, _element.createElement)(_components.Spinner, null))), hasResolvedPages && totalPages === null && (0, _element.createElement)("div", blockProps, (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_components.Notice, {
83
+ }), !hasResolvedPages && (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_components.Spinner, null)), hasResolvedPages && totalPages === null && (0, _element.createElement)("div", blockProps, (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_components.Notice, {
84
84
  status: 'warning',
85
85
  isDismissible: false
86
86
  }, (0, _i18n.__)('Page List: Cannot retrieve Pages.')))), totalPages === 0 && (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_components.Notice, {
@@ -179,14 +179,20 @@ const PageItems = (0, _element.memo)(function PageItems(_ref2) {
179
179
  'open-on-hover-click': !context.openSubmenusOnClick && context.showSubmenuIcon,
180
180
  'menu-item-home': page.id === frontPageId
181
181
  })
182
- }, hasChildren && context.openSubmenusOnClick ? (0, _element.createElement)(ItemSubmenuToggle, {
183
- title: (_page$title = page.title) === null || _page$title === void 0 ? void 0 : _page$title.rendered
184
- }) : (0, _element.createElement)("a", {
182
+ }, hasChildren && context.openSubmenusOnClick ? (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("button", {
183
+ className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
184
+ "aria-expanded": "false"
185
+ }, (_page$title = page.title) === null || _page$title === void 0 ? void 0 : _page$title.rendered), (0, _element.createElement)("span", {
186
+ className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
187
+ }, (0, _element.createElement)(_icons.ItemSubmenuIcon, null))) : (0, _element.createElement)("a", {
185
188
  className: (0, _classnames.default)('wp-block-pages-list__item__link', {
186
189
  'wp-block-navigation-item__content': isNavigationChild
187
190
  }),
188
191
  href: page.link
189
- }, (_page$title2 = page.title) === null || _page$title2 === void 0 ? void 0 : _page$title2.rendered), hasChildren && (0, _element.createElement)(_element.Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && (0, _element.createElement)(ItemSubmenuToggle, null), (0, _element.createElement)("ul", {
192
+ }, (_page$title2 = page.title) === null || _page$title2 === void 0 ? void 0 : _page$title2.rendered), hasChildren && (0, _element.createElement)(_element.Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && (0, _element.createElement)("button", {
193
+ className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon",
194
+ "aria-expanded": "false"
195
+ }, (0, _element.createElement)(_icons.ItemSubmenuIcon, null)), (0, _element.createElement)("ul", {
190
196
  className: (0, _classnames.default)('submenu-container', {
191
197
  'wp-block-navigation__submenu-container': isNavigationChild
192
198
  })
@@ -198,16 +204,4 @@ const PageItems = (0, _element.memo)(function PageItems(_ref2) {
198
204
  }))));
199
205
  });
200
206
  });
201
-
202
- function ItemSubmenuToggle(_ref3) {
203
- let {
204
- title
205
- } = _ref3;
206
- return (0, _element.createElement)("button", {
207
- className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
208
- "aria-expanded": "false"
209
- }, title, (0, _element.createElement)("span", {
210
- className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
211
- }, (0, _element.createElement)(_icons.ItemSubmenuIcon, null)));
212
- }
213
207
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","hasResolvedPages","usePageData","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","useFrontPageId","select","site","coreStore","getEntityRecord","show_on_front","page_on_front","pages","getEntityRecords","hasFinishedResolution","orderby","order","_fields","per_page","sortedPages","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","frontPageId","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link","ItemSubmenuToggle"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AACA;;AAKA;;AAKA;;AAMA;;AAEA;;AACA;;AAKA;;AACA;;AA7BA;AACA;AACA;;AAIA;AACA;AACA;;AAiBA;AACA;AACA;AAIA;AACA;AACA,MAAMA,cAAc,GAAG,GAAvB;;AAEe,SAASC,YAAT,OAA+C;AAAA;;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAwB;AAC7D,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,UAAnB;AAA+BC,IAAAA;AAA/B,MAAoDC,WAAW,EAArE;AAEA,QAAMC,iBAAiB,IAAG,qBAAqBN,OAAxB,CAAvB;AACA,QAAMO,mBAAmB,GACxBD,iBAAiB,IAAIH,UAAU,IAAIL,cADpC;AAGA,QAAM,CAAEU,MAAF,EAAUC,OAAV,IAAsB,uBAAU,KAAV,CAA5B;;AACA,QAAMC,SAAS,GAAG,MAAMD,OAAO,CAAE,IAAF,CAA/B;;AACA,QAAME,UAAU,GAAG,MAAMF,OAAO,CAAE,KAAF,CAAhC;;AAEA,QAAMG,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY,oBAAZ,EAAkC;AAC5C,wBAAkB,CAAC,CAAEb,OAAO,CAACc,SADe;AAE5C,OAAE,oCACD,OADC,EAEDd,OAAO,CAACc,SAFP,CAAF,GAGK,CAAC,CAAEd,OAAO,CAACc,SAL4B;AAM5C,wBAAkB,CAAC,CAAEd,OAAO,CAACe,eANe;AAO5C,OAAE,oCACD,kBADC,EAEDf,OAAO,CAACe,eAFP,CAAF,GAGK,CAAC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SAAS,EAAC;AAAhB,KACC,4BAAC,sBAAD,OADD,CALD,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport {\n\tToolbarButton,\n\tPlaceholder,\n\tSpinner,\n\tNotice,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages, hasResolvedPages } = usePageData();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! hasResolvedPages && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ hasResolvedPages && totalPages === null && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Notice status={ 'warning' } isDismissible={ false }>\n\t\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Notice status={ 'info' } isDismissible={ false }>\n\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t</Notice>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useFrontPageId() {\n\treturn useSelect( ( select ) => {\n\t\tconst site = select( coreStore ).getEntityRecord( 'root', 'site' );\n\t\treturn site?.show_on_front === 'page' && site?.page_on_front;\n\t}, [] );\n}\n\nfunction usePageData() {\n\tconst { pages, hasResolvedPages } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tpages: getEntityRecords( 'postType', 'page', {\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t\thasResolvedPages: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\t\tper_page: -1,\n\t\t\t\t},\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t// 'orderby', this can be removed.\n\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\tconst sortedPages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\t\tconst pagesByParentId = sortedPages.reduce( ( accumulator, page ) => {\n\t\t\tconst { parent } = page;\n\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t} else {\n\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, new Map() );\n\n\t\treturn {\n\t\t\tpagesByParentId,\n\t\t\thasResolvedPages,\n\t\t\ttotalPages: pages?.length ?? null,\n\t\t};\n\t}, [ pages, hasResolvedPages ] );\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\tconst frontPageId = useFrontPageId();\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t\t'menu-item-home': page.id === frontPageId,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<ItemSubmenuToggle title={ page.title?.rendered } />\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && <ItemSubmenuToggle /> }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n\nfunction ItemSubmenuToggle( { title } ) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\taria-expanded=\"false\"\n\t\t>\n\t\t\t{ title }\n\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t<ItemSubmenuIcon />\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","hasResolvedPages","usePageData","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","useFrontPageId","select","site","coreStore","getEntityRecord","show_on_front","page_on_front","pages","getEntityRecords","hasFinishedResolution","orderby","order","_fields","per_page","sortedPages","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","frontPageId","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AACA;;AAKA;;AAKA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAIA;AACA;AACA,MAAMA,cAAc,GAAG,GAAvB;;AAEe,SAASC,YAAT,OAA+C;AAAA;;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAwB;AAC7D,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,UAAnB;AAA+BC,IAAAA;AAA/B,MAAoDC,WAAW,EAArE;AAEA,QAAMC,iBAAiB,IAAG,qBAAqBN,OAAxB,CAAvB;AACA,QAAMO,mBAAmB,GACxBD,iBAAiB,IAAIH,UAAU,IAAIL,cADpC;AAGA,QA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,qDACG,CAAEhD,OAAO,CAACkD,mBAAV,IACDlD,OAAO,CAACmD,eADP,IAEA;AACC,MAAA,SAAS,EAAC,0IADX;AAEC,uBAAc;AAFf,OAIC,4BAAC,sBAAD,OAJD,CAHH,EAUC;AACC,MAAA,SAAS,EAAG,yBAAY,mBAAZ,EAAiC;AAC5C,kDAA0C7C;AADE,OAAjC;AADb,OAKC,4BAAC,SAAD;AACC,MAAA,OAAO,EAAGN,OADX;AAEC,MAAA,eAAe,EAAGE,eAFnB;AAGC,MAAA,QAAQ,EAAGiC,IAAI,CAACc,EAHjB;AAIC,MAAA,KAAK,EAAGJ,KAAK,GAAG;AAJjB,MALD,CAVD,CAtCF,CADD;AAiEA,GApEM,CAAP;AAqEA,CAlFiB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, Spinner, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages, hasResolvedPages } = usePageData();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! hasResolvedPages && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ hasResolvedPages && totalPages === null && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t\t<Notice status={ 'warning' } isDismissible={ false }>\n\t\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Notice status={ 'info' } isDismissible={ false }>\n\t\t\t\t\t\t{ __( 'Page List: Cannot retrieve Pages.' ) }\n\t\t\t\t\t</Notice>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useFrontPageId() {\n\treturn useSelect( ( select ) => {\n\t\tconst site = select( coreStore ).getEntityRecord( 'root', 'site' );\n\t\treturn site?.show_on_front === 'page' && site?.page_on_front;\n\t}, [] );\n}\n\nfunction usePageData() {\n\tconst { pages, hasResolvedPages } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tpages: getEntityRecords( 'postType', 'page', {\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t\thasResolvedPages: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\t\tper_page: -1,\n\t\t\t\t},\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t// 'orderby', this can be removed.\n\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\tconst sortedPages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\t\tconst pagesByParentId = sortedPages.reduce( ( accumulator, page ) => {\n\t\t\tconst { parent } = page;\n\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t} else {\n\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, new Map() );\n\n\t\treturn {\n\t\t\tpagesByParentId,\n\t\t\thasResolvedPages,\n\t\t\ttotalPages: pages?.length ?? null,\n\t\t};\n\t}, [ pages, hasResolvedPages ] );\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\tconst frontPageId = useFrontPageId();\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t\t'menu-item-home': page.id === frontPageId,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\"\n\t\t\t\t\t\t\t\t\taria-expanded=\"false\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ItemSubmenuIcon />\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n"]}
@@ -66,68 +66,7 @@ const migrateWithLayout = attributes => {
66
66
  }; // Social Links block deprecations.
67
67
 
68
68
 
69
- const deprecated = [// Implement `flex` layout.
70
- {
71
- attributes: {
72
- iconColor: {
73
- type: 'string'
74
- },
75
- customIconColor: {
76
- type: 'string'
77
- },
78
- iconColorValue: {
79
- type: 'string'
80
- },
81
- iconBackgroundColor: {
82
- type: 'string'
83
- },
84
- customIconBackgroundColor: {
85
- type: 'string'
86
- },
87
- iconBackgroundColorValue: {
88
- type: 'string'
89
- },
90
- openInNewTab: {
91
- type: 'boolean',
92
- default: false
93
- },
94
- size: {
95
- type: 'string'
96
- }
97
- },
98
- supports: {
99
- align: ['left', 'center', 'right'],
100
- anchor: true,
101
- __experimentalExposeControlsToChildren: true
102
- },
103
- isEligible: _ref => {
104
- let {
105
- layout
106
- } = _ref;
107
- return !layout;
108
- },
109
- migrate: migrateWithLayout,
110
-
111
- save(props) {
112
- const {
113
- attributes: {
114
- iconBackgroundColorValue,
115
- iconColorValue,
116
- itemsJustification,
117
- size
118
- }
119
- } = props;
120
- const className = (0, _classnames.default)(size, {
121
- 'has-icon-color': iconColorValue,
122
- 'has-icon-background-color': iconBackgroundColorValue,
123
- [`items-justified-${itemsJustification}`]: itemsJustification
124
- });
125
- return (0, _element.createElement)("ul", _blockEditor.useBlockProps.save({
126
- className
127
- }), (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null));
128
- }
129
-
130
- }, // V1. Remove CSS variable use for colors.
69
+ const deprecated = [// V1. Remove CSS variable use for colors.
131
70
  {
132
71
  attributes: {
133
72
  iconColor: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","supports","align","anchor","__experimentalExposeControlsToChildren","isEligible","migrate","save","props","itemsJustification","useBlockProps","providesContext","style"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAKC,UAAF,IAAkB;AAAA;;AAC3C,MAAK,CAAC,CAAEA,UAAU,CAACC,MAAnB,EAA4B;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DkB,CAAnB;eA+HerB,U","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * The specific handling by `className` below is needed because `itemsJustification`\n * was introduced in https://github.com/WordPress/gutenberg/pull/28980/files and wasn't\n * declared in block.json.\n *\n * @param {Object} attributes Block's attributes.\n */\nconst migrateWithLayout = ( attributes ) => {\n\tif ( !! attributes.layout ) {\n\t\treturn attributes;\n\t}\n\tconst { className } = attributes;\n\t// Matches classes with `items-justified-` prefix.\n\tconst prefix = `items-justified-`;\n\tconst justifiedItemsRegex = new RegExp( `\\\\b${ prefix }[^ ]*[ ]?\\\\b`, 'g' );\n\tconst newAttributes = {\n\t\t...attributes,\n\t\tclassName: className?.replace( justifiedItemsRegex, '' ).trim(),\n\t};\n\t/**\n\t * Add `layout` prop only if `justifyContent` is defined, for backwards\n\t * compatibility. In other cases the block's default layout will be used.\n\t * Also noting that due to the missing attribute, it's possible for a block\n\t * to have more than one of `justified` classes.\n\t */\n\tconst justifyContent = className\n\t\t?.match( justifiedItemsRegex )?.[ 0 ]\n\t\t?.trim();\n\tif ( justifyContent ) {\n\t\tObject.assign( newAttributes, {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\tjustifyContent: justifyContent.slice( prefix.length ),\n\t\t\t},\n\t\t} );\n\t}\n\treturn newAttributes;\n};\n\n// Social Links block deprecations.\nconst deprecated = [\n\t// Implement `flex` layout.\n\t{\n\t\tattributes: {\n\t\t\ticonColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\topenInNewTab: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tsupports: {\n\t\t\talign: [ 'left', 'center', 'right' ],\n\t\t\tanchor: true,\n\t\t\t__experimentalExposeControlsToChildren: true,\n\t\t},\n\t\tisEligible: ( { layout } ) => ! layout,\n\t\tmigrate: migrateWithLayout,\n\t\tsave( props ) {\n\t\t\tconst {\n\t\t\t\tattributes: {\n\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\ticonColorValue,\n\t\t\t\t\titemsJustification,\n\t\t\t\t\tsize,\n\t\t\t\t},\n\t\t\t} = props;\n\n\t\t\tconst className = classNames( size, {\n\t\t\t\t'has-icon-color': iconColorValue,\n\t\t\t\t'has-icon-background-color': iconBackgroundColorValue,\n\t\t\t\t[ `items-justified-${ itemsJustification }` ]: itemsJustification,\n\t\t\t} );\n\n\t\t\treturn (\n\t\t\t\t<ul { ...useBlockProps.save( { className } ) }>\n\t\t\t\t\t<InnerBlocks.Content />\n\t\t\t\t</ul>\n\t\t\t);\n\t\t},\n\t},\n\t// V1. Remove CSS variable use for colors.\n\t{\n\t\tattributes: {\n\t\t\ticonColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\topenInNewTab: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tprovidesContext: {\n\t\t\topenInNewTab: 'openInNewTab',\n\t\t},\n\t\tsupports: {\n\t\t\talign: [ 'left', 'center', 'right' ],\n\t\t\tanchor: true,\n\t\t},\n\t\tmigrate: migrateWithLayout,\n\t\tsave: ( props ) => {\n\t\t\tconst {\n\t\t\t\tattributes: {\n\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\ticonColorValue,\n\t\t\t\t\titemsJustification,\n\t\t\t\t\tsize,\n\t\t\t\t},\n\t\t\t} = props;\n\n\t\t\tconst className = classNames( size, {\n\t\t\t\t'has-icon-color': iconColorValue,\n\t\t\t\t'has-icon-background-color': iconBackgroundColorValue,\n\t\t\t\t[ `items-justified-${ itemsJustification }` ]: itemsJustification,\n\t\t\t} );\n\n\t\t\tconst style = {\n\t\t\t\t'--wp--social-links--icon-color': iconColorValue,\n\t\t\t\t'--wp--social-links--icon-background-color': iconBackgroundColorValue,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<ul { ...useBlockProps.save( { className, style } ) }>\n\t\t\t\t\t<InnerBlocks.Content />\n\t\t\t\t</ul>\n\t\t\t);\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-links/deprecated.js"],"names":["migrateWithLayout","attributes","layout","className","prefix","justifiedItemsRegex","RegExp","newAttributes","replace","trim","justifyContent","match","Object","assign","type","slice","length","deprecated","iconColor","customIconColor","iconColorValue","iconBackgroundColor","customIconBackgroundColor","iconBackgroundColorValue","openInNewTab","default","size","providesContext","supports","align","anchor","migrate","save","props","itemsJustification","style","useBlockProps"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAKC,UAAF,IAAkB;AAAA;;AAC3C,MAAK,CAAC,CAAEA,UAAU,CAACC,MAAnB,EAA4B;AAC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B;AAgBXS,IAAAA,wBAAwB,EAAE;AACzBT,MAAAA,IAAI,EAAE;AADmB,KAhBf;AAmBXU,IAAAA,YAAY,EAAE;AACbV,MAAAA,IAAI,EAAE,SADO;AAEbW,MAAAA,OAAO,EAAE;AAFI,KAnBH;AAuBXC,IAAAA,IAAI,EAAE;AACLZ,MAAAA,IAAI,EAAE;AADD;AAvBK,GADb;AA4BCa,EAAAA,eAAe,EAAE;AAChBH,IAAAA,YAAY,EAAE;AADE,GA5BlB;AA+BCI,EAAAA,QAAQ,EAAE;AACTC,IAAAA,KAAK,EAAE,CAAE,MAAF,EAAU,QAAV,EAAoB,OAApB,CADE;AAETC,IAAAA,MAAM,EAAE;AAFC,GA/BX;AAmCCC,EAAAA,OAAO,EAAE/B,iBAnCV;AAoCCgC,EAAAA,IAAI,EAAIC,KAAF,IAAa;AAClB,UAAM;AACLhC,MAAAA,UAAU,EAAE;AACXsB,QAAAA,wBADW;AAEXH,QAAAA,cAFW;AAGXc,QAAAA,kBAHW;AAIXR,QAAAA;AAJW;AADP,QAOFO,KAPJ;AASA,UAAM9B,SAAS,GAAG,yBAAYuB,IAAZ,EAAkB;AACnC,wBAAkBN,cADiB;AAEnC,mCAA6BG,wBAFM;AAGnC,OAAG,mBAAmBW,kBAAoB,EAA1C,GAA+CA;AAHZ,KAAlB,CAAlB;AAMA,UAAMC,KAAK,GAAG;AACb,wCAAkCf,cADrB;AAEb,mDAA6CG;AAFhC,KAAd;AAKA,WACC,kCAASa,2BAAcJ,IAAd,CAAoB;AAAE7B,MAAAA,SAAF;AAAagC,MAAAA;AAAb,KAApB,CAAT,EACC,4BAAC,wBAAD,CAAa,OAAb,OADD,CADD;AAKA;AA9DF,CAFkB,CAAnB;eAoEelB,U","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { InnerBlocks, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * The specific handling by `className` below is needed because `itemsJustification`\n * was introduced in https://github.com/WordPress/gutenberg/pull/28980/files and wasn't\n * declared in block.json.\n *\n * @param {Object} attributes Block's attributes.\n */\nconst migrateWithLayout = ( attributes ) => {\n\tif ( !! attributes.layout ) {\n\t\treturn attributes;\n\t}\n\tconst { className } = attributes;\n\t// Matches classes with `items-justified-` prefix.\n\tconst prefix = `items-justified-`;\n\tconst justifiedItemsRegex = new RegExp( `\\\\b${ prefix }[^ ]*[ ]?\\\\b`, 'g' );\n\tconst newAttributes = {\n\t\t...attributes,\n\t\tclassName: className?.replace( justifiedItemsRegex, '' ).trim(),\n\t};\n\t/**\n\t * Add `layout` prop only if `justifyContent` is defined, for backwards\n\t * compatibility. In other cases the block's default layout will be used.\n\t * Also noting that due to the missing attribute, it's possible for a block\n\t * to have more than one of `justified` classes.\n\t */\n\tconst justifyContent = className\n\t\t?.match( justifiedItemsRegex )?.[ 0 ]\n\t\t?.trim();\n\tif ( justifyContent ) {\n\t\tObject.assign( newAttributes, {\n\t\t\tlayout: {\n\t\t\t\ttype: 'flex',\n\t\t\t\tjustifyContent: justifyContent.slice( prefix.length ),\n\t\t\t},\n\t\t} );\n\t}\n\treturn newAttributes;\n};\n\n// Social Links block deprecations.\nconst deprecated = [\n\t// V1. Remove CSS variable use for colors.\n\t{\n\t\tattributes: {\n\t\t\ticonColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomIconBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\ticonBackgroundColorValue: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\topenInNewTab: {\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tprovidesContext: {\n\t\t\topenInNewTab: 'openInNewTab',\n\t\t},\n\t\tsupports: {\n\t\t\talign: [ 'left', 'center', 'right' ],\n\t\t\tanchor: true,\n\t\t},\n\t\tmigrate: migrateWithLayout,\n\t\tsave: ( props ) => {\n\t\t\tconst {\n\t\t\t\tattributes: {\n\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\ticonColorValue,\n\t\t\t\t\titemsJustification,\n\t\t\t\t\tsize,\n\t\t\t\t},\n\t\t\t} = props;\n\n\t\t\tconst className = classNames( size, {\n\t\t\t\t'has-icon-color': iconColorValue,\n\t\t\t\t'has-icon-background-color': iconBackgroundColorValue,\n\t\t\t\t[ `items-justified-${ itemsJustification }` ]: itemsJustification,\n\t\t\t} );\n\n\t\t\tconst style = {\n\t\t\t\t'--wp--social-links--icon-color': iconColorValue,\n\t\t\t\t'--wp--social-links--icon-background-color': iconBackgroundColorValue,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<ul { ...useBlockProps.save( { className, style } ) }>\n\t\t\t\t\t<InnerBlocks.Content />\n\t\t\t\t</ul>\n\t\t\t);\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}