@wordpress/block-library 9.12.1-next.082ed6819.0 → 9.13.1-next.a9f418477.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +2 -29
  3. package/build/block/edit.js.map +1 -1
  4. package/build/cover/edit/index.js +4 -2
  5. package/build/cover/edit/index.js.map +1 -1
  6. package/build/cover/edit/inspector-controls.js +6 -4
  7. package/build/cover/edit/inspector-controls.js.map +1 -1
  8. package/build/form/index.js +1 -2
  9. package/build/form/index.js.map +1 -1
  10. package/build/form/view.js +10 -5
  11. package/build/form/view.js.map +1 -1
  12. package/build/list-item/hooks/use-merge.js +2 -2
  13. package/build/list-item/hooks/use-merge.js.map +1 -1
  14. package/build/navigation/edit/deleted-navigation-warning.js +9 -2
  15. package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
  16. package/build/navigation-link/edit.js +1 -2
  17. package/build/navigation-link/edit.js.map +1 -1
  18. package/build/navigation-submenu/edit.js +3 -1
  19. package/build/navigation-submenu/edit.js.map +1 -1
  20. package/build/pattern/recursion-detector.js +0 -1
  21. package/build/pattern/recursion-detector.js.map +1 -1
  22. package/build/query/edit/index.js +2 -2
  23. package/build/query/edit/index.js.map +1 -1
  24. package/build/query/edit/inspector-controls/author-control.js +0 -1
  25. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  26. package/build/query/edit/inspector-controls/parent-control.js +0 -1
  27. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  28. package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
  29. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  30. package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
  31. package/build/query/edit/pattern-selection.js.map +1 -0
  32. package/build/query/edit/query-content.js +5 -8
  33. package/build/query/edit/query-content.js.map +1 -1
  34. package/build/query/edit/query-placeholder.js +5 -11
  35. package/build/query/edit/query-placeholder.js.map +1 -1
  36. package/build/query/edit/query-toolbar.js +31 -11
  37. package/build/query/edit/query-toolbar.js.map +1 -1
  38. package/build/separator/deprecated.js +2 -1
  39. package/build/separator/deprecated.js.map +1 -1
  40. package/build/separator/edit.js +29 -4
  41. package/build/separator/edit.js.map +1 -1
  42. package/build/separator/index.js +5 -0
  43. package/build/separator/index.js.map +1 -1
  44. package/build/separator/save.js +3 -2
  45. package/build/separator/save.js.map +1 -1
  46. package/build/social-link/edit.js +35 -1
  47. package/build/social-link/edit.js.map +1 -1
  48. package/build/social-link/index.js +4 -2
  49. package/build/social-link/index.js.map +1 -1
  50. package/build/template-part/edit/import-controls.js +0 -1
  51. package/build/template-part/edit/import-controls.js.map +1 -1
  52. package/build-module/block/edit.js +3 -30
  53. package/build-module/block/edit.js.map +1 -1
  54. package/build-module/cover/edit/index.js +4 -2
  55. package/build-module/cover/edit/index.js.map +1 -1
  56. package/build-module/cover/edit/inspector-controls.js +6 -4
  57. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  58. package/build-module/form/index.js +1 -2
  59. package/build-module/form/index.js.map +1 -1
  60. package/build-module/form/view.js +10 -5
  61. package/build-module/form/view.js.map +1 -1
  62. package/build-module/list-item/hooks/use-merge.js +2 -2
  63. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  64. package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
  65. package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
  66. package/build-module/navigation-link/edit.js +1 -2
  67. package/build-module/navigation-link/edit.js.map +1 -1
  68. package/build-module/navigation-submenu/edit.js +3 -1
  69. package/build-module/navigation-submenu/edit.js.map +1 -1
  70. package/build-module/pattern/recursion-detector.js +0 -1
  71. package/build-module/pattern/recursion-detector.js.map +1 -1
  72. package/build-module/query/edit/index.js +1 -1
  73. package/build-module/query/edit/index.js.map +1 -1
  74. package/build-module/query/edit/inspector-controls/author-control.js +0 -1
  75. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  76. package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
  77. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  78. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
  79. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  80. package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
  81. package/build-module/query/edit/pattern-selection.js.map +1 -0
  82. package/build-module/query/edit/query-content.js +5 -8
  83. package/build-module/query/edit/query-content.js.map +1 -1
  84. package/build-module/query/edit/query-placeholder.js +6 -12
  85. package/build-module/query/edit/query-placeholder.js.map +1 -1
  86. package/build-module/query/edit/query-toolbar.js +31 -13
  87. package/build-module/query/edit/query-toolbar.js.map +1 -1
  88. package/build-module/separator/deprecated.js +2 -1
  89. package/build-module/separator/deprecated.js.map +1 -1
  90. package/build-module/separator/edit.js +32 -7
  91. package/build-module/separator/edit.js.map +1 -1
  92. package/build-module/separator/index.js +5 -0
  93. package/build-module/separator/index.js.map +1 -1
  94. package/build-module/separator/save.js +3 -2
  95. package/build-module/separator/save.js.map +1 -1
  96. package/build-module/social-link/edit.js +37 -3
  97. package/build-module/social-link/edit.js.map +1 -1
  98. package/build-module/social-link/index.js +4 -2
  99. package/build-module/social-link/index.js.map +1 -1
  100. package/build-module/template-part/edit/import-controls.js +0 -1
  101. package/build-module/template-part/edit/import-controls.js.map +1 -1
  102. package/build-style/button/style-rtl.css +3 -3
  103. package/build-style/button/style.css +3 -3
  104. package/build-style/comments/editor-rtl.css +1 -1
  105. package/build-style/comments/editor.css +1 -1
  106. package/build-style/comments/style-rtl.css +1 -1
  107. package/build-style/comments/style.css +1 -1
  108. package/build-style/comments-pagination/editor-rtl.css +1 -0
  109. package/build-style/comments-pagination/editor.css +1 -0
  110. package/build-style/comments-pagination/style-rtl.css +1 -0
  111. package/build-style/comments-pagination/style.css +1 -0
  112. package/build-style/common-rtl.css +17 -17
  113. package/build-style/common.css +17 -17
  114. package/build-style/editor-rtl.css +76 -41
  115. package/build-style/editor.css +76 -41
  116. package/build-style/gallery/style-rtl.css +2 -2
  117. package/build-style/gallery/style.css +2 -2
  118. package/build-style/heading/style-rtl.css +11 -11
  119. package/build-style/heading/style.css +11 -11
  120. package/build-style/image/style-rtl.css +4 -3
  121. package/build-style/image/style.css +4 -3
  122. package/build-style/latest-comments/style-rtl.css +4 -4
  123. package/build-style/latest-comments/style.css +4 -4
  124. package/build-style/latest-posts/style-rtl.css +2 -1
  125. package/build-style/latest-posts/style.css +2 -1
  126. package/build-style/more/editor-rtl.css +1 -1
  127. package/build-style/more/editor.css +1 -1
  128. package/build-style/nextpage/editor-rtl.css +1 -1
  129. package/build-style/nextpage/editor.css +1 -1
  130. package/build-style/post-comments-form/style-rtl.css +2 -2
  131. package/build-style/post-comments-form/style.css +2 -2
  132. package/build-style/post-featured-image/editor-rtl.css +27 -27
  133. package/build-style/post-featured-image/editor.css +27 -27
  134. package/build-style/pullquote/style-rtl.css +1 -0
  135. package/build-style/pullquote/style.css +1 -0
  136. package/build-style/query/editor-rtl.css +30 -0
  137. package/build-style/query/editor.css +30 -0
  138. package/build-style/read-more/style-rtl.css +2 -2
  139. package/build-style/read-more/style.css +2 -2
  140. package/build-style/social-link/editor-rtl.css +6 -2
  141. package/build-style/social-link/editor.css +6 -2
  142. package/build-style/social-links/editor-rtl.css +2 -2
  143. package/build-style/social-links/editor.css +2 -2
  144. package/build-style/social-links/style-rtl.css +2 -2
  145. package/build-style/social-links/style.css +2 -2
  146. package/build-style/style-rtl.css +55 -51
  147. package/build-style/style.css +55 -51
  148. package/build-style/text-columns/style-rtl.css +3 -3
  149. package/build-style/text-columns/style.css +3 -3
  150. package/build-types/lock-unlock.d.ts +1 -1
  151. package/build-types/lock-unlock.d.ts.map +1 -1
  152. package/package.json +35 -34
  153. package/src/block/edit.js +6 -51
  154. package/src/comments-pagination/editor.scss +1 -0
  155. package/src/comments-pagination/style.scss +1 -0
  156. package/src/cover/edit/index.js +4 -1
  157. package/src/cover/edit/inspector-controls.js +10 -3
  158. package/src/cover/index.php +2 -2
  159. package/src/form/block.json +1 -2
  160. package/src/form/index.php +1 -20
  161. package/src/form/view.js +18 -5
  162. package/src/image/style.scss +4 -3
  163. package/src/latest-posts/style.scss +2 -1
  164. package/src/list-item/hooks/use-merge.js +2 -2
  165. package/src/missing/test/edit.native.js +0 -1
  166. package/src/navigation/README.md +1 -0
  167. package/src/navigation/edit/deleted-navigation-warning.js +11 -2
  168. package/src/navigation/index.php +9 -35
  169. package/src/navigation-link/edit.js +0 -6
  170. package/src/navigation-submenu/edit.js +5 -6
  171. package/src/navigation-submenu/index.php +17 -1
  172. package/src/pullquote/style.scss +1 -0
  173. package/src/query/edit/index.js +1 -1
  174. package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
  175. package/src/query/edit/query-content.js +4 -10
  176. package/src/query/edit/query-placeholder.js +5 -14
  177. package/src/query/edit/query-toolbar.js +38 -17
  178. package/src/query/editor.scss +30 -0
  179. package/src/search/index.php +3 -3
  180. package/src/separator/block.json +5 -0
  181. package/src/separator/deprecated.js +1 -0
  182. package/src/separator/edit.js +28 -3
  183. package/src/separator/save.js +2 -2
  184. package/src/separator/test/edit.js +1 -0
  185. package/src/social-link/block.json +4 -2
  186. package/src/social-link/edit.js +40 -0
  187. package/src/social-link/editor.scss +5 -0
  188. package/tsconfig.tsbuildinfo +1 -1
  189. package/build/query/edit/pattern-selection-modal.js.map +0 -1
  190. package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_utils","_jsxRuntime","QueryToolbar","openPatternSelectionModal","name","clientId","hasPatterns","usePatterns","length","jsx","Fragment","children","ToolbarGroup","className","ToolbarButton","onClick","__"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { usePatterns } from '../utils';\n\nexport default function QueryToolbar( {\n\topenPatternSelectionModal,\n\tname,\n\tclientId,\n} ) {\n\tconst hasPatterns = !! usePatterns( clientId, name ).length;\n\n\treturn (\n\t\t<>\n\t\t\t{ hasPatterns && (\n\t\t\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t\t\t<ToolbarButton onClick={ openPatternSelectionModal }>\n\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAAuC,IAAAG,WAAA,GAAAH,OAAA;AATvC;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,YAAYA,CAAE;EACrCC,yBAAyB;EACzBC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CAAC,CAAE,IAAAC,kBAAW,EAAEF,QAAQ,EAAED,IAAK,CAAC,CAACI,MAAM;EAE3D,oBACC,IAAAP,WAAA,CAAAQ,GAAA,EAAAR,WAAA,CAAAS,QAAA;IAAAC,QAAA,EACGL,WAAW,iBACZ,IAAAL,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAe,YAAY;MAACC,SAAS,EAAC,6CAA6C;MAAAF,QAAA,eACpE,IAAAV,WAAA,CAAAQ,GAAA,EAACZ,WAAA,CAAAiB,aAAa;QAACC,OAAO,EAAGZ,yBAA2B;QAAAQ,QAAA,EACjD,IAAAK,QAAE,EAAE,SAAU;MAAC,CACH;IAAC,CACH;EACd,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_patternSelection","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","QueryToolbar","clientId","attributes","hasPatterns","useBlockPatterns","length","jsx","ToolbarGroup","className","children","__experimentalDropdownContentWrapper","Dropdown","contentClassName","focusOnMount","expandOnMobile","renderToggle","isOpen","onToggle","ToolbarButton","onClick","__","renderContent","showSearch","showTitlesAsTooltip"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternSelection, { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryToolbar( { clientId, attributes } ) {\n\tconst hasPatterns = useBlockPatterns( clientId, attributes ).length;\n\tif ( ! hasPatterns ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t<DropdownContentWrapper>\n\t\t\t\t<Dropdown\n\t\t\t\t\tcontentClassName=\"block-editor-block-settings-menu__popover\"\n\t\t\t\t\tfocusOnMount=\"firstElement\"\n\t\t\t\t\texpandOnMobile\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Change design' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<PatternSelection\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\tshowSearch={ false }\n\t\t\t\t\t\t\tshowTitlesAsTooltip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71
71
  }
72
- } : undefined
72
+ } : undefined,
73
+ tagName: 'hr'
73
74
  };
74
75
  }
75
76
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;A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,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS;IACJ,CAAC;EACF;AACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,CAAEtB,EAAE,CAAE","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","tagName","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t\ttagName: 'hr',\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,IAAAE,WAAA,GAAAF,OAAA;AAR3E;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP,CAAC;IACDC,WAAW,EAAE;MACZD,IAAI,EAAE;IACP;EACD,CAAC;EACDE,IAAIA,CAAE;IAAEJ;EAAW,CAAC,EAAG;IACtB,MAAM;MAAEC,KAAK;MAAEE;IAAY,CAAC,GAAGH,UAAU;;IAEzC;IACA;IACA,MAAMK,eAAe,GAAG,IAAAC,8BAAiB,EAAE,kBAAkB,EAAEL,KAAM,CAAC;IACtE;IACA;IACA,MAAMM,UAAU,GAAG,IAAAD,8BAAiB,EAAE,OAAO,EAAEL,KAAM,CAAC;IAEtD,MAAMO,SAAS,GAAG,IAAAC,aAAI,EAAE;MACvB,+BAA+B,EAAER,KAAK,IAAIE,WAAW;MACrD,CAAEE,eAAe,GAAIA,eAAe;MACpC,CAAEE,UAAU,GAAIA;IACjB,CAAE,CAAC;IAEH,MAAMG,KAAK,GAAG;MACbC,eAAe,EAAEN,eAAe,GAAGO,SAAS,GAAGT,WAAW;MAC1DF,KAAK,EAAEM,UAAU,GAAGK,SAAS,GAAGT;IACjC,CAAC;IAED,oBAAO,IAAAL,WAAA,CAAAe,GAAA;MAAA,GAASC,0BAAa,CAACV,IAAI,CAAE;QAAEI,SAAS;QAAEE;MAAM,CAAE;IAAC,CAAI,CAAC;EAChE,CAAC;EACDK,OAAOA,CAAEf,UAAU,EAAG;IACrB,MAAM;MAAEC,KAAK;MAAEE,WAAW;MAAE,GAAGa;IAAe,CAAC,GAAGhB,UAAU;IAC5D,OAAO;MACN,GAAGgB,cAAc;MACjBL,eAAe,EAAEV,KAAK,GAAGA,KAAK,GAAGW,SAAS;MAC1CK,OAAO,EAAE,KAAK;MACdP,KAAK,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS,SAAS;MACZO,OAAO,EAAE;IACV,CAAC;EACF;AACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,CAAEvB,EAAE,CAAE","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.default = SeparatorEdit;
8
8
  var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _components = require("@wordpress/components");
10
10
  var _blockEditor = require("@wordpress/block-editor");
11
+ var _i18n = require("@wordpress/i18n");
11
12
  var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
@@ -22,6 +23,9 @@ var _jsxRuntime = require("react/jsx-runtime");
22
23
  * Internal dependencies
23
24
  */
24
25
 
26
+ const htmlElementMessages = {
27
+ div: (0, _i18n.__)('The <div> element should only be used if the separator is a design element that should not be announced.')
28
+ };
25
29
  function SeparatorEdit({
26
30
  attributes,
27
31
  setAttributes
@@ -29,7 +33,8 @@ function SeparatorEdit({
29
33
  const {
30
34
  backgroundColor,
31
35
  opacity,
32
- style
36
+ style,
37
+ tagName
33
38
  } = attributes;
34
39
  const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
35
40
  const currentColor = colorProps?.style?.backgroundColor;
@@ -49,13 +54,33 @@ function SeparatorEdit({
49
54
  color: currentColor,
50
55
  backgroundColor: currentColor
51
56
  };
52
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
53
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.HorizontalRule, {
57
+ const Wrapper = tagName === 'hr' ? _components.HorizontalRule : tagName;
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
60
+ group: "advanced",
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
62
+ __nextHasNoMarginBottom: true,
63
+ __next40pxDefaultSize: true,
64
+ label: (0, _i18n.__)('HTML element'),
65
+ options: [{
66
+ label: (0, _i18n.__)('Default (<hr>)'),
67
+ value: 'hr'
68
+ }, {
69
+ label: '<div>',
70
+ value: 'div'
71
+ }],
72
+ value: tagName,
73
+ onChange: value => setAttributes({
74
+ tagName: value
75
+ }),
76
+ help: htmlElementMessages[tagName]
77
+ })
78
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
54
79
  ...(0, _blockEditor.useBlockProps)({
55
80
  className,
56
81
  style: hasCustomColor ? styles : undefined
57
82
  })
58
- })
83
+ })]
59
84
  });
60
85
  }
61
86
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_useDeprecatedOpacity","_jsxRuntime","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","jsx","Fragment","children","HorizontalRule","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HorizontalRule\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AASA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA4D,IAAAI,WAAA,GAAAJ,OAAA;AAlB5D;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGe,SAASK,aAAaA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,EAAG;EACtE,MAAM;IAAEC,eAAe;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGJ,UAAU;EACtD,MAAMK,UAAU,GAAG,IAAAC,wCAAa,EAAEN,UAAW,CAAC;EAC9C,MAAMO,YAAY,GAAGF,UAAU,EAAED,KAAK,EAAEF,eAAe;EACvD,MAAMM,cAAc,GAAG,CAAC,CAAEJ,KAAK,EAAEK,KAAK,EAAEC,UAAU;EAElD,IAAAC,6BAAoB,EAAER,OAAO,EAAEI,YAAY,EAAEN,aAAc,CAAC;;EAE5D;EACA;EACA,MAAMW,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEX,eAAgB,CAAC;EAEhE,MAAMY,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEb,eAAe,IAAIK,YAAY;IACjD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAET,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDE,UAAU,CAACS,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdP,KAAK,EAAEF,YAAY;IACnBL,eAAe,EAAEK;EAClB,CAAC;EAED,oBACC,IAAAT,WAAA,CAAAmB,GAAA,EAAAnB,WAAA,CAAAoB,QAAA;IAAAC,QAAA,eACC,IAAArB,WAAA,CAAAmB,GAAA,EAACtB,WAAA,CAAAyB,cAAc;MAAA,GACT,IAAAC,0BAAa,EAAE;QACnBP,SAAS;QACTV,KAAK,EAAEI,cAAc,GAAGQ,MAAM,GAAGM;MAClC,CAAE;IAAC,CACH;EAAC,CACD,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_jsxRuntime","htmlElementMessages","div","__","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule, SelectControl } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nconst htmlElementMessages = {\n\tdiv: __(\n\t\t'The <div> element should only be used if the separator is a design element that should not be announced.'\n\t),\n};\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n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EAC1C,CAAC,EACDG,UAAU,CAACS,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdP,KAAK,EAAEF,YAAY;IACnBN,eAAe,EAAEM;EAClB,CAAC;EACD,MAAMU,OAAO,GAAGb,OAAO,KAAK,IAAI,GAAGc,0BAAc,GAAGd,OAAO;EAE3D,oBACC,IAAAV,WAAA,CAAAyB,IAAA,EAAAzB,WAAA,CAAA0B,QAAA;IAAAC,QAAA,gBACC,IAAA3B,WAAA,CAAA4B,GAAA,EAAC/B,YAAA,CAAAgC,iBAAiB;MAACC,KAAK,EAAC,UAAU;MAAAH,QAAA,eAClC,IAAA3B,WAAA,CAAA4B,GAAA,EAAChC,WAAA,CAAAmC,aAAa;QACbC,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAG,IAAA/B,QAAE,EAAE,cAAe,CAAG;QAC9BgC,OAAO,EAAG,CACT;UAAED,KAAK,EAAE,IAAA/B,QAAE,EAAE,gBAAiB,CAAC;UAAEiC,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEF,KAAK,EAAE,OAAO;UAAEE,KAAK,EAAE;QAAM,CAAC,CAC9B;QACHA,KAAK,EAAG1B,OAAS;QACjB2B,QAAQ,EAAKD,KAAK,IACjB9B,aAAa,CAAE;UAAEI,OAAO,EAAE0B;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGrC,mBAAmB,CAAES,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpB,IAAAV,WAAA,CAAA4B,GAAA,EAACL,OAAO;MAAA,GACF,IAAAgB,0BAAa,EAAE;QACnBnB,SAAS;QACTX,KAAK,EAAEK,cAAc,GAAGQ,MAAM,GAAGkB;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
@@ -30,6 +30,11 @@ const metadata = exports.metadata = {
30
30
  opacity: {
31
31
  type: "string",
32
32
  "default": "alpha-channel"
33
+ },
34
+ tagName: {
35
+ type: "string",
36
+ "enum": ["hr", "div"],
37
+ "default": "hr"
33
38
  }
34
39
  },
35
40
  supports: {
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAO,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,qBAAA;MAAAC,+BAAA;MAAAC,SAAA;MAAAC,UAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAF,UAAA;MAAA;IAAA;IAAAG,OAAA;MAAAC,MAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAAvB,IAAA;IAAAwB,KAAA;IAAAC,SAAA;EAAA;IAAAzB,IAAA;IAAAwB,KAAA;EAAA;IAAAxB,IAAA;IAAAwB,KAAA;EAAA;EAAAE,WAAA;EAAAC,KAAA;AAAA;AAUA,MAAM;EAAE3B;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAM4B,QAAQ,GAAA/B,OAAA,CAAA+B,QAAA,GAAG;EACvBC,IAAI,EAAJA,gBAAI;EACJC,OAAO,EAAE;IACRxB,UAAU,EAAE;MACXyB,WAAW,EAAE,SAAS;MACtBC,SAAS,EAAE;IACZ;EACD,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEtC,IAAI;EAAEJ,QAAQ;EAAEgC;AAAS,CAAE,CAAC;AAAC/B,OAAA,CAAAwC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","tagName","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAO,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAA;MAAA;IAAA;EAAA;EAAAE,QAAA;IAAAC,MAAA;IAAAC,KAAA;IAAAC,KAAA;MAAAC,qBAAA;MAAAC,+BAAA;MAAAC,SAAA;MAAAC,UAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAF,UAAA;MAAA;IAAA;IAAAG,OAAA;MAAAC,MAAA;IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,MAAA;IAAAxB,IAAA;IAAAyB,KAAA;IAAAC,SAAA;EAAA;IAAA1B,IAAA;IAAAyB,KAAA;EAAA;IAAAzB,IAAA;IAAAyB,KAAA;EAAA;EAAAE,WAAA;EAAAC,KAAA;AAAA;AAUA,MAAM;EAAE5B;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAM6B,QAAQ,GAAAhC,OAAA,CAAAgC,QAAA,GAAG;EACvBC,IAAI,EAAJA,gBAAI;EACJC,OAAO,EAAE;IACRzB,UAAU,EAAE;MACX0B,WAAW,EAAE,SAAS;MACtBC,SAAS,EAAE;IACZ;EACD,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEiC;AAAS,CAAE,CAAC;AAAChC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -22,7 +22,8 @@ function separatorSave({
22
22
  const {
23
23
  backgroundColor,
24
24
  style,
25
- opacity
25
+ opacity,
26
+ tagName: Tag
26
27
  } = attributes;
27
28
  const customColor = style?.color?.background;
28
29
  const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes);
@@ -42,7 +43,7 @@ function separatorSave({
42
43
  backgroundColor: colorProps?.style?.backgroundColor,
43
44
  color: colorClass ? undefined : customColor
44
45
  };
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
46
47
  ..._blockEditor.useBlockProps.save({
47
48
  className,
48
49
  style: styles
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <hr { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIiC,IAAAE,WAAA,GAAAF,OAAA;AAZjC;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASG,aAAaA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGH,UAAU;EACtD,MAAMI,WAAW,GAAGF,KAAK,EAAEG,KAAK,EAAEC,UAAU;EAC5C,MAAMC,UAAU,GAAG,IAAAC,mDAAwB,EAAER,UAAW,CAAC;EACzD;EACA;;EAEA;EACA;EACA,MAAMS,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAET,eAAgB,CAAC;EAEhE,MAAMU,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEX,eAAe,IAAIG,WAAW;IAChD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAEN,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDI,UAAU,CAACI,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdZ,eAAe,EAAEM,UAAU,EAAEL,KAAK,EAAED,eAAe;IACnDI,KAAK,EAAEI,UAAU,GAAGK,SAAS,GAAGV;EACjC,CAAC;EACD,oBAAO,IAAAN,WAAA,CAAAiB,GAAA;IAAA,GAASC,0BAAa,CAACC,IAAI,CAAE;MAAEN,SAAS;MAAET,KAAK,EAAEW;IAAO,CAAE;EAAC,CAAI,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","tagName","Tag","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity, tagName: Tag } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <Tag { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIiC,IAAAE,WAAA,GAAAF,OAAA;AAZjC;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASG,aAAaA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC,OAAO;IAAEC,OAAO,EAAEC;EAAI,CAAC,GAAGL,UAAU;EACpE,MAAMM,WAAW,GAAGJ,KAAK,EAAEK,KAAK,EAAEC,UAAU;EAC5C,MAAMC,UAAU,GAAG,IAAAC,mDAAwB,EAAEV,UAAW,CAAC;EACzD;EACA;;EAEA;EACA;EACA,MAAMW,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEX,eAAgB,CAAC;EAEhE,MAAMY,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEb,eAAe,IAAIK,WAAW;IAChD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAER,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDM,UAAU,CAACI,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdd,eAAe,EAAEQ,UAAU,EAAEP,KAAK,EAAED,eAAe;IACnDM,KAAK,EAAEI,UAAU,GAAGK,SAAS,GAAGV;EACjC,CAAC;EACD,oBAAO,IAAAR,WAAA,CAAAmB,GAAA,EAACZ,GAAG;IAAA,GAAMa,0BAAa,CAACC,IAAI,CAAE;MAAEN,SAAS;MAAEX,KAAK,EAAEa;IAAO,CAAE;EAAC,CAAI,CAAC;AACzE","ignoreList":[]}
@@ -116,6 +116,7 @@ const SocialLinkEdit = ({
116
116
  // Use internal state instead of a ref to make sure that the component
117
117
  // re-renders when the popover's anchor updates.
118
118
  const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
119
+ const isContentOnlyMode = (0, _blockEditor.useBlockEditingMode)() === 'contentOnly';
119
120
  const IconComponent = (0, _socialList.getIconBySite)(service);
120
121
  const socialLinkName = (0, _socialList.getNameBySite)(service);
121
122
  // The initial label (ie. the link text) is an empty string.
@@ -136,7 +137,40 @@ const SocialLinkEdit = ({
136
137
  }
137
138
  });
138
139
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
139
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
140
+ children: [isContentOnlyMode && showLabels &&
141
+ /*#__PURE__*/
142
+ // Add an extra control to modify the label attribute when content only mode is active.
143
+ // With content only mode active, the inspector is hidden, so users need another way
144
+ // to edit this attribute.
145
+ (0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
146
+ group: "other",
147
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
148
+ popoverProps: {
149
+ position: 'bottom right'
150
+ },
151
+ renderToggle: ({
152
+ isOpen,
153
+ onToggle
154
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
155
+ onClick: onToggle,
156
+ "aria-haspopup": "true",
157
+ "aria-expanded": isOpen,
158
+ children: (0, _i18n.__)('Text')
159
+ }),
160
+ renderContent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
161
+ __next40pxDefaultSize: true,
162
+ __nextHasNoMarginBottom: true,
163
+ className: "wp-block-social-link__toolbar_content_text",
164
+ label: (0, _i18n.__)('Text'),
165
+ help: (0, _i18n.__)('Provide a text label or use the default.'),
166
+ value: label,
167
+ onChange: value => setAttributes({
168
+ label: value
169
+ }),
170
+ placeholder: socialLinkName
171
+ })
172
+ })
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
140
174
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
141
175
  title: (0, _i18n.__)('Settings'),
142
176
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelRow, {
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_keycodes","_data","_blockEditor","_element","_components","_compose","_i18n","_icons","_socialList","_jsxRuntime","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","clientId","removeBlock","useDispatch","blockEditorStore","jsx","URLPopover","anchor","__","onClose","focus","children","className","onSubmit","event","preventDefault","URLInput","value","onChange","nextURL","placeholder","label","hideLabelFromVision","disableSuggestions","onKeyDown","defaultPrevented","BACKSPACE","DELETE","includes","keyCode","suffix","__experimentalInputControlSuffixWrapper","variant","Button","icon","keyboardReturn","type","size","SocialLinkEdit","attributes","context","isSelected","service","rel","showLabels","iconColor","iconColorValue","iconBackgroundColor","iconBackgroundColorValue","showURLPopover","useState","wrapperClasses","clsx","setPopoverAnchor","IconComponent","getIconBySite","socialLinkName","getNameBySite","socialLinkText","trim","ref","useRef","blockProps","useBlockProps","useMergeRefs","onClick","ENTER","jsxs","Fragment","InspectorControls","PanelBody","title","PanelRow","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","help","group","role","style","color","backgroundColor","_default","exports","default"],"sources":["@wordpress/block-library/src/social-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\n\nimport {\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tButton,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n\tclientId,\n} ) => {\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<URLPopover\n\t\t\tanchor={ popoverAnchor }\n\t\t\taria-label={ __( 'Edit social link' ) }\n\t\t\tonClose={ () => {\n\t\t\t\tsetPopover( false );\n\t\t\t\tpopoverAnchor?.focus();\n\t\t\t} }\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetPopover( false );\n\t\t\t\t\tpopoverAnchor?.focus();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t\t<URLInput\n\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplaceholder={ __( 'Enter social link' ) }\n\t\t\t\t\t\tlabel={ __( 'Enter social link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tdisableSuggestions\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!! url ||\n\t\t\t\t\t\t\t\tevent.defaultPrevented ||\n\t\t\t\t\t\t\t\t! [ BACKSPACE, DELETE ].includes(\n\t\t\t\t\t\t\t\t\tevent.keyCode\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</URLPopover>\n\t);\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tclientId,\n} ) => {\n\tconst { url, service, label = '', rel } = attributes;\n\tconst {\n\t\tshowLabels,\n\t\ticonColor,\n\t\ticonColorValue,\n\t\ticonBackgroundColor,\n\t\ticonBackgroundColorValue,\n\t} = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst wrapperClasses = clsx(\n\t\t'wp-social-link',\n\t\t// Manually adding this class for backwards compatibility of CSS when moving the\n\t\t// blockProps from the li to the button: https://github.com/WordPress/gutenberg/pull/64883\n\t\t'wp-block-social-link',\n\t\t'wp-social-link-' + service,\n\t\t{\n\t\t\t'wp-social-link__is-incomplete': ! url,\n\t\t\t[ `has-${ iconColor }-color` ]: iconColor,\n\t\t\t[ `has-${ iconBackgroundColor }-background-color` ]:\n\t\t\t\ticonBackgroundColor,\n\t\t}\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\t// The initial label (ie. the link text) is an empty string.\n\t// We want to prevent empty links so that the link text always fallbacks to\n\t// the social name, even when users enter and save an empty string or only\n\t// spaces. The PHP render callback fallbacks to the social name as well.\n\tconst socialLinkText = label.trim() === '' ? socialLinkName : label;\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-social-link-anchor',\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonClick: () => setPopover( true ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetPopover( true );\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The text is visible when enabled from the parent Social Icons block.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ socialLinkName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ /*\n\t\t\t * Because the `<ul>` element has a role=document, the `<li>` is\n\t\t\t * not semantically correct, so adding role=presentation is cleaner.\n\t\t\t * https://github.com/WordPress/gutenberg/pull/64883#issuecomment-2472874551\n\t\t\t */ }\n\t\t\t<li\n\t\t\t\trole=\"presentation\"\n\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: iconColorValue,\n\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ /*\n\t\t\t\t * Disable reason: The `button` ARIA role is redundant but\n\t\t\t\t * blockProps has a role of `document` automatically applied\n\t\t\t\t * which breaks the semantics of this button since it removes\n\t\t\t\t * the information about the popover.\n\t\t\t\t */\n\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t<button aria-haspopup=\"dialog\" { ...blockProps } role=\"button\">\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ clsx( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkText }\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t</>\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B,WAAA,CAAAwE,IAAA;QAAQ,iBAAc,QAAQ;QAAA,GAAML,UAAU;QAAGgB,IAAI,EAAC,QAAQ;QAAAnE,QAAA,gBAC7D,IAAAhB,WAAA,CAAAU,GAAA,EAACiD,aAAa,IAAE,CAAC,eACjB,IAAA3D,WAAA,CAAAU,GAAA;UACCO,SAAS,EAAG,IAAAwC,aAAI,EAAE,4BAA4B,EAAE;YAC/C,oBAAoB,EAAE,CAAER;UACzB,CAAE,CAAG;UAAAjC,QAAA,EAEH+C;QAAc,CACX,CAAC;MAAA,CACA,CAAC,EAEPjB,UAAU,IAAIQ,cAAc,iBAC7B,IAAAtD,WAAA,CAAAU,GAAA,EAACT,oBAAoB;QACpBC,GAAG,EAAGA,GAAK;QACXC,aAAa,EAAGA,aAAe;QAC/BC,UAAU,EAAGA,UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACE,CAAC;EAAA,CACJ,CAAC;AAEL,CAAC;AAAC,IAAAiF,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa9C,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_keycodes","_data","_blockEditor","_element","_components","_compose","_i18n","_icons","_socialList","_jsxRuntime","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","clientId","removeBlock","useDispatch","blockEditorStore","jsx","URLPopover","anchor","__","onClose","focus","children","className","onSubmit","event","preventDefault","URLInput","value","onChange","nextURL","placeholder","label","hideLabelFromVision","disableSuggestions","onKeyDown","defaultPrevented","BACKSPACE","DELETE","includes","keyCode","suffix","__experimentalInputControlSuffixWrapper","variant","Button","icon","keyboardReturn","type","size","SocialLinkEdit","attributes","context","isSelected","service","rel","showLabels","iconColor","iconColorValue","iconBackgroundColor","iconBackgroundColorValue","showURLPopover","useState","wrapperClasses","clsx","setPopoverAnchor","isContentOnlyMode","useBlockEditingMode","IconComponent","getIconBySite","socialLinkName","getNameBySite","socialLinkText","trim","ref","useRef","blockProps","useBlockProps","useMergeRefs","onClick","ENTER","jsxs","Fragment","BlockControls","group","Dropdown","popoverProps","position","renderToggle","isOpen","onToggle","ToolbarButton","renderContent","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","help","InspectorControls","PanelBody","title","PanelRow","role","style","color","backgroundColor","_default","exports","default"],"sources":["@wordpress/block-library/src/social-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\n\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockEditingMode,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tButton,\n\tDropdown,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n\tclientId,\n} ) => {\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<URLPopover\n\t\t\tanchor={ popoverAnchor }\n\t\t\taria-label={ __( 'Edit social link' ) }\n\t\t\tonClose={ () => {\n\t\t\t\tsetPopover( false );\n\t\t\t\tpopoverAnchor?.focus();\n\t\t\t} }\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetPopover( false );\n\t\t\t\t\tpopoverAnchor?.focus();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t\t<URLInput\n\t\t\t\t\t\tvalue={ url }\n\t\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplaceholder={ __( 'Enter social link' ) }\n\t\t\t\t\t\tlabel={ __( 'Enter social link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tdisableSuggestions\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!! url ||\n\t\t\t\t\t\t\t\tevent.defaultPrevented ||\n\t\t\t\t\t\t\t\t! [ BACKSPACE, DELETE ].includes(\n\t\t\t\t\t\t\t\t\tevent.keyCode\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</URLPopover>\n\t);\n};\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n\tclientId,\n} ) => {\n\tconst { url, service, label = '', rel } = attributes;\n\tconst {\n\t\tshowLabels,\n\t\ticonColor,\n\t\ticonColorValue,\n\t\ticonBackgroundColor,\n\t\ticonBackgroundColorValue,\n\t} = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst wrapperClasses = clsx(\n\t\t'wp-social-link',\n\t\t// Manually adding this class for backwards compatibility of CSS when moving the\n\t\t// blockProps from the li to the button: https://github.com/WordPress/gutenberg/pull/64883\n\t\t'wp-block-social-link',\n\t\t'wp-social-link-' + service,\n\t\t{\n\t\t\t'wp-social-link__is-incomplete': ! url,\n\t\t\t[ `has-${ iconColor }-color` ]: iconColor,\n\t\t\t[ `has-${ iconBackgroundColor }-background-color` ]:\n\t\t\t\ticonBackgroundColor,\n\t\t}\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\t// The initial label (ie. the link text) is an empty string.\n\t// We want to prevent empty links so that the link text always fallbacks to\n\t// the social name, even when users enter and save an empty string or only\n\t// spaces. The PHP render callback fallbacks to the social name as well.\n\tconst socialLinkText = label.trim() === '' ? socialLinkName : label;\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wp-block-social-link-anchor',\n\t\tref: useMergeRefs( [ setPopoverAnchor, ref ] ),\n\t\tonClick: () => setPopover( true ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetPopover( true );\n\t\t\t}\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ isContentOnlyMode && showLabels && (\n\t\t\t\t// Add an extra control to modify the label attribute when content only mode is active.\n\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t// to edit this attribute.\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tpopoverProps={ { position: 'bottom right' } }\n\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Text' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"wp-block-social-link__toolbar_content_text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Provide a text label or use the default.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tplaceholder={ socialLinkName }\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</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The text is visible when enabled from the parent Social Icons block.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder={ socialLinkName }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ /*\n\t\t\t * Because the `<ul>` element has a role=document, the `<li>` is\n\t\t\t * not semantically correct, so adding role=presentation is cleaner.\n\t\t\t * https://github.com/WordPress/gutenberg/pull/64883#issuecomment-2472874551\n\t\t\t */ }\n\t\t\t<li\n\t\t\t\trole=\"presentation\"\n\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: iconColorValue,\n\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ /*\n\t\t\t\t * Disable reason: The `button` ARIA role is redundant but\n\t\t\t\t * blockProps has a role of `document` automatically applied\n\t\t\t\t * which breaks the semantics of this button since it removes\n\t\t\t\t * the information about the popover.\n\t\t\t\t */\n\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t<button aria-haspopup=\"dialog\" { ...blockProps } role=\"button\">\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ clsx( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkText }\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t</>\n\t);\n};\n\nexport default SocialLinkEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AASA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AAA6D,IAAAU,WAAA,GAAAV,OAAA;AArC7D;AACA;AACA;;AAGA;AACA;AACA;;AA2BA;AACA;AACA;;AAGA,MAAMW,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,aAAa;EACbC,UAAU;EACVC,aAAa;EACbC;AACD,CAAC,KAAM;EACN,MAAM;IAAEC;EAAY,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EACvD,oBACC,IAAAT,WAAA,CAAAU,GAAA,EAACjB,YAAA,CAAAkB,UAAU;IACVC,MAAM,EAAGP,aAAe;IACxB,cAAa,IAAAQ,QAAE,EAAE,kBAAmB,CAAG;IACvCC,OAAO,EAAGA,CAAA,KAAM;MACfV,UAAU,CAAE,KAAM,CAAC;MACnBC,aAAa,EAAEU,KAAK,CAAC,CAAC;IACvB,CAAG;IAA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AAK,EAAG;QACPC,KAAK,EAAE7C,cAAc;QACrB8C,eAAe,EAAE5C;MAClB,CAAG;MAAArC,QAAA,gBASH,IAAAhB,WAAA,CAAA0E,IAAA;QAAQ,iBAAc,QAAQ;QAAA,GAAML,UAAU;QAAGyB,IAAI,EAAC,QAAQ;QAAA9E,QAAA,gBAC7D,IAAAhB,WAAA,CAAAU,GAAA,EAACmD,aAAa,IAAE,CAAC,eACjB,IAAA7D,WAAA,CAAAU,GAAA;UACCO,SAAS,EAAG,IAAAwC,aAAI,EAAE,4BAA4B,EAAE;YAC/C,oBAAoB,EAAE,CAAER;UACzB,CAAE,CAAG;UAAAjC,QAAA,EAEHiD;QAAc,CACX,CAAC;MAAA,CACA,CAAC,EAEPnB,UAAU,IAAIQ,cAAc,iBAC7B,IAAAtD,WAAA,CAAAU,GAAA,EAACT,oBAAoB;QACpBC,GAAG,EAAGA,GAAK;QACXC,aAAa,EAAGA,aAAe;QAC/BC,UAAU,EAAGA,UAAY;QACzBC,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CACD;IAAA,CACE,CAAC;EAAA,CACJ,CAAC;AAEL,CAAC;AAAC,IAAA4F,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazD,cAAc","ignoreList":[]}
@@ -26,13 +26,15 @@ const metadata = exports.metadata = {
26
26
  textdomain: "default",
27
27
  attributes: {
28
28
  url: {
29
- type: "string"
29
+ type: "string",
30
+ role: "content"
30
31
  },
31
32
  service: {
32
33
  type: "string"
33
34
  },
34
35
  label: {
35
- type: "string"
36
+ type: "string",
37
+ role: "content"
36
38
  },
37
39
  rel: {
38
40
  type: "string"
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_variations","metadata","exports","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","url","type","service","label","rel","usesContext","supports","reusable","html","interactivity","clientNavigation","editorStyle","settings","icon","edit","variations","init","initBlock"],"sources":["@wordpress/block-library/src/social-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAK,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,GAAA;MAAAC,IAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;IAAA;IAAAE,KAAA;MAAAF,IAAA;IAAA;IAAAG,GAAA;MAAAH,IAAA;IAAA;EAAA;EAAAI,WAAA;EAAAC,QAAA;IAAAC,QAAA;IAAAC,IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,WAAA;AAAA;AAQA,MAAM;EAAElB;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAMmB,QAAQ,GAAAtB,OAAA,CAAAsB,QAAA,GAAG;EACvBC,IAAI,EAAJA,YAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAExB,IAAI;EAAEJ,QAAQ;EAAEuB;AAAS,CAAE,CAAC;AAACtB,OAAA,CAAA0B,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_variations","metadata","exports","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","url","type","role","service","label","rel","usesContext","supports","reusable","html","interactivity","clientNavigation","editorStyle","settings","icon","edit","variations","init","initBlock"],"sources":["@wordpress/block-library/src/social-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAK,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,GAAA;MAAAC,IAAA;MAAAC,IAAA;IAAA;IAAAC,OAAA;MAAAF,IAAA;IAAA;IAAAG,KAAA;MAAAH,IAAA;MAAAC,IAAA;IAAA;IAAAG,GAAA;MAAAJ,IAAA;IAAA;EAAA;EAAAK,WAAA;EAAAC,QAAA;IAAAC,QAAA;IAAAC,IAAA;IAAAC,aAAA;MAAAC,gBAAA;IAAA;EAAA;EAAAC,WAAA;AAAA;AAQA,MAAM;EAAEnB;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAInB,MAAMoB,QAAQ,GAAAvB,OAAA,CAAAuB,QAAA,GAAG;EACvBC,IAAI,EAAJA,YAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEzB,IAAI;EAAEJ,QAAQ;EAAEwB;AAAS,CAAE,CAAC;AAACvB,OAAA,CAAA2B,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy || ! selectedSidebar }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAA8D,IAAAQ,WAAA,GAAAR,OAAA;AArB9D;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAMS,cAAc,GAAG;EACtBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE;AACV,CAAC;AAEM,SAASC,0BAA0BA,CAAE;EAAEC,IAAI;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM,CAAEC,eAAe,EA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rBM,OAAO,EAAC,SAAS;UACjBhB,IAAI,EAAC,QAAQ;UACbtD,MAAM,EAAGA,MAAQ;UACjB,iBAAgBA,MAAM,IAAI,CAAEH,eAAiB;UAAA0D,QAAA,EAE3C,IAAAgB,QAAE,EAAE,QAAQ,EAAE,cAAe;QAAC,CACzB;MAAC,CACA,CAAC;IAAA,CACJ;EAAC,CACF,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy || ! selectedSidebar }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAA8D,IAAAQ,WAAA,GAAAR,OAAA;AArB9D;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAMS,cAAc,GAAG;EACtBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE;AACV,CAAC;AAEM,SAASC,0BAA0BA,CAAE;EAAEC,IAAI;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC9D,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAF,iBAAQ,EAAE,KAAM,CAAC;EAE/C,MAAMG,QAAQ,GAAG,IAAAC,iBAA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AC,CACzB;MAAC,CACA,CAAC;IAAA,CACJ;EAAC,CACF,CAAC;AAEX","ignoreList":[]}
@@ -7,7 +7,7 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useSelect, useDispatch } from '@wordpress/data';
10
- import { useRef, useMemo, useEffect } from '@wordpress/element';
10
+ import { useRef, useMemo } from '@wordpress/element';
11
11
  import { useEntityRecord, store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
12
12
  import { Placeholder, Spinner, ToolbarButton, ToolbarGroup } from '@wordpress/components';
13
13
  import { __ } from '@wordpress/i18n';
@@ -18,14 +18,12 @@ import { getBlockBindingsSource } from '@wordpress/blocks';
18
18
  /**
19
19
  * Internal dependencies
20
20
  */
21
- import { name as patternBlockName } from './index';
22
21
  import { unlock } from '../lock-unlock';
23
22
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
23
  const {
25
24
  useLayoutClasses
26
25
  } = unlock(blockEditorPrivateApis);
27
26
  const {
28
- isOverridableBlock,
29
27
  hasOverridableBlocks
30
28
  } = unlock(patternsPrivateApis);
31
29
  const fullAlignments = ['full', 'wide', 'left', 'right'];
@@ -53,15 +51,6 @@ const useInferredLayout = (blocks, parentLayout) => {
53
51
  };
54
52
  }, [blocks, parentLayout]);
55
53
  };
56
- function setBlockEditMode(setEditMode, blocks, mode) {
57
- blocks.forEach(block => {
58
- const editMode = mode || (isOverridableBlock(block) ? 'contentOnly' : 'disabled');
59
- setEditMode(block.clientId, editMode);
60
- setBlockEditMode(setEditMode, block.innerBlocks,
61
- // Disable editing for nested patterns.
62
- block.name === patternBlockName ? 'disabled' : mode);
63
- });
64
- }
65
54
  function RecursionWarning() {
66
55
  const blockProps = useBlockProps();
67
56
  return /*#__PURE__*/_jsx("div", {
@@ -129,7 +118,6 @@ function ReusableBlockEdit({
129
118
  content
130
119
  },
131
120
  __unstableParentLayout: parentLayout,
132
- clientId: patternClientId,
133
121
  setAttributes
134
122
  }) {
135
123
  const {
@@ -141,35 +129,21 @@ function ReusableBlockEdit({
141
129
  });
142
130
  const isMissing = hasResolved && !record;
143
131
  const {
144
- setBlockEditingMode,
145
132
  __unstableMarkLastChangeAsPersistent
146
133
  } = useDispatch(blockEditorStore);
147
134
  const {
148
- innerBlocks,
149
135
  onNavigateToEntityRecord,
150
- editingMode,
151
136
  hasPatternOverridesSource
152
137
  } = useSelect(select => {
153
138
  const {
154
- getBlocks,
155
- getSettings,
156
- getBlockEditingMode
139
+ getSettings
157
140
  } = select(blockEditorStore);
158
141
  // For editing link to the site editor if the theme and user permissions support it.
159
142
  return {
160
- innerBlocks: getBlocks(patternClientId),
161
143
  onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord,
162
- editingMode: getBlockEditingMode(patternClientId),
163
144
  hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides')
164
145
  };
165
- }, [patternClientId]);
166
-
167
- // Sync the editing mode of the pattern block with the inner blocks.
168
- useEffect(() => {
169
- setBlockEditMode(setBlockEditingMode, innerBlocks,
170
- // Disable editing if the pattern itself is disabled.
171
- editingMode === 'disabled' || !hasPatternOverridesSource ? 'disabled' : undefined);
172
- }, [editingMode, innerBlocks, setBlockEditingMode, hasPatternOverridesSource]);
146
+ }, []);
173
147
  const canOverrideBlocks = useMemo(() => hasPatternOverridesSource && hasOverridableBlocks(blocks), [hasPatternOverridesSource, blocks]);
174
148
  const {
175
149
  alignment,
@@ -184,7 +158,6 @@ function ReusableBlockEdit({
184
158
  })
185
159
  });
186
160
  const innerBlocksProps = useInnerBlocksProps(blockProps, {
187
- templateLock: 'all',
188
161
  layout,
189
162
  value: blocks,
190
163
  onInput: NOOP,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityRecord","store","coreStore","useEntityBlockEditor","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","RecursionProvider","useHasRecursion","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","InnerBlocks","patternsPrivateApis","getBlockBindingsSource","name","patternBlockName","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLayoutClasses","isOverridableBlock","hasOverridableBlocks","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","setBlockEditMode","setEditMode","mode","forEach","editMode","clientId","innerBlocks","RecursionWarning","blockProps","children","NOOP","ReusableBlockEditRecursionWrapper","props","ref","hasAlreadyRendered","uniqueId","ReusableBlockEdit","ReusableBlockControl","recordId","canOverrideBlocks","hasContent","handleEditOriginal","resetContent","canUserEdit","select","canUser","kind","id","onClick","disabled","content","__unstableParentLayout","patternClientId","setAttributes","record","hasResolved","isMissing","setBlockEditingMode","__unstableMarkLastChangeAsPersistent","onNavigateToEntityRecord","editingMode","hasPatternOverridesSource","getBlocks","getSettings","getBlockEditingMode","layoutClasses","className","innerBlocksProps","templateLock","value","onInput","onChange","renderAppender","ButtonBlockAppender","postId","postType"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tuseEntityRecord,\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n\tInnerBlocks,\n} from '@wordpress/block-editor';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name as patternBlockName } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst { isOverridableBlock, hasOverridableBlocks } =\n\tunlock( patternsPrivateApis );\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction setBlockEditMode( setEditMode, blocks, mode ) {\n\tblocks.forEach( ( block ) => {\n\t\tconst editMode =\n\t\t\tmode ||\n\t\t\t( isOverridableBlock( block ) ? 'contentOnly' : 'disabled' );\n\t\tsetEditMode( block.clientId, editMode );\n\n\t\tsetBlockEditMode(\n\t\t\tsetEditMode,\n\t\t\tblock.innerBlocks,\n\t\t\t// Disable editing for nested patterns.\n\t\t\tblock.name === patternBlockName ? 'disabled' : mode\n\t\t);\n\t} );\n}\n\nfunction RecursionWarning() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nconst NOOP = () => {};\n\n// Wrap the main Edit function for the pattern block with a recursion wrapper\n// that allows short-circuiting rendering as early as possible, before any\n// of the other effects in the block edit have run.\nexport default function ReusableBlockEditRecursionWrapper( props ) {\n\tconst { ref } = props.attributes;\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn <RecursionWarning />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<ReusableBlockEdit { ...props } />\n\t\t</RecursionProvider>\n\t);\n}\n\nfunction ReusableBlockControl( {\n\trecordId,\n\tcanOverrideBlocks,\n\thasContent,\n\thandleEditOriginal,\n\tresetContent,\n} ) {\n\tconst canUserEdit = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_block',\n\t\t\t\tid: recordId,\n\t\t\t} ),\n\t\t[ recordId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ canUserEdit && !! handleEditOriginal && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton onClick={ handleEditOriginal }>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\n\t\t\t{ canOverrideBlocks && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ resetContent }\n\t\t\t\t\t\t\tdisabled={ ! hasContent }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, content },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n\tsetAttributes,\n} ) {\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', 'wp_block', {\n\t\tid: ref,\n\t} );\n\tconst isMissing = hasResolved && ! record;\n\n\tconst { setBlockEditingMode, __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst {\n\t\tinnerBlocks,\n\t\tonNavigateToEntityRecord,\n\t\teditingMode,\n\t\thasPatternOverridesSource,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks, getSettings, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( patternClientId ),\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\teditingMode: getBlockEditingMode( patternClientId ),\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ patternClientId ]\n\t);\n\n\t// Sync the editing mode of the pattern block with the inner blocks.\n\tuseEffect( () => {\n\t\tsetBlockEditMode(\n\t\t\tsetBlockEditingMode,\n\t\t\tinnerBlocks,\n\t\t\t// Disable editing if the pattern itself is disabled.\n\t\t\teditingMode === 'disabled' || ! hasPatternOverridesSource\n\t\t\t\t? 'disabled'\n\t\t\t\t: undefined\n\t\t);\n\t}, [\n\t\teditingMode,\n\t\tinnerBlocks,\n\t\tsetBlockEditingMode,\n\t\thasPatternOverridesSource,\n\t] );\n\n\tconst canOverrideBlocks = useMemo(\n\t\t() => hasPatternOverridesSource && hasOverridableBlocks( blocks ),\n\t\t[ hasPatternOverridesSource, blocks ]\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: 'all',\n\t\tlayout,\n\t\tvalue: blocks,\n\t\tonInput: NOOP,\n\t\tonChange: NOOP,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst handleEditOriginal = () => {\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: ref,\n\t\t\tpostType: 'wp_block',\n\t\t} );\n\t};\n\n\tconst resetContent = () => {\n\t\tif ( content ) {\n\t\t\t// Make sure any previous changes are persisted before resetting.\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tsetAttributes( { content: undefined } );\n\t\t}\n\t};\n\n\tlet children = null;\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasResolved && ! isMissing && (\n\t\t\t\t<ReusableBlockControl\n\t\t\t\t\trecordId={ ref }\n\t\t\t\t\tcanOverrideBlocks={ canOverrideBlocks }\n\t\t\t\t\thasContent={ !! content }\n\t\t\t\t\thandleEditOriginal={\n\t\t\t\t\t\tonNavigateToEntityRecord\n\t\t\t\t\t\t\t? handleEditOriginal\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tresetContent={ resetContent }\n\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,GAAGA,CAAA,KAAM;IAChCkB,wBAAwB,CAAE;MACzBe,MAAM,EAAEzC,GAAG;MACX0C,QAAQ,EAAE;IACX,CAAE,CAAC;EACJ,CAAC;EAED,MAAMjC,YAAY,GAAGA,CAAA,KAAM;IAC1B,IAAKQ,OAAO,EAAG;MACd;MACAQ,oCAAoC,CAAC,CAAC;MACtCL,aAAa,CAAE;QAAEH,OAAO,EAAExC;MAAU,CAAE,CAAC;IACxC;EACD,CAAC;EAED,IAAImB,QAAQ,GAAG,IAAI;EAEnB,IAAK2B,SAAS,EAAG;IAChB3B,QAAQ,gBACPnC,IAAA,CAACZ,OAAO;MAAA+C,QAAA,EACLpD,EAAE,CAAE,2CAA4C;IAAC,CAC3C,CACT;EACF;EAEA,IAAK,CAAE8E,WAAW,EAAG;IACpB1B,QAAQ,gBACPnC,IAAA,CAACrB,WAAW;MAAAwD,QAAA,eACXnC,IAAA,CAACpB,OAAO,IAAE;IAAC,CACC,CACb;EACF;EAEA,oBACCwB,KAAA,CAAAF,SAAA;IAAAiC,QAAA,GACG0B,WAAW,IAAI,CAAEC,SAAS,iBAC3B9D,IAAA,CAAC2C,oBAAoB;MACpBC,QAAQ,EAAGL,GAAK;MAChBM,iBAAiB,EAAGA,iBAAmB;MACvCC,UAAU,EAAG,CAAC,CAAEU,OAAS;MACzBT,kBAAkB,EACjBkB,wBAAwB,GACrBlB,kBAAkB,GAClB/B,SACH;MACDgC,YAAY,EAAGA;IAAc,CAC7B,CACD,EAECb,QAAQ,KAAK,IAAI,gBAClBnC,IAAA;MAAA,GAAUyE;IAAgB,CAAI,CAAC,gBAE/BzE,IAAA;MAAA,GAAUkC,UAAU;MAAAC,QAAA,EAAKA;IAAQ,CAAO,CACxC;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useSelect","useDispatch","useRef","useMemo","useEntityRecord","store","coreStore","useEntityBlockEditor","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","RecursionProvider","useHasRecursion","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","InnerBlocks","patternsPrivateApis","getBlockBindingsSource","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLayoutClasses","hasOverridableBlocks","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","RecursionWarning","blockProps","children","NOOP","ReusableBlockEditRecursionWrapper","props","ref","hasAlreadyRendered","uniqueId","ReusableBlockEdit","ReusableBlockControl","recordId","canOverrideBlocks","hasContent","handleEditOriginal","resetContent","canUserEdit","select","canUser","kind","name","id","onClick","disabled","content","__unstableParentLayout","setAttributes","record","hasResolved","isMissing","__unstableMarkLastChangeAsPersistent","onNavigateToEntityRecord","hasPatternOverridesSource","getSettings","layoutClasses","className","innerBlocksProps","value","onInput","onChange","renderAppender","ButtonBlockAppender","postId","postType"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo } from '@wordpress/element';\nimport {\n\tuseEntityRecord,\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n\tInnerBlocks,\n} from '@wordpress/block-editor';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst { hasOverridableBlocks } = unlock( patternsPrivateApis );\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction RecursionWarning() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nconst NOOP = () => {};\n\n// Wrap the main Edit function for the pattern block with a recursion wrapper\n// that allows short-circuiting rendering as early as possible, before any\n// of the other effects in the block edit have run.\nexport default function ReusableBlockEditRecursionWrapper( props ) {\n\tconst { ref } = props.attributes;\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn <RecursionWarning />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<ReusableBlockEdit { ...props } />\n\t\t</RecursionProvider>\n\t);\n}\n\nfunction ReusableBlockControl( {\n\trecordId,\n\tcanOverrideBlocks,\n\thasContent,\n\thandleEditOriginal,\n\tresetContent,\n} ) {\n\tconst canUserEdit = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_block',\n\t\t\t\tid: recordId,\n\t\t\t} ),\n\t\t[ recordId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ canUserEdit && !! handleEditOriginal && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton onClick={ handleEditOriginal }>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\n\t\t\t{ canOverrideBlocks && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ resetContent }\n\t\t\t\t\t\t\tdisabled={ ! hasContent }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, content },\n\t__unstableParentLayout: parentLayout,\n\tsetAttributes,\n} ) {\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', 'wp_block', {\n\t\tid: ref,\n\t} );\n\tconst isMissing = hasResolved && ! record;\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { onNavigateToEntityRecord, hasPatternOverridesSource } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\treturn {\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst canOverrideBlocks = useMemo(\n\t\t() => hasPatternOverridesSource && hasOverridableBlocks( blocks ),\n\t\t[ hasPatternOverridesSource, blocks ]\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tlayout,\n\t\tvalue: blocks,\n\t\tonInput: NOOP,\n\t\tonChange: NOOP,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst handleEditOriginal = () => {\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: ref,\n\t\t\tpostType: 'wp_block',\n\t\t} );\n\t};\n\n\tconst resetContent = () => {\n\t\tif ( content ) {\n\t\t\t// Make sure any previous changes are persisted before resetting.\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tsetAttributes( { content: undefined } );\n\t\t}\n\t};\n\n\tlet children = null;\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasResolved && ! isMissing && (\n\t\t\t\t<ReusableBlockControl\n\t\t\t\t\trecordId={ ref }\n\t\t\t\t\tcanOverrideBlocks={ canOverrideBlocks }\n\t\t\t\t\thasContent={ !! content }\n\t\t\t\t\thandleEditOriginal={\n\t\t\t\t\t\tonNavigateToEntityRecord\n\t\t\t\t\t\t\t? handleEditOriginal\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tresetContent={ resetContent }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;AACpD,SACCC,eAAe,EACfC,KAAK,IAAIC,SAAS,EAClBC,oBAAoB,QACd,sBAAsB;AAC7B,SACCC,WAAW,EACXC,OAAO,EACPC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,EACfC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,EACrCd,KAAK,IAAIe,gBAAgB,EACzBC,aAAa,EACbC,WAAW,QACL,yBAAyB;AAChC,SAASJ,WAAW,IAAIK,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,sBAAsB,QAAQ,mBAAmB;;AAE1D;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,MAAM;EAAEC;AAAiB,CAAC,GAAGP,MAAM,CAAEN,sBAAuB,CA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