@wordpress/block-library 6.0.10 → 6.0.14

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 (145) hide show
  1. package/build/cover/edit.js +1 -0
  2. package/build/cover/edit.js.map +1 -1
  3. package/build/gallery/deprecated.js +314 -26
  4. package/build/gallery/deprecated.js.map +1 -1
  5. package/build/gallery/edit-wrapper.js +10 -27
  6. package/build/gallery/edit-wrapper.js.map +1 -1
  7. package/build/gallery/edit.js +10 -12
  8. package/build/gallery/edit.js.map +1 -1
  9. package/build/gallery/save.js +3 -3
  10. package/build/gallery/save.js.map +1 -1
  11. package/build/gallery/shared.js +24 -0
  12. package/build/gallery/shared.js.map +1 -1
  13. package/build/gallery/transforms.js +8 -22
  14. package/build/gallery/transforms.js.map +1 -1
  15. package/build/gallery/use-mobile-warning.js +1 -1
  16. package/build/gallery/use-mobile-warning.js.map +1 -1
  17. package/build/gallery/v1/edit.js +2 -21
  18. package/build/gallery/v1/edit.js.map +1 -1
  19. package/build/image/image.js +30 -6
  20. package/build/image/image.js.map +1 -1
  21. package/build/navigation/deprecated.js +9 -7
  22. package/build/navigation/deprecated.js.map +1 -1
  23. package/build/navigation/edit/index.js +12 -1
  24. package/build/navigation/edit/index.js.map +1 -1
  25. package/build/navigation/edit/inner-blocks.js +0 -4
  26. package/build/navigation/edit/inner-blocks.js.map +1 -1
  27. package/build/navigation/edit/navigation-menu-selector.js +7 -1
  28. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  29. package/build/navigation/menu-items-to-blocks.js +4 -1
  30. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  31. package/build/navigation/view.js +2 -2
  32. package/build/navigation/view.js.map +1 -1
  33. package/build/navigation-submenu/edit.js +5 -1
  34. package/build/navigation-submenu/edit.js.map +1 -1
  35. package/build/post-comments/index.js +1 -1
  36. package/build/query-pagination/index.js +1 -1
  37. package/build/query-pagination-next/index.js +2 -2
  38. package/build/query-pagination-numbers/index.js +1 -1
  39. package/build/query-pagination-previous/index.js +2 -2
  40. package/build/separator/separator-settings.js +1 -0
  41. package/build/separator/separator-settings.js.map +1 -1
  42. package/build/social-links/edit.js +1 -0
  43. package/build/social-links/edit.js.map +1 -1
  44. package/build-module/cover/edit.js +1 -0
  45. package/build-module/cover/edit.js.map +1 -1
  46. package/build-module/gallery/deprecated.js +309 -27
  47. package/build-module/gallery/deprecated.js.map +1 -1
  48. package/build-module/gallery/edit-wrapper.js +7 -27
  49. package/build-module/gallery/edit-wrapper.js.map +1 -1
  50. package/build-module/gallery/edit.js +10 -12
  51. package/build-module/gallery/edit.js.map +1 -1
  52. package/build-module/gallery/save.js +2 -3
  53. package/build-module/gallery/save.js.map +1 -1
  54. package/build-module/gallery/shared.js +22 -0
  55. package/build-module/gallery/shared.js.map +1 -1
  56. package/build-module/gallery/transforms.js +9 -21
  57. package/build-module/gallery/transforms.js.map +1 -1
  58. package/build-module/gallery/use-mobile-warning.js +1 -1
  59. package/build-module/gallery/use-mobile-warning.js.map +1 -1
  60. package/build-module/gallery/v1/edit.js +4 -22
  61. package/build-module/gallery/v1/edit.js.map +1 -1
  62. package/build-module/image/image.js +31 -7
  63. package/build-module/image/image.js.map +1 -1
  64. package/build-module/navigation/deprecated.js +9 -7
  65. package/build-module/navigation/deprecated.js.map +1 -1
  66. package/build-module/navigation/edit/index.js +11 -1
  67. package/build-module/navigation/edit/index.js.map +1 -1
  68. package/build-module/navigation/edit/inner-blocks.js +0 -4
  69. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  70. package/build-module/navigation/edit/navigation-menu-selector.js +6 -1
  71. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  72. package/build-module/navigation/menu-items-to-blocks.js +3 -1
  73. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  74. package/build-module/navigation/view.js +2 -2
  75. package/build-module/navigation/view.js.map +1 -1
  76. package/build-module/navigation-submenu/edit.js +5 -1
  77. package/build-module/navigation-submenu/edit.js.map +1 -1
  78. package/build-module/post-comments/index.js +1 -1
  79. package/build-module/query-pagination/index.js +1 -1
  80. package/build-module/query-pagination-next/index.js +2 -2
  81. package/build-module/query-pagination-numbers/index.js +1 -1
  82. package/build-module/query-pagination-previous/index.js +2 -2
  83. package/build-module/separator/separator-settings.js +1 -0
  84. package/build-module/separator/separator-settings.js.map +1 -1
  85. package/build-module/social-links/edit.js +1 -0
  86. package/build-module/social-links/edit.js.map +1 -1
  87. package/build-style/columns/editor-rtl.css +1 -1
  88. package/build-style/columns/editor.css +1 -1
  89. package/build-style/editor-rtl.css +26 -1
  90. package/build-style/editor.css +26 -1
  91. package/build-style/image/editor-rtl.css +16 -0
  92. package/build-style/image/editor.css +16 -0
  93. package/build-style/navigation/editor-rtl.css +9 -0
  94. package/build-style/navigation/editor.css +9 -0
  95. package/build-style/navigation/style-rtl.css +5 -1
  96. package/build-style/navigation/style.css +5 -1
  97. package/build-style/post-comments/style-rtl.css +3 -1
  98. package/build-style/post-comments/style.css +3 -1
  99. package/build-style/post-comments-form/style-rtl.css +2 -2
  100. package/build-style/post-comments-form/style.css +2 -2
  101. package/build-style/style-rtl.css +10 -4
  102. package/build-style/style.css +10 -4
  103. package/package.json +8 -8
  104. package/src/columns/editor.scss +3 -2
  105. package/src/cover/edit.js +1 -0
  106. package/src/gallery/deprecated.js +831 -559
  107. package/src/gallery/edit-wrapper.js +7 -27
  108. package/src/gallery/edit.js +10 -12
  109. package/src/gallery/index.php +7 -8
  110. package/src/gallery/save.js +2 -1
  111. package/src/gallery/shared.js +24 -0
  112. package/src/gallery/transforms.js +9 -27
  113. package/src/gallery/use-mobile-warning.js +1 -1
  114. package/src/gallery/v1/edit.js +1 -28
  115. package/src/image/editor.scss +18 -0
  116. package/src/image/image.js +32 -8
  117. package/src/image/index.php +1 -1
  118. package/src/navigation/deprecated.js +10 -9
  119. package/src/navigation/edit/index.js +15 -6
  120. package/src/navigation/edit/inner-blocks.js +0 -5
  121. package/src/navigation/edit/navigation-menu-selector.js +8 -0
  122. package/src/navigation/editor.scss +12 -0
  123. package/src/navigation/index.php +149 -26
  124. package/src/navigation/menu-items-to-blocks.js +7 -1
  125. package/src/navigation/style.scss +5 -1
  126. package/src/navigation/view.js +2 -2
  127. package/src/navigation-submenu/edit.js +7 -1
  128. package/src/navigation-submenu/index.php +30 -45
  129. package/src/page-list/index.php +5 -9
  130. package/src/post-comments/block.json +5 -1
  131. package/src/post-comments/index.php +15 -0
  132. package/src/post-comments/style.scss +7 -3
  133. package/src/post-comments-form/style.scss +7 -5
  134. package/src/query-pagination/block.json +1 -1
  135. package/src/query-pagination-next/block.json +2 -2
  136. package/src/query-pagination-numbers/block.json +1 -1
  137. package/src/query-pagination-previous/block.json +2 -2
  138. package/src/separator/separator-settings.js +1 -0
  139. package/src/social-links/edit.js +1 -0
  140. package/src/template-part/index.php +36 -0
  141. package/build/gallery/v1/update-gallery-modal.js +0 -114
  142. package/build/gallery/v1/update-gallery-modal.js.map +0 -1
  143. package/build-module/gallery/v1/update-gallery-modal.js +0 -97
  144. package/build-module/gallery/v1/update-gallery-modal.js.map +0 -1
  145. package/src/gallery/v1/update-gallery-modal.js +0 -97
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-selector.js"],"names":["NavigationMenuSelector","onSelect","onCreateNew","navigationMenus","ref","selectedId","find","post","id","map","title","label","rendered","value"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,sBAAT,OAA6D;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;AAC3E,QAAM;AAAEC,IAAAA;AAAF,MAAsB,iCAA5B;AACA,QAAMC,GAAG,GAAG,2BAAa,UAAb,EAAyB,eAAzB,CAAZ;AAEA,SACC,qDACC,4BAAC,qBAAD,QACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAGA,GADT;AAEC,IAAA,QAAQ,EAAKC,UAAF,IACVJ,QAAQ,CACPE,eAAe,CAACG,IAAhB,CACGC,IAAF,IAAYA,IAAI,CAACC,EAAL,KAAYH,UADzB,CADO,CAHV;AASC,IAAA,OAAO,EAAGF,eAAe,CAACM,GAAhB,CAAqB,SAAqB;AAAA,UAAnB;AAAED,QAAAA,EAAF;AAAME,QAAAA;AAAN,OAAmB;AACnD,YAAMC,KAAK,GAAG,kCAAgBD,KAAK,CAACE,QAAtB,CAAd;AACA,aAAO;AACNC,QAAAA,KAAK,EAAEL,EADD;AAENG,QAAAA,KAFM;AAGN,sBAAc;AACb;AACA,sBAAI,gBAAJ,CAFa,EAGbA,KAHa;AAHR,OAAP;AASA,KAXS;AATX,IADD,CADD,EAyBC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAGT;AAApB,KACG,cAAI,iBAAJ,CADH,CADD,CAzBD,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuGroup, MenuItem, MenuItemsChoice } from '@wordpress/components';\nimport { useEntityId } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\n\nexport default function NavigationMenuSelector( { onSelect, onCreateNew } ) {\n\tconst { navigationMenus } = useNavigationMenu();\n\tconst ref = useEntityId( 'postType', 'wp_navigation' );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItemsChoice\n\t\t\t\t\tvalue={ ref }\n\t\t\t\t\tonSelect={ ( selectedId ) =>\n\t\t\t\t\t\tonSelect(\n\t\t\t\t\t\t\tnavigationMenus.find(\n\t\t\t\t\t\t\t\t( post ) => post.id === selectedId\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\tchoices={ navigationMenus.map( ( { id, title } ) => {\n\t\t\t\t\t\tconst label = decodeEntities( title.rendered );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t'aria-label': sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: The name of a menu. */\n\t\t\t\t\t\t\t\t__( \"Switch to '%s'\" ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t} ) }\n\t\t\t\t/>\n\t\t\t</MenuGroup>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem onClick={ onCreateNew }>\n\t\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-selector.js"],"names":["NavigationMenuSelector","onSelect","onCreateNew","navigationMenus","ref","selectedId","find","post","id","map","title","label","rendered","value","post_type"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,sBAAT,OAA6D;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;AAC3E,QAAM;AAAEC,IAAAA;AAAF,MAAsB,iCAA5B;AACA,QAAMC,GAAG,GAAG,2BAAa,UAAb,EAAyB,eAAzB,CAAZ;AAEA,SACC,qDACC,4BAAC,qBAAD,QACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAGA,GADT;AAEC,IAAA,QAAQ,EAAKC,UAAF,IACVJ,QAAQ,CACPE,eAAe,CAACG,IAAhB,CACGC,IAAF,IAAYA,IAAI,CAACC,EAAL,KAAYH,UADzB,CADO,CAHV;AASC,IAAA,OAAO,EAAGF,eAAe,CAACM,GAAhB,CAAqB,SAAqB;AAAA,UAAnB;AAAED,QAAAA,EAAF;AAAME,QAAAA;AAAN,OAAmB;AACnD,YAAMC,KAAK,GAAG,kCAAgBD,KAAK,CAACE,QAAtB,CAAd;AACA,aAAO;AACNC,QAAAA,KAAK,EAAEL,EADD;AAENG,QAAAA,KAFM;AAGN,sBAAc;AACb;AACA,sBAAI,gBAAJ,CAFa,EAGbA,KAHa;AAHR,OAAP;AASA,KAXS;AATX,IADD,CADD,EAyBC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAGT;AAApB,KACG,cAAI,iBAAJ,CADH,CADD,EAIC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAChCY,MAAAA,SAAS,EAAE;AADqB,KAA1B;AADR,KAKG,cAAI,cAAJ,CALH,CAJD,CAzBD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuGroup, MenuItem, MenuItemsChoice } from '@wordpress/components';\nimport { useEntityId } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\n\nexport default function NavigationMenuSelector( { onSelect, onCreateNew } ) {\n\tconst { navigationMenus } = useNavigationMenu();\n\tconst ref = useEntityId( 'postType', 'wp_navigation' );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItemsChoice\n\t\t\t\t\tvalue={ ref }\n\t\t\t\t\tonSelect={ ( selectedId ) =>\n\t\t\t\t\t\tonSelect(\n\t\t\t\t\t\t\tnavigationMenus.find(\n\t\t\t\t\t\t\t\t( post ) => post.id === selectedId\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\tchoices={ navigationMenus.map( ( { id, title } ) => {\n\t\t\t\t\t\tconst label = decodeEntities( title.rendered );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t'aria-label': sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: The name of a menu. */\n\t\t\t\t\t\t\t\t__( \"Switch to '%s'\" ),\n\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t} ) }\n\t\t\t\t/>\n\t\t\t</MenuGroup>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem onClick={ onCreateNew }>\n\t\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t\t</MenuItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: 'wp_navigation',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Manage menus' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t</>\n\t);\n}\n"]}
@@ -9,6 +9,8 @@ var _lodash = require("lodash");
9
9
 
10
10
  var _blocks = require("@wordpress/blocks");
11
11
 
12
+ var _hooks = require("@wordpress/hooks");
13
+
12
14
  /**
13
15
  * External dependencies
14
16
  */
@@ -30,7 +32,8 @@ function menuItemsToBlocks(menuItems) {
30
32
  }
31
33
 
32
34
  const menuTree = createDataTree(menuItems);
33
- return mapMenuItemsToBlocks(menuTree);
35
+ const blocks = mapMenuItemsToBlocks(menuTree);
36
+ return (0, _hooks.applyFilters)('blocks.navigation.__unstableMenuItemsToBlocks', blocks, menuItems);
34
37
  }
35
38
  /**
36
39
  * A recursive function that maps menu item nodes to blocks.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/menu-items-to-blocks.js"],"names":["menuItemsToBlocks","menuItems","menuTree","createDataTree","mapMenuItemsToBlocks","mapping","sortedItems","innerBlocks","map","menuItem","type","block","content","raw","attributes","menuItemToBlockAttributes","nestedBlocks","nestedMapping","children","length","blockType","id","clientId","title","menuItemTitleField","xfn","classes","attr_title","object","object_id","description","url","menuItemTypeField","target","label","rendered","kind","replace","join","trim","rel","className","opensInNewTab","dataset","relation","hashTable","Object","create","dataTree","data","push"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iBAAT,CAA4BC,SAA5B,EAAwC;AACtD,MAAK,CAAEA,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMC,QAAQ,GAAGC,cAAc,CAAEF,SAAF,CAA/B;AACA,SAAOG,oBAAoB,CAAEF,QAAF,CAA3B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,oBAAT,CAA+BH,SAA/B,EAA2C;AAC1C,MAAII,OAAO,GAAG,EAAd,CAD0C,CAG1C;;AACA,QAAMC,WAAW,GAAG,oBAAQL,SAAR,EAAmB,YAAnB,CAApB;AAEA,QAAMM,WAAW,GAAGD,WAAW,CAACE,GAAZ,CAAmBC,QAAF,IAAgB;AAAA;;AACpD,QAAKA,QAAQ,CAACC,IAAT,KAAkB,OAAvB,EAAiC;AAChC,YAAM,CAAEC,KAAF,IAAY,mBAAOF,QAAQ,CAACG,OAAT,CAAiBC,GAAxB,CAAlB;;AAEA,UAAK,CAAEF,KAAP,EAAe;AACd,eAAO,yBAAa,eAAb,EAA8B;AACpCC,UAAAA,OAAO,EAAEH,QAAQ,CAACG;AADkB,SAA9B,CAAP;AAGA;;AAED,aAAOD,KAAP;AACA;;AAED,UAAMG,UAAU,GAAGC,yBAAyB,CAAEN,QAAF,CAA5C,CAboD,CAepD;;AACA,UAAM;AACLF,MAAAA,WAAW,EAAES,YAAY,GAAG,EADvB;AAC2B;AAChCX,MAAAA,OAAO,EAAEY,aAAa,GAAG,EAFpB,CAEwB;;AAFxB,QAGF,sBAAAR,QAAQ,CAACS,QAAT,kEAAmBC,MAAnB,GACDf,oBAAoB,CAAEK,QAAQ,CAACS,QAAX,CADnB,GAED,EALH,CAhBoD,CAuBpD;;AACAb,IA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,EAAiC,uEAA5B,IAA4B;AAAA,MAAtBuB,QAAsB,uEAAX,QAAW;AAClE,QAAMC,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAlB;AACA,QAAMC,QAAQ,GAAG,EAAjB;;AAEA,OAAM,MAAMC,IAAZ,IAAoBN,OAApB,EAA8B;AAC7BE,IAAAA,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CAAT,GAA0B,EACzB,GAAG4B,IADsB;AAEzB/B,MAAAA,QAAQ,EAAE;AAFe,KAA1B;;AAIA,QAAK+B,IAAI,CAAEL,QAAF,CAAT,EAAwB;AACvBC,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,GAAgCC,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,IAAiC,EAAjE;AACAC,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,GACC2B,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,IAA0C,EAD3C;AAEA2B,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,CAAuCgC,IAAvC,CACCL,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CADV;AAGA,KAPD,MAOO;AACN2B,MAAAA,QAAQ,CAACE,IAAT,CAAeL,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CAAxB;AACA;AACD;;AAED,SAAO2B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock, parse } from '@wordpress/blocks';\n\n/**\n * Convert a flat menu item structure to a nested blocks structure.\n *\n * @param {Object[]} menuItems An array of menu items.\n *\n * @return {WPBlock[]} An array of blocks.\n */\nexport default function menuItemsToBlocks( menuItems ) {\n\tif ( ! menuItems ) {\n\t\treturn null;\n\t}\n\n\tconst menuTree = createDataTree( menuItems );\n\treturn mapMenuItemsToBlocks( menuTree );\n}\n\n/**\n * A recursive function that maps menu item nodes to blocks.\n *\n * @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items.\n * @return {Object} Object containing innerBlocks and mapping.\n */\nfunction mapMenuItemsToBlocks( menuItems ) {\n\tlet mapping = {};\n\n\t// The menuItem should be in menu_order sort order.\n\tconst sortedItems = sortBy( menuItems, 'menu_order' );\n\n\tconst innerBlocks = sortedItems.map( ( menuItem ) => {\n\t\tif ( menuItem.type === 'block' ) {\n\t\t\tconst [ block ] = parse( menuItem.content.raw );\n\n\t\t\tif ( ! block ) {\n\t\t\t\treturn createBlock( 'core/freeform', {\n\t\t\t\t\tcontent: menuItem.content,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn block;\n\t\t}\n\n\t\tconst attributes = menuItemToBlockAttributes( menuItem );\n\n\t\t// If there are children recurse to build those nested blocks.\n\t\tconst {\n\t\t\tinnerBlocks: nestedBlocks = [], // alias to avoid shadowing\n\t\t\tmapping: nestedMapping = {}, // alias to avoid shadowing\n\t\t} = menuItem.children?.length\n\t\t\t? mapMenuItemsToBlocks( menuItem.children )\n\t\t\t: {};\n\n\t\t// Update parent mapping with nested mapping.\n\t\tmapping = {\n\t\t\t...mapping,\n\t\t\t...nestedMapping,\n\t\t};\n\n\t\tconst blockType = menuItem.children?.length\n\t\t\t? 'core/navigation-submenu'\n\t\t\t: 'core/navigation-link';\n\n\t\t// Create block with nested \"innerBlocks\".\n\t\tconst block = createBlock( blockType, attributes, nestedBlocks );\n\n\t\t// Create mapping for menuItem -> block\n\t\tmapping[ menuItem.id ] = block.clientId;\n\n\t\treturn block;\n\t} );\n\n\treturn {\n\t\tinnerBlocks,\n\t\tmapping,\n\t};\n}\n\n/**\n * A WP nav_menu_item object.\n * For more documentation on the individual fields present on a menu item please see:\n * https://core.trac.wordpress.org/browser/tags/5.7.1/src/wp-includes/nav-menu.php#L789\n *\n * Changes made here should also be mirrored in packages/edit-navigation/src/store/utils.js.\n *\n * @typedef WPNavMenuItem\n *\n * @property {Object} title stores the raw and rendered versions of the title/label for this menu item.\n * @property {Array} xfn the XFN relationships expressed in the link of this menu item.\n * @property {Array} classes the HTML class attributes for this menu item.\n * @property {string} attr_title the HTML title attribute for this menu item.\n * @property {string} object The type of object originally represented, such as 'category', 'post', or 'attachment'.\n * @property {string} object_id The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories.\n * @property {string} description The description of this menu item.\n * @property {string} url The URL to which this menu item points.\n * @property {string} type The family of objects originally represented, such as 'post_type' or 'taxonomy'.\n * @property {string} target The target attribute of the link element for this menu item.\n */\n\n/**\n * Convert block attributes to menu item.\n *\n * @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.\n * @return {Object} the block attributes converted from the WPNavMenuItem item.\n */\nfunction menuItemToBlockAttributes( {\n\ttitle: menuItemTitleField,\n\txfn,\n\tclasses,\n\t// eslint-disable-next-line camelcase\n\tattr_title,\n\tobject,\n\t// eslint-disable-next-line camelcase\n\tobject_id,\n\tdescription,\n\turl,\n\ttype: menuItemTypeField,\n\ttarget,\n} ) {\n\t// For historical reasons, the `core/navigation-link` variation type is `tag`\n\t// whereas WP Core expects `post_tag` as the `object` type.\n\t// To avoid writing a block migration we perform a conversion here.\n\t// See also inverse equivalent in `blockAttributesToMenuItem`.\n\tif ( object && object === 'post_tag' ) {\n\t\tobject = 'tag';\n\t}\n\n\treturn {\n\t\tlabel: menuItemTitleField?.rendered || '',\n\t\t...( object?.length && {\n\t\t\ttype: object,\n\t\t} ),\n\t\tkind: menuItemTypeField?.replace( '_', '-' ) || 'custom',\n\t\turl: url || '',\n\t\t...( xfn?.length &&\n\t\t\txfn.join( ' ' ).trim() && {\n\t\t\t\trel: xfn.join( ' ' ).trim(),\n\t\t\t} ),\n\t\t...( classes?.length &&\n\t\t\tclasses.join( ' ' ).trim() && {\n\t\t\t\tclassName: classes.join( ' ' ).trim(),\n\t\t\t} ),\n\t\t...( attr_title?.length && {\n\t\t\ttitle: attr_title,\n\t\t} ),\n\t\t// eslint-disable-next-line camelcase\n\t\t...( object_id &&\n\t\t\t'custom' !== object && {\n\t\t\t\tid: object_id,\n\t\t\t} ),\n\t\t...( description?.length && {\n\t\t\tdescription,\n\t\t} ),\n\t\t...( target === '_blank' && {\n\t\t\topensInNewTab: true,\n\t\t} ),\n\t};\n}\n\n/**\n * Creates a nested, hierarchical tree representation from unstructured data that\n * has an inherent relationship defined between individual items.\n *\n * For example, by default, each element in the dataset should have an `id` and\n * `parent` property where the `parent` property indicates a relationship between\n * the current item and another item with a matching `id` properties.\n *\n * This is useful for building linked lists of data from flat data structures.\n *\n * @param {Array} dataset linked data to be rearranged into a hierarchical tree based on relational fields.\n * @param {string} id the property which uniquely identifies each entry within the array.\n * @param {*} relation the property which identifies how the current item is related to other items in the data (if at all).\n * @return {Array} a nested array of parent/child relationships\n */\nfunction createDataTree( dataset, id = 'id', relation = 'parent' ) {\n\tconst hashTable = Object.create( null );\n\tconst dataTree = [];\n\n\tfor ( const data of dataset ) {\n\t\thashTable[ data[ id ] ] = {\n\t\t\t...data,\n\t\t\tchildren: [],\n\t\t};\n\t\tif ( data[ relation ] ) {\n\t\t\thashTable[ data[ relation ] ] = hashTable[ data[ relation ] ] || {};\n\t\t\thashTable[ data[ relation ] ].children =\n\t\t\t\thashTable[ data[ relation ] ].children || [];\n\t\t\thashTable[ data[ relation ] ].children.push(\n\t\t\t\thashTable[ data[ id ] ]\n\t\t\t);\n\t\t} else {\n\t\t\tdataTree.push( hashTable[ data[ id ] ] );\n\t\t}\n\t}\n\n\treturn dataTree;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/menu-items-to-blocks.js"],"names":["menuItemsToBlocks","menuItems","menuTree","createDataTree","blocks","mapMenuItemsToBlocks","mapping","sortedItems","innerBlocks","map","menuItem","type","block","content","raw","attributes","menuItemToBlockAttributes","nestedBlocks","nestedMapping","children","length","blockType","id","clientId","title","menuItemTitleField","xfn","classes","attr_title","object","object_id","description","url","menuItemTypeField","target","label","rendered","kind","replace","join","trim","rel","className","opensInNewTab","dataset","relation","hashTable","Object","create","dataTree","data","push"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iBAAT,CAA4BC,SAA5B,EAAwC;AACtD,MAAK,CAAEA,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMC,QAAQ,GAAGC,cAAc,CAAEF,SAAF,CAA/B;AACA,QAAMG,MAAM,GAAGC,oBAAoB,CAAEH,QAAF,CAAnC;AACA,SAAO,yBACN,+CADM,EAENE,MAFM,EAGNH,SAHM,CAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,oBAAT,CAA+BJ,SAA/B,EAA2C;AAC1C,MAAIK,OAAO,GAAG,EAAd,CAD0C,CAG1C;;AACA,QAAMC,WAAW,GAAG,oBAAQN,SAAR,EAAmB,YAAnB,CAApB;AAEA,QAAMO,WAAW,GAAGD,WAAW,CAACE,GAAZ,CAAmBC,QAAF,IAAgB;AAAA;;AACpD,QAAKA,QAAQ,CAACC,IAAT,KAAkB,OAAvB,EAAiC;AAChC,YAAM,CAAEC,KAAF,IAAY,mBAAOF,QAAQ,CAACG,OAAT,CAAiBC,GAAxB,CAAlB;;AAEA,UAAK,CAAEF,KAAP,EAAe;AACd,eAAO,yBAAa,eAAb,EAA8B;AACpCC,UAAAA,OAAO,EAAEH,QAAQ,CAACG;AADkB,SAA9B,CAAP;AAGA;;AAED,aAAOD,KAAP;AACA;;AAED,UAAMG,UAAU,GAAGC,yBAAyB,CAAEN,QAAF,CAA5C,CAboD,CAepD;;AACA,UAAM;AACLF,MAAAA,WAAW,EAAES,YAAY,GAAG,EADvB;AAC2B;AAChCX,MAAAA,OAAO,EAAEY,aAAa,GAAG,EAFpB,CAEwB;;AAFxB,QAGF,sBAAAR,QAAQ,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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASxC,cAAT,CAAyByC,OAAzB,EAAmE;AAAA,MAAjCtB,EAAiC,uEAA5B,IAA4B;AAAA,MAAtBuB,QAAsB,uEAAX,QAAW;AAClE,QAAMC,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAe,IAAf,CAAlB;AACA,QAAMC,QAAQ,GAAG,EAAjB;;AAEA,OAAM,MAAMC,IAAZ,IAAoBN,OAApB,EAA8B;AAC7BE,IAAAA,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CAAT,GAA0B,EACzB,GAAG4B,IADsB;AAEzB/B,MAAAA,QAAQ,EAAE;AAFe,KAA1B;;AAIA,QAAK+B,IAAI,CAAEL,QAAF,CAAT,EAAwB;AACvBC,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,GAAgCC,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,IAAiC,EAAjE;AACAC,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,GACC2B,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,IAA0C,EAD3C;AAEA2B,MAAAA,SAAS,CAAEI,IAAI,CAAEL,QAAF,CAAN,CAAT,CAA8B1B,QAA9B,CAAuCgC,IAAvC,CACCL,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CADV;AAGA,KAPD,MAOO;AACN2B,MAAAA,QAAQ,CAACE,IAAT,CAAeL,SAAS,CAAEI,IAAI,CAAE5B,EAAF,CAAN,CAAxB;AACA;AACD;;AAED,SAAO2B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock, parse } from '@wordpress/blocks';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Convert a flat menu item structure to a nested blocks structure.\n *\n * @param {Object[]} menuItems An array of menu items.\n *\n * @return {WPBlock[]} An array of blocks.\n */\nexport default function menuItemsToBlocks( menuItems ) {\n\tif ( ! menuItems ) {\n\t\treturn null;\n\t}\n\n\tconst menuTree = createDataTree( menuItems );\n\tconst blocks = mapMenuItemsToBlocks( menuTree );\n\treturn applyFilters(\n\t\t'blocks.navigation.__unstableMenuItemsToBlocks',\n\t\tblocks,\n\t\tmenuItems\n\t);\n}\n\n/**\n * A recursive function that maps menu item nodes to blocks.\n *\n * @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items.\n * @return {Object} Object containing innerBlocks and mapping.\n */\nfunction mapMenuItemsToBlocks( menuItems ) {\n\tlet mapping = {};\n\n\t// The menuItem should be in menu_order sort order.\n\tconst sortedItems = sortBy( menuItems, 'menu_order' );\n\n\tconst innerBlocks = sortedItems.map( ( menuItem ) => {\n\t\tif ( menuItem.type === 'block' ) {\n\t\t\tconst [ block ] = parse( menuItem.content.raw );\n\n\t\t\tif ( ! block ) {\n\t\t\t\treturn createBlock( 'core/freeform', {\n\t\t\t\t\tcontent: menuItem.content,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn block;\n\t\t}\n\n\t\tconst attributes = menuItemToBlockAttributes( menuItem );\n\n\t\t// If there are children recurse to build those nested blocks.\n\t\tconst {\n\t\t\tinnerBlocks: nestedBlocks = [], // alias to avoid shadowing\n\t\t\tmapping: nestedMapping = {}, // alias to avoid shadowing\n\t\t} = menuItem.children?.length\n\t\t\t? mapMenuItemsToBlocks( menuItem.children )\n\t\t\t: {};\n\n\t\t// Update parent mapping with nested mapping.\n\t\tmapping = {\n\t\t\t...mapping,\n\t\t\t...nestedMapping,\n\t\t};\n\n\t\tconst blockType = menuItem.children?.length\n\t\t\t? 'core/navigation-submenu'\n\t\t\t: 'core/navigation-link';\n\n\t\t// Create block with nested \"innerBlocks\".\n\t\tconst block = createBlock( blockType, attributes, nestedBlocks );\n\n\t\t// Create mapping for menuItem -> block\n\t\tmapping[ menuItem.id ] = block.clientId;\n\n\t\treturn block;\n\t} );\n\n\treturn {\n\t\tinnerBlocks,\n\t\tmapping,\n\t};\n}\n\n/**\n * A WP nav_menu_item object.\n * For more documentation on the individual fields present on a menu item please see:\n * https://core.trac.wordpress.org/browser/tags/5.7.1/src/wp-includes/nav-menu.php#L789\n *\n * Changes made here should also be mirrored in packages/edit-navigation/src/store/utils.js.\n *\n * @typedef WPNavMenuItem\n *\n * @property {Object} title stores the raw and rendered versions of the title/label for this menu item.\n * @property {Array} xfn the XFN relationships expressed in the link of this menu item.\n * @property {Array} classes the HTML class attributes for this menu item.\n * @property {string} attr_title the HTML title attribute for this menu item.\n * @property {string} object The type of object originally represented, such as 'category', 'post', or 'attachment'.\n * @property {string} object_id The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories.\n * @property {string} description The description of this menu item.\n * @property {string} url The URL to which this menu item points.\n * @property {string} type The family of objects originally represented, such as 'post_type' or 'taxonomy'.\n * @property {string} target The target attribute of the link element for this menu item.\n */\n\n/**\n * Convert block attributes to menu item.\n *\n * @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.\n * @return {Object} the block attributes converted from the WPNavMenuItem item.\n */\nfunction menuItemToBlockAttributes( {\n\ttitle: menuItemTitleField,\n\txfn,\n\tclasses,\n\t// eslint-disable-next-line camelcase\n\tattr_title,\n\tobject,\n\t// eslint-disable-next-line camelcase\n\tobject_id,\n\tdescription,\n\turl,\n\ttype: menuItemTypeField,\n\ttarget,\n} ) {\n\t// For historical reasons, the `core/navigation-link` variation type is `tag`\n\t// whereas WP Core expects `post_tag` as the `object` type.\n\t// To avoid writing a block migration we perform a conversion here.\n\t// See also inverse equivalent in `blockAttributesToMenuItem`.\n\tif ( object && object === 'post_tag' ) {\n\t\tobject = 'tag';\n\t}\n\n\treturn {\n\t\tlabel: menuItemTitleField?.rendered || '',\n\t\t...( object?.length && {\n\t\t\ttype: object,\n\t\t} ),\n\t\tkind: menuItemTypeField?.replace( '_', '-' ) || 'custom',\n\t\turl: url || '',\n\t\t...( xfn?.length &&\n\t\t\txfn.join( ' ' ).trim() && {\n\t\t\t\trel: xfn.join( ' ' ).trim(),\n\t\t\t} ),\n\t\t...( classes?.length &&\n\t\t\tclasses.join( ' ' ).trim() && {\n\t\t\t\tclassName: classes.join( ' ' ).trim(),\n\t\t\t} ),\n\t\t...( attr_title?.length && {\n\t\t\ttitle: attr_title,\n\t\t} ),\n\t\t// eslint-disable-next-line camelcase\n\t\t...( object_id &&\n\t\t\t'custom' !== object && {\n\t\t\t\tid: object_id,\n\t\t\t} ),\n\t\t...( description?.length && {\n\t\t\tdescription,\n\t\t} ),\n\t\t...( target === '_blank' && {\n\t\t\topensInNewTab: true,\n\t\t} ),\n\t};\n}\n\n/**\n * Creates a nested, hierarchical tree representation from unstructured data that\n * has an inherent relationship defined between individual items.\n *\n * For example, by default, each element in the dataset should have an `id` and\n * `parent` property where the `parent` property indicates a relationship between\n * the current item and another item with a matching `id` properties.\n *\n * This is useful for building linked lists of data from flat data structures.\n *\n * @param {Array} dataset linked data to be rearranged into a hierarchical tree based on relational fields.\n * @param {string} id the property which uniquely identifies each entry within the array.\n * @param {*} relation the property which identifies how the current item is related to other items in the data (if at all).\n * @return {Array} a nested array of parent/child relationships\n */\nfunction createDataTree( dataset, id = 'id', relation = 'parent' ) {\n\tconst hashTable = Object.create( null );\n\tconst dataTree = [];\n\n\tfor ( const data of dataset ) {\n\t\thashTable[ data[ id ] ] = {\n\t\t\t...data,\n\t\t\tchildren: [],\n\t\t};\n\t\tif ( data[ relation ] ) {\n\t\t\thashTable[ data[ relation ] ] = hashTable[ data[ relation ] ] || {};\n\t\t\thashTable[ data[ relation ] ].children =\n\t\t\t\thashTable[ data[ relation ] ].children || [];\n\t\t\thashTable[ data[ relation ] ].children.push(\n\t\t\t\thashTable[ data[ id ] ]\n\t\t\t);\n\t\t} else {\n\t\t\tdataTree.push( hashTable[ data[ id ] ] );\n\t\t}\n\t}\n\n\treturn dataTree;\n}\n"]}
@@ -51,7 +51,7 @@ function toggleSubmenuOnClick(event) {
51
51
  // scripts could be loaded before the body.
52
52
 
53
53
 
54
- window.onload = () => {
54
+ window.addEventListener('load', () => {
55
55
  _micromodal.default.init({
56
56
  onShow: navigationToggleModal,
57
57
  onClose: navigationToggleModal,
@@ -80,5 +80,5 @@ window.onload = () => {
80
80
  }
81
81
  });
82
82
  });
83
- };
83
+ });
84
84
  //# sourceMappingURL=view.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/view.js"],"names":["navigationToggleModal","modal","triggerButton","document","querySelector","id","closeButton","isHidden","getAttribute","setAttribute","classList","toggle","htmlElement","documentElement","closeSubmenus","element","querySelectorAll","forEach","toggleSubmenuOnClick","event","buttonToggle","target","closest","isSubmenuOpen","parentElement","navigationParent","child","window","onload","MicroModal","init","onShow","onClose","openClass","submenuButtons","button","addEventListener","navigationBlocks","block","contains","submenuBlocks"],"mappings":";;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACvC,QAAMC,aAAa,GAAGC,QAAQ,CAACC,aAAT,CACpB,mCAAmCH,KAAK,CAACI,EAAI,IADzB,CAAtB;AAGA,QAAMC,WAAW,GAAGL,KAAK,CAACG,aAAN,CAAqB,+BAArB,CAApB,CAJuC,CAKvC;AACA;;AACA,QAAMG,QAAQ,GAAG,WAAWN,KAAK,CAACO,YAAN,CAAoB,aAApB,CAA5B;AACAN,EAAAA,aAAa,CAACO,YAAd,CAA4B,eAA5B,EAA6C,CAAEF,QAA/C;AACAD,EAAAA,WAAW,CAACG,YAAZ,CAA0B,eAA1B,EAA2C,CAAEF,QAA7C;AACAN,EAAAA,KAAK,CAACS,SAAN,CAAgBC,MAAhB,CAAwB,gBAAxB,EAA0C,CAAEJ,QAA5C,EAVuC,CAYvC;;AACA,QAAMK,WAAW,GAAGT,QAAQ,CAACU,eAA7B;AACAD,EAAAA,WAAW,CAACF,SAAZ,CAAsBC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AAIAkB,EAAAA,cAAc,CAACjB,OAAf,CAAwB,UAAWkB,MAAX,EAAoB;AAC3CA,IAAAA,MAAM,CAACC,gBAAP,CAAyB,OAAzB,EAAkClB,oBAAlC;AACA,GAFD,EAXqB,CAerB;;AACAf,EAAAA,QAAQ,CAACiC,gBAAT,CAA2B,OAA3B,EAAoC,UAAWjB,KAAX,EAAmB;AACtD,UAAMkB,gBAAgB,GAAGlC,QAAQ,CAACa,gBAAT,CACxB,sBADwB,CAAzB;AAGAqB,IAAAA,gBAAgB,CAACpB,OAAjB,CAA0B,UAAWqB,KAAX,EAAmB;AAC5C,UAAK,CAAEA,KAAK,CAACC,QAAN,CAAgBpB,KAAK,CAACE,MAAtB,CAAP,EAAwC;AACvCP,QAAAA,aAAa,CAAEwB,KAAF,CAAb;AACA;AACD,KAJD;AAKA,GATD,EAhBqB,CA0BrB;;AACAnC,EAAAA,QAAQ,CAACiC,gBAAT,CAA2B,OAA3B,EAAoC,UAAWjB,KAAX,EAAmB;AACtD,UAAMqB,aAAa,GAAGrC,QAAQ,CAACa,gBAAT,CACrB,qCADqB,CAAtB;AAGAwB,IAAAA,aAAa,CAACvB,OAAd,CAAuB,UAAWqB,KAAX,EAAmB;AACzC,UAAK,CAAEA,KAAK,CAACC,QAAN,CAAgBpB,KAAK,CAACE,MAAtB,CAAP,EAAwC;AACvCP,QAAAA,aAAa,CAAEwB,KAAF,CAAb;AACA;AACD,KAJD;AAKA,GATD;AAUA,CArCD","sourcesContent":["/**\n * External dependencies\n */\nimport MicroModal from 'micromodal';\n\n// Responsive navigation toggle.\nfunction navigationToggleModal( modal ) {\n\tconst triggerButton = document.querySelector(\n\t\t`button[data-micromodal-trigger=\"${ modal.id }\"]`\n\t);\n\tconst closeButton = modal.querySelector( 'button[data-micromodal-close]' );\n\t// Use aria-hidden to determine the status of the modal, as this attribute is\n\t// managed by micromodal.\n\tconst isHidden = 'true' === modal.getAttribute( 'aria-hidden' );\n\ttriggerButton.setAttribute( 'aria-expanded', ! isHidden );\n\tcloseButton.setAttribute( 'aria-expanded', ! isHidden );\n\tmodal.classList.toggle( 'has-modal-open', ! isHidden );\n\n\t// Add a class to indicate the modal is open.\n\tconst htmlElement = document.documentElement;\n\thtmlElement.classList.toggle( 'has-modal-open' );\n}\n\n// Open on click functionality.\nfunction closeSubmenus( element ) {\n\telement\n\t\t.querySelectorAll( '[aria-expanded=\"true\"]' )\n\t\t.forEach( function ( toggle ) {\n\t\t\ttoggle.setAttribute( 'aria-expanded', 'false' );\n\t\t} );\n}\n\nfunction toggleSubmenuOnClick( event ) {\n\tconst buttonToggle = event.target.closest( '[aria-expanded]' );\n\tconst isSubmenuOpen = buttonToggle.getAttribute( 'aria-expanded' );\n\n\tif ( isSubmenuOpen === 'true' ) {\n\t\tcloseSubmenus( buttonToggle.closest( '.wp-block-navigation-item' ) );\n\t} else {\n\t\t// Close all sibling submenus.\n\t\tconst parentElement = buttonToggle.closest(\n\t\t\t'.wp-block-navigation-item'\n\t\t);\n\t\tconst navigationParent = buttonToggle.closest(\n\t\t\t'.wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list'\n\t\t);\n\t\tnavigationParent\n\t\t\t.querySelectorAll( '.wp-block-navigation-item' )\n\t\t\t.forEach( function ( child ) {\n\t\t\t\tif ( child !== parentElement ) {\n\t\t\t\t\tcloseSubmenus( child );\n\t\t\t\t}\n\t\t\t} );\n\t\t// Open submenu.\n\t\tbuttonToggle.setAttribute( 'aria-expanded', 'true' );\n\t}\n}\n\n// Necessary for some themes such as TT1 Blocks, where\n// scripts could be loaded before the body.\nwindow.onload = () => {\n\tMicroModal.init( {\n\t\tonShow: navigationToggleModal,\n\t\tonClose: navigationToggleModal,\n\t\topenClass: 'is-menu-open',\n\t} );\n\n\tconst submenuButtons = document.querySelectorAll(\n\t\t'.wp-block-navigation-submenu__toggle'\n\t);\n\n\tsubmenuButtons.forEach( function ( button ) {\n\t\tbutton.addEventListener( 'click', toggleSubmenuOnClick );\n\t} );\n\n\t// Close on click outside.\n\tdocument.addEventListener( 'click', function ( event ) {\n\t\tconst navigationBlocks = document.querySelectorAll(\n\t\t\t'.wp-block-navigation'\n\t\t);\n\t\tnavigationBlocks.forEach( function ( block ) {\n\t\t\tif ( ! block.contains( event.target ) ) {\n\t\t\t\tcloseSubmenus( block );\n\t\t\t}\n\t\t} );\n\t} );\n\t// Close on focus outside.\n\tdocument.addEventListener( 'keyup', function ( event ) {\n\t\tconst submenuBlocks = document.querySelectorAll(\n\t\t\t'.wp-block-navigation-item.has-child'\n\t\t);\n\t\tsubmenuBlocks.forEach( function ( block ) {\n\t\t\tif ( ! block.contains( event.target ) ) {\n\t\t\t\tcloseSubmenus( block );\n\t\t\t}\n\t\t} );\n\t} );\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/view.js"],"names":["navigationToggleModal","modal","triggerButton","document","querySelector","id","closeButton","isHidden","getAttribute","setAttribute","classList","toggle","htmlElement","documentElement","closeSubmenus","element","querySelectorAll","forEach","toggleSubmenuOnClick","event","buttonToggle","target","closest","isSubmenuOpen","parentElement","navigationParent","child","window","addEventListener","MicroModal","init","onShow","onClose","openClass","submenuButtons","button","navigationBlocks","block","contains","submenuBlocks"],"mappings":";;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AACvC,QAAMC,aAAa,GAAGC,QAAQ,CAACC,aAAT,CACpB,mCAAmCH,KAAK,CAACI,EAAI,IADzB,CAAtB;AAGA,QAAMC,WAAW,GAAGL,KAAK,CAACG,aAAN,CAAqB,+BAArB,CAApB,CAJuC,CAKvC;AACA;;AACA,QAAMG,QAAQ,GAAG,WAAWN,KAAK,CAACO,YAAN,CAAoB,aAApB,CAA5B;AACAN,EAAAA,aAAa,CAACO,YAAd,CAA4B,eAA5B,EAA6C,CAAEF,QAA/C;AACAD,EAAAA,WAAW,CAACG,YAAZ,CAA0B,eAA1B,EAA2C,CAAEF,QAA7C;AACAN,EAAAA,KAA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AChBC,IAAAA,MAAM,EAAE/B,qBADQ;AAEhBgC,IAAAA,OAAO,EAAEhC,qBAFO;AAGhBiC,IAAAA,SAAS,EAAE;AAHK,GAAjB;;AAMA,QAAMC,cAAc,GAAG/B,QAAQ,CAACa,gBAAT,CACtB,sCADsB,CAAvB;AAIAkB,EAAAA,cAAc,CAACjB,OAAf,CAAwB,UAAWkB,MAAX,EAAoB;AAC3CA,IAAAA,MAAM,CAACP,gBAAP,CAAyB,OAAzB,EAAkCV,oBAAlC;AACA,GAFD,EAXsC,CAetC;;AACAf,EAAAA,QAAQ,CAACyB,gBAAT,CAA2B,OAA3B,EAAoC,UAAWT,KAAX,EAAmB;AACtD,UAAMiB,gBAAgB,GAAGjC,QAAQ,CAACa,gBAAT,CACxB,sBADwB,CAAzB;AAGAoB,IAAAA,gBAAgB,CAACnB,OAAjB,CAA0B,UAAWoB,KAAX,EAAmB;AAC5C,UAAK,CAAEA,KAAK,CAACC,QAAN,CAAgBnB,KAAK,CAACE,MAAtB,CAAP,EAAwC;AACvCP,QAAAA,aAAa,CAAEuB,KAAF,CAAb;AACA;AACD,KAJD;AAKA,GATD,EAhBsC,CA0BtC;;AACAlC,EAAAA,QAAQ,CAACyB,gBAAT,CAA2B,OAA3B,EAAoC,UAAWT,KAAX,EAAmB;AACtD,UAAMoB,aAAa,GAAGpC,QAAQ,CAACa,gBAAT,CACrB,qCADqB,CAAtB;AAGAuB,IAAAA,aAAa,CAACtB,OAAd,CAAuB,UAAWoB,KAAX,EAAmB;AACzC,UAAK,CAAEA,KAAK,CAACC,QAAN,CAAgBnB,KAAK,CAACE,MAAtB,CAAP,EAAwC;AACvCP,QAAAA,aAAa,CAAEuB,KAAF,CAAb;AACA;AACD,KAJD;AAKA,GATD;AAUA,CArCD","sourcesContent":["/**\n * External dependencies\n */\nimport MicroModal from 'micromodal';\n\n// Responsive navigation toggle.\nfunction navigationToggleModal( modal ) {\n\tconst triggerButton = document.querySelector(\n\t\t`button[data-micromodal-trigger=\"${ modal.id }\"]`\n\t);\n\tconst closeButton = modal.querySelector( 'button[data-micromodal-close]' );\n\t// Use aria-hidden to determine the status of the modal, as this attribute is\n\t// managed by micromodal.\n\tconst isHidden = 'true' === modal.getAttribute( 'aria-hidden' );\n\ttriggerButton.setAttribute( 'aria-expanded', ! isHidden );\n\tcloseButton.setAttribute( 'aria-expanded', ! isHidden );\n\tmodal.classList.toggle( 'has-modal-open', ! isHidden );\n\n\t// Add a class to indicate the modal is open.\n\tconst htmlElement = document.documentElement;\n\thtmlElement.classList.toggle( 'has-modal-open' );\n}\n\n// Open on click functionality.\nfunction closeSubmenus( element ) {\n\telement\n\t\t.querySelectorAll( '[aria-expanded=\"true\"]' )\n\t\t.forEach( function ( toggle ) {\n\t\t\ttoggle.setAttribute( 'aria-expanded', 'false' );\n\t\t} );\n}\n\nfunction toggleSubmenuOnClick( event ) {\n\tconst buttonToggle = event.target.closest( '[aria-expanded]' );\n\tconst isSubmenuOpen = buttonToggle.getAttribute( 'aria-expanded' );\n\n\tif ( isSubmenuOpen === 'true' ) {\n\t\tcloseSubmenus( buttonToggle.closest( '.wp-block-navigation-item' ) );\n\t} else {\n\t\t// Close all sibling submenus.\n\t\tconst parentElement = buttonToggle.closest(\n\t\t\t'.wp-block-navigation-item'\n\t\t);\n\t\tconst navigationParent = buttonToggle.closest(\n\t\t\t'.wp-block-navigation__submenu-container, .wp-block-navigation__container, .wp-block-page-list'\n\t\t);\n\t\tnavigationParent\n\t\t\t.querySelectorAll( '.wp-block-navigation-item' )\n\t\t\t.forEach( function ( child ) {\n\t\t\t\tif ( child !== parentElement ) {\n\t\t\t\t\tcloseSubmenus( child );\n\t\t\t\t}\n\t\t\t} );\n\t\t// Open submenu.\n\t\tbuttonToggle.setAttribute( 'aria-expanded', 'true' );\n\t}\n}\n\n// Necessary for some themes such as TT1 Blocks, where\n// scripts could be loaded before the body.\nwindow.addEventListener( 'load', () => {\n\tMicroModal.init( {\n\t\tonShow: navigationToggleModal,\n\t\tonClose: navigationToggleModal,\n\t\topenClass: 'is-menu-open',\n\t} );\n\n\tconst submenuButtons = document.querySelectorAll(\n\t\t'.wp-block-navigation-submenu__toggle'\n\t);\n\n\tsubmenuButtons.forEach( function ( button ) {\n\t\tbutton.addEventListener( 'click', toggleSubmenuOnClick );\n\t} );\n\n\t// Close on click outside.\n\tdocument.addEventListener( 'click', function ( event ) {\n\t\tconst navigationBlocks = document.querySelectorAll(\n\t\t\t'.wp-block-navigation'\n\t\t);\n\t\tnavigationBlocks.forEach( function ( block ) {\n\t\t\tif ( ! block.contains( event.target ) ) {\n\t\t\t\tcloseSubmenus( block );\n\t\t\t}\n\t\t} );\n\t} );\n\t// Close on focus outside.\n\tdocument.addEventListener( 'keyup', function ( event ) {\n\t\tconst submenuBlocks = document.querySelectorAll(\n\t\t\t'.wp-block-navigation-item.has-child'\n\t\t);\n\t\tsubmenuBlocks.forEach( function ( block ) {\n\t\t\tif ( ! block.contains( event.target ) ) {\n\t\t\t\tcloseSubmenus( block );\n\t\t\t}\n\t\t} );\n\t} );\n} );\n"]}
@@ -553,8 +553,12 @@ function NavigationSubmenuEdit(_ref) {
553
553
  allowedBlocks: ALLOWED_BLOCKS,
554
554
  __experimentalDefaultBlock: DEFAULT_BLOCK,
555
555
  __experimentalDirectInsert: true,
556
+ // Ensure block toolbar is not too far removed from item
557
+ // being edited.
558
+ // see: https://github.com/WordPress/gutenberg/pull/34615.
559
+ __experimentalCaptureToolbars: true,
556
560
  renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasDescendants || // Show the appender while dragging to allow inserting element between item and the appender.
557
- hasDescendants ? _blockEditor.InnerBlocks.DefaultAppender : false
561
+ hasDescendants ? _blockEditor.InnerBlocks.ButtonBlockAppender : false
558
562
  });
559
563
  const ParentElement = openSubmenusOnClick ? 'button' : 'a';
560
564
  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, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation-submenu/edit.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","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","name","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","renderAppender","InnerBlocks","DefaultAppender","ParentElement","linkIcon","displayShortcut","descriptionValue","titleValue","relValue","labelValue","searchTerm","format","mark"],"mappings":";;;;;;;;;;AAgCA;;AA7BA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B,CADM,EAEN;AAAEE,QAAAA,IAAI,EAAE;AAAR,OAFM,CAAP;AAIA,KAvBF;AAwBC,IAAA,aAAa,EAAG,CAAC,CAAE1H,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,EA+EG,CAAEyB,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CAhFF,CAFD,EAuFC,mCAAUoD,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 = [ 'core/navigation-link' ];\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\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.DefaultAppender\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","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","name","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,CAAE,sBAAF,CAAtB;AAEA,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;AACjC;AACAC,MAAAA,eAAe,CAAED,KAAF,CAAf;AACA,KANe,CAQhB;;;AACA,aAASE,aAAT,GAAyB;AACxBN,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;;AAED,aAASK,eAAT,CAA0BD,KAA1B,EAAkC;AACjC;AACA,UAAKN,UAAU,CAACI,OAAX,CAAmBK,QAAnB,CAA6BH,KAAK,CAACI,MAAnC,CAAL,EAAmD;AAClDR,QAAAA,mBAAmB,CAAE,IAAF,CAAnB;AACA,OA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AAsB,EAAG,IAH1B;AAIC,IAAA,oBAAoB,EAAGyC,aAJxB;AAKC,IAAA,gBAAgB,EAAGC,YALpB;AAMC,IAAA,0BAA0B,EAAK2B,UAAF,IAAkB;AAC9C,UAAIC,MAAJ;;AACA,UAAK1H,IAAI,KAAK,MAAd,EAAuB;AACtB;AACA0H,QAAAA,MAAM,GAAG,cACR,oCADQ,CAAT;AAGA,OALD,MAKO;AACN;AACAA,QAAAA,MAAM,GAAG,cACR,oCADQ,CAAT;AAGA;;AACD,aAAO,uCACN,mBAASA,MAAT,EAAiBD,UAAjB,CADM,EAEN;AAAEE,QAAAA,IAAI,EAAE;AAAR,OAFM,CAAP;AAIA,KAvBF;AAwBC,IAAA,aAAa,EAAG,CAAC,CAAE3H,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,EA+EG,CAAEyB,eAAe,IAAIC,mBAArB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,uBAAD,OADD,CAhFF,CAFD,EAuFC,mCAAUoD,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 = [ 'core/navigation-link' ];\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"]}
@@ -50,7 +50,7 @@ const metadata = {
50
50
  link: true
51
51
  }
52
52
  },
53
- style: "wp-block-post-comments"
53
+ style: ["wp-block-post-comments", "wp-block-buttons", "wp-block-button"]
54
54
  };
55
55
  exports.metadata = metadata;
56
56
  const {
@@ -25,7 +25,7 @@ var _deprecated = _interopRequireDefault(require("./deprecated"));
25
25
  const metadata = {
26
26
  apiVersion: 2,
27
27
  name: "core/query-pagination",
28
- title: "Query Pagination",
28
+ title: "Pagination",
29
29
  category: "design",
30
30
  parent: ["core/query"],
31
31
  description: "Displays a paginated navigation to next/previous set of posts, when applicable.",
@@ -21,7 +21,7 @@ var _edit = _interopRequireDefault(require("./edit"));
21
21
  const metadata = {
22
22
  apiVersion: 2,
23
23
  name: "core/query-pagination-next",
24
- title: "Query Pagination Next",
24
+ title: "Next Page",
25
25
  category: "design",
26
26
  parent: ["core/query-pagination"],
27
27
  description: "Displays the next posts page link.",
@@ -37,7 +37,7 @@ const metadata = {
37
37
  html: false,
38
38
  color: {
39
39
  gradients: true,
40
- link: true
40
+ text: false
41
41
  },
42
42
  typography: {
43
43
  fontSize: true,
@@ -21,7 +21,7 @@ var _edit = _interopRequireDefault(require("./edit"));
21
21
  const metadata = {
22
22
  apiVersion: 2,
23
23
  name: "core/query-pagination-numbers",
24
- title: "Query Pagination Numbers",
24
+ title: "Page Numbers",
25
25
  category: "design",
26
26
  parent: ["core/query-pagination"],
27
27
  description: "Displays a list of page numbers for pagination",
@@ -21,7 +21,7 @@ var _edit = _interopRequireDefault(require("./edit"));
21
21
  const metadata = {
22
22
  apiVersion: 2,
23
23
  name: "core/query-pagination-previous",
24
- title: "Query Pagination Previous",
24
+ title: "Previous Page",
25
25
  category: "design",
26
26
  parent: ["core/query-pagination"],
27
27
  description: "Displays the previous posts page link.",
@@ -37,7 +37,7 @@ const metadata = {
37
37
  html: false,
38
38
  color: {
39
39
  gradients: true,
40
- link: true
40
+ text: false
41
41
  },
42
42
  typography: {
43
43
  fontSize: true,
@@ -21,6 +21,7 @@ const SeparatorSettings = _ref => {
21
21
  } = _ref;
22
22
  return (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_blockEditor.PanelColorSettings, {
23
23
  __experimentalHasMultipleOrigins: true,
24
+ __experimentalIsRenderedInSidebar: true,
24
25
  title: (0, _i18n.__)('Color'),
25
26
  colorSettings: [{
26
27
  value: color.color,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/separator-settings.js"],"names":["SeparatorSettings","color","setColor","value","onChange","label"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF;AAAA,SACzB,4BAAC,8BAAD,QACC,4BAAC,+BAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,aAAa,EAAG,CACf;AACCC,MAAAA,KAAK,EAAEF,KAAK,CAACA,KADd;AAECG,MAAAA,QAAQ,EAAEF,QAFX;AAGCG,MAAAA,KAAK,EAAE,cAAI,OAAJ;AAHR,KADe;AAHjB,IADD,CADyB;AAAA,CAA1B;;eAgBeL,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, PanelColorSettings } from '@wordpress/block-editor';\n\nconst SeparatorSettings = ( { color, setColor } ) => (\n\t<InspectorControls>\n\t\t<PanelColorSettings\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tcolorSettings={ [\n\t\t\t\t{\n\t\t\t\t\tvalue: color.color,\n\t\t\t\t\tonChange: setColor,\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t},\n\t\t\t] }\n\t\t></PanelColorSettings>\n\t</InspectorControls>\n);\n\nexport default SeparatorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/separator-settings.js"],"names":["SeparatorSettings","color","setColor","value","onChange","label"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF;AAAA,SACzB,4BAAC,8BAAD,QACC,4BAAC,+BAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,iCAAiC,MAFlC;AAGC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAHT;AAIC,IAAA,aAAa,EAAG,CACf;AACCC,MAAAA,KAAK,EAAEF,KAAK,CAACA,KADd;AAECG,MAAAA,QAAQ,EAAEF,QAFX;AAGCG,MAAAA,KAAK,EAAE,cAAI,OAAJ;AAHR,KADe;AAJjB,IADD,CADyB;AAAA,CAA1B;;eAiBeL,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, PanelColorSettings } from '@wordpress/block-editor';\n\nconst SeparatorSettings = ( { color, setColor } ) => (\n\t<InspectorControls>\n\t\t<PanelColorSettings\n\t\t\t__experimentalHasMultipleOrigins\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\ttitle={ __( 'Color' ) }\n\t\t\tcolorSettings={ [\n\t\t\t\t{\n\t\t\t\t\tvalue: color.color,\n\t\t\t\t\tonChange: setColor,\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t},\n\t\t\t] }\n\t\t></PanelColorSettings>\n\t</InspectorControls>\n);\n\nexport default SeparatorSettings;\n"]}
@@ -151,6 +151,7 @@ function SocialLinksEdit(props) {
151
151
  })
152
152
  })), (0, _element.createElement)(_blockEditor.PanelColorSettings, {
153
153
  __experimentalHasMultipleOrigins: true,
154
+ __experimentalIsRenderedInSidebar: true,
154
155
  title: (0, _i18n.__)('Color'),
155
156
  colorSettings: [{
156
157
  // Use custom attribute as fallback to prevent loss of named color selection when
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","check","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;;;;;;;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AG,cAAI,OAAJ,CAFT;AAGC,IAAA,aAAa,EAAG,CACf;AACC;AACA;AACAhB,MAAAA,KAAK,EAAES,SAAS,CAACkB,KAAV,IAAmBZ,cAH3B;AAIC0B,MAAAA,QAAQ,EAAIC,UAAF,IAAkB;AAC3B7B,QAAAA,YAAY,CAAE6B,UAAF,CAAZ;AACA/B,QAAAA,aAAa,CAAE;AAAEI,UAAAA,cAAc,EAAE2B;AAAlB,SAAF,CAAb;AACA,OAPF;AAQCC,MAAAA,KAAK,EAAE,cAAI,YAAJ;AARR,KADe,EAWf,CAAEvB,SAAF,IAAe;AACd;AACA;AACApB,MAAAA,KAAK,EACJQ,mBAAmB,CAACmB,KAApB,IACAb,wBALa;AAMd2B,MAAAA,QAAQ,EAAIC,UAAF,IAAkB;AAC3B9B,QAAAA,sBAAsB,CAAE8B,UAAF,CAAtB;AACA/B,QAAAA,aAAa,CAAE;AACdG,UAAAA,wBAAwB,EAAE4B;AADZ,SAAF,CAAb;AAGA,OAXa;AAYdC,MAAAA,KAAK,EAAE,cAAI,uBAAJ;AAZO,KAXA;AAHjB,IAVD,EAwCG,CAAEvB,SAAF,IACD,4BAAC,4BAAD;AAEEwB,IAAAA,SAAS,EAAE7B,cAFb;AAGE8B,IAAAA,eAAe,EAAE/B,wBAHnB;AAKC,IAAA,WAAW,EAAG;AALf,IAzCF,CAtCD,EAwFC,kCAASe,gBAAT,CAxFD,CADD;AA4FA;;AAED,MAAMiB,mBAAmB,GAAG;AAC3BrC,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;;eAKe,6BAAYsC,mBAAZ,EAAmCzC,eAAnC,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\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<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","size","layout","usedLayout","logosOnly","className","indexOf","undefined","customIconBackgroundColor","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","onClose","map","entry","check","onChange","colorValue","label","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AASA;;AAOA;;AACA;;AA3BA;AACA;AACA;;AAGA;AACA;AACA;AAsBA,MAAMA,cAAc,GAAG,CAAE,kBAAF,CAAvB;AAEA,MAAMC,WAAW,GAAG,CACnB;AAAEC,EAAAA,IAAI,EAAE,cAAI,OAAJ,CAAR;AAAuBC,EAAAA,KAAK,EAAE;AAA9B,CADmB,EAEnB;AAAED,EAAAA,IAAI,EAAE,cAAI,QAAJ,CAAR;AAAwBC,EAAAA,KAAK,EAAE;AAA/B,CAFmB,EAGnB;AAAED,EAAAA,IAAI,EAAE,cAAI,OAAJ,CAAR;AAAuBC,EAAAA,KAAK,EAAE;AAA9B,CAHmB,EAInB;AAAED,EAAAA,IAAI,EAAE,cAAI,MAAJ,CAAR;AAAsBC,EAAAA,KAAK,EAAE;AAA7B,CAJmB,CAApB;;AAOA,MAAMC,qBAAqB,GAAKC,eAAF,IAAuB;AACpD,QAAMC,wBAAwB,GAAG,6BAChCD,eADgC,EAEhC,sBAFgC,CAAjC;AAIA,SAAOC,wBAAP,aAAOA,wBAAP,uBAAOA,wBAAwB,CAAEC,OAAjC;AACA,CAND;;AAQO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AAAA;;AACxC,QAAM;AACLP,IAAAA,IADK;AAELQ,IAAAA,UAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA,UALK;AAMLC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AASe,gBAAT,CAzFD,CADD;AA6FA;;AAED,MAAMiB,mBAAmB,GAAG;AAC3BrC,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;;eAKe,6BAAYsC,mBAAZ,EAAmCzC,eAAnC,C","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { Fragment, useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\tPanelColorSettings,\n\twithColors,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\t// Remove icon background color if logos only style selected.\n\tconst logosOnly =\n\t\tattributes.className?.indexOf( 'is-style-logos-only' ) >= 0;\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-social-link\"></div>\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\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<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelColorSettings\n\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\t\tcolorSettings={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t! logosOnly && {\n\t\t\t\t\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t\t\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\t\ticonBackgroundColor.color ||\n\t\t\t\t\t\t\t\ticonBackgroundColorValue,\n\t\t\t\t\t\t\tonChange: ( colorValue ) => {\n\t\t\t\t\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: __( 'Icon background color' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</Fragment>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
@@ -441,6 +441,7 @@ function CoverEdit(_ref5) {
441
441
  })
442
442
  }, __('Clear Media')))), createElement(PanelColorGradientSettings, {
443
443
  __experimentalHasMultipleOrigins: true,
444
+ __experimentalIsRenderedInSidebar: true,
444
445
  title: __('Overlay'),
445
446
  initialOpen: true,
446
447
  settings: [{