@wordpress/block-library 8.23.0 → 8.24.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 (136) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +8 -11
  3. package/build/block/edit.js.map +1 -1
  4. package/build/block/edit.native.js +3 -4
  5. package/build/block/edit.native.js.map +1 -1
  6. package/build/button/edit.js +4 -7
  7. package/build/button/edit.js.map +1 -1
  8. package/build/column/edit.js +1 -1
  9. package/build/column/edit.js.map +1 -1
  10. package/build/column/edit.native.js +1 -1
  11. package/build/column/edit.native.js.map +1 -1
  12. package/build/cover/edit/index.js +2 -1
  13. package/build/cover/edit/index.js.map +1 -1
  14. package/build/file/edit.js +8 -9
  15. package/build/file/edit.js.map +1 -1
  16. package/build/file/view.js +4 -6
  17. package/build/file/view.js.map +1 -1
  18. package/build/group/edit.js +3 -7
  19. package/build/group/edit.js.map +1 -1
  20. package/build/image/edit.js +17 -18
  21. package/build/image/edit.js.map +1 -1
  22. package/build/image/edit.native.js +22 -15
  23. package/build/image/edit.native.js.map +1 -1
  24. package/build/image/image.js +35 -27
  25. package/build/image/image.js.map +1 -1
  26. package/build/image/index.js +2 -3
  27. package/build/image/index.js.map +1 -1
  28. package/build/image/view.js +233 -268
  29. package/build/image/view.js.map +1 -1
  30. package/build/navigation/view.js +153 -176
  31. package/build/navigation/view.js.map +1 -1
  32. package/build/navigation-link/index.js +2 -1
  33. package/build/navigation-link/index.js.map +1 -1
  34. package/build/pattern/edit.js +1 -3
  35. package/build/pattern/edit.js.map +1 -1
  36. package/build/post-template/edit.js +1 -1
  37. package/build/post-template/edit.js.map +1 -1
  38. package/build/query/view.js +52 -60
  39. package/build/query/view.js.map +1 -1
  40. package/build/search/view.js +66 -74
  41. package/build/search/view.js.map +1 -1
  42. package/build/utils/remove-anchor-tag.js +17 -0
  43. package/build/utils/remove-anchor-tag.js.map +1 -0
  44. package/build-module/block/edit.js +8 -11
  45. package/build-module/block/edit.js.map +1 -1
  46. package/build-module/block/edit.native.js +3 -4
  47. package/build-module/block/edit.native.js.map +1 -1
  48. package/build-module/button/edit.js +4 -7
  49. package/build-module/button/edit.js.map +1 -1
  50. package/build-module/column/edit.js +1 -1
  51. package/build-module/column/edit.js.map +1 -1
  52. package/build-module/column/edit.native.js +1 -1
  53. package/build-module/column/edit.native.js.map +1 -1
  54. package/build-module/cover/edit/index.js +2 -1
  55. package/build-module/cover/edit/index.js.map +1 -1
  56. package/build-module/file/edit.js +8 -9
  57. package/build-module/file/edit.js.map +1 -1
  58. package/build-module/file/view.js +5 -7
  59. package/build-module/file/view.js.map +1 -1
  60. package/build-module/group/edit.js +3 -7
  61. package/build-module/group/edit.js.map +1 -1
  62. package/build-module/image/edit.js +18 -19
  63. package/build-module/image/edit.js.map +1 -1
  64. package/build-module/image/edit.native.js +23 -16
  65. package/build-module/image/edit.native.js.map +1 -1
  66. package/build-module/image/image.js +36 -28
  67. package/build-module/image/image.js.map +1 -1
  68. package/build-module/image/index.js +2 -3
  69. package/build-module/image/index.js.map +1 -1
  70. package/build-module/image/view.js +234 -269
  71. package/build-module/image/view.js.map +1 -1
  72. package/build-module/navigation/view.js +154 -177
  73. package/build-module/navigation/view.js.map +1 -1
  74. package/build-module/navigation-link/index.js +2 -1
  75. package/build-module/navigation-link/index.js.map +1 -1
  76. package/build-module/pattern/edit.js +1 -3
  77. package/build-module/pattern/edit.js.map +1 -1
  78. package/build-module/post-template/edit.js +1 -1
  79. package/build-module/post-template/edit.js.map +1 -1
  80. package/build-module/query/view.js +53 -61
  81. package/build-module/query/view.js.map +1 -1
  82. package/build-module/search/view.js +67 -75
  83. package/build-module/search/view.js.map +1 -1
  84. package/build-module/utils/remove-anchor-tag.js +11 -0
  85. package/build-module/utils/remove-anchor-tag.js.map +1 -0
  86. package/build-style/cover/style-rtl.css +14 -14
  87. package/build-style/cover/style.css +14 -14
  88. package/build-style/editor-rtl.css +6 -9
  89. package/build-style/editor.css +6 -9
  90. package/build-style/gallery/style-rtl.css +28 -0
  91. package/build-style/gallery/style.css +28 -0
  92. package/build-style/image/editor-rtl.css +0 -3
  93. package/build-style/image/editor.css +0 -3
  94. package/build-style/style-rtl.css +42 -14
  95. package/build-style/style.css +42 -14
  96. package/package.json +32 -32
  97. package/src/block/edit.js +18 -19
  98. package/src/block/edit.native.js +5 -13
  99. package/src/button/edit.js +6 -6
  100. package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -6
  101. package/src/buttons/test/edit.native.js +0 -27
  102. package/src/column/edit.js +1 -1
  103. package/src/column/edit.native.js +1 -1
  104. package/src/cover/edit/index.js +1 -0
  105. package/src/cover/style.scss +1 -1
  106. package/src/cover/test/edit.js +1 -1
  107. package/src/editor.scss +6 -6
  108. package/src/file/edit.js +11 -10
  109. package/src/file/index.php +30 -11
  110. package/src/file/view.js +5 -7
  111. package/src/gallery/style.scss +1 -0
  112. package/src/group/edit.js +3 -11
  113. package/src/heading/test/__snapshots__/index.native.js.snap +6 -0
  114. package/src/heading/test/index.native.js +40 -0
  115. package/src/image/block.json +2 -3
  116. package/src/image/edit.js +16 -21
  117. package/src/image/edit.native.js +17 -18
  118. package/src/image/editor.scss +0 -7
  119. package/src/image/image.js +48 -51
  120. package/src/image/index.php +54 -45
  121. package/src/image/view.js +278 -334
  122. package/src/navigation/index.php +19 -10
  123. package/src/navigation/view.js +159 -192
  124. package/src/navigation-link/block.json +2 -1
  125. package/src/paragraph/test/edit.native.js +37 -1
  126. package/src/pattern/edit.js +5 -3
  127. package/src/post-template/edit.js +1 -1
  128. package/src/query/index.php +36 -22
  129. package/src/query/view.js +58 -65
  130. package/src/query-pagination-next/index.php +3 -3
  131. package/src/query-pagination-numbers/index.php +1 -1
  132. package/src/query-pagination-previous/index.php +3 -3
  133. package/src/search/index.php +40 -40
  134. package/src/search/view.js +58 -63
  135. package/src/utils/remove-anchor-tag.js +10 -0
  136. package/tsconfig.json +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_icons","_blockEditor","_hooks","_initBlock","_interopRequireDefault","_edit","_save","_hooks2","_transforms","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","label","type","rel","id","opensInNewTab","url","kind","isTopLevelLink","usesContext","supports","reusable","html","__experimentalSlashInserter","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","editorStyle","style","exports","settings","icon","linkIcon","__experimentalLabel","merge","leftAttributes","rightLabel","edit","save","example","_x","deprecated","isEligible","nofollow","default","migrate","rest","_react","createElement","InnerBlocks","Content","transforms","init","addFilter","enhanceNavigationLinkVariations","initBlock"],"sources":["@wordpress/block-library/src/navigation-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\nimport { InnerBlocks } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport { enhanceNavigationLinkVariations } from './hooks';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: linkIcon,\n\n\t__experimentalLabel: ( { label } ) => label,\n\n\tmerge( leftAttributes, { label: rightLabel = '' } ) {\n\t\treturn {\n\t\t\t...leftAttributes,\n\t\t\tlabel: leftAttributes.label + rightLabel,\n\t\t};\n\t},\n\n\tedit,\n\n\tsave,\n\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'Example Link', 'navigation link preview example' ),\n\t\t\turl: 'https://example.com',\n\t\t},\n\t},\n\n\tdeprecated: [\n\t\t{\n\t\t\tisEligible( attributes ) {\n\t\t\t\treturn attributes.nofollow;\n\t\t\t},\n\n\t\t\tattributes: {\n\t\t\t\tlabel: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tnofollow: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\topensInNewTab: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t},\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tmigrate( { nofollow, ...rest } ) {\n\t\t\t\treturn {\n\t\t\t\t\trel: nofollow ? 'nofollow' : '',\n\t\t\t\t\t...rest,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tsave() {\n\t\t\t\treturn <InnerBlocks.Content />;\n\t\t\t},\n\t\t},\n\t],\n\ttransforms,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/navigation-link',\n\t\tenhanceNavigationLinkVariations\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,KAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAhBA;AACA;AACA;AAMA;AACA;AACA;AAFA,MAAAU,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC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C9D/B,GAAG,EAAE;IACN;EACD,CAAC;EAEDgC,UAAU,EAAE,CACX;IACCC,UAAUA,CAAEvC,UAAU,EAAG;MACxB,OAAOA,UAAU,CAACwC,QAAQ;IAC3B,CAAC;IAEDxC,UAAU,EAAE;MACXC,KAAK,EAAE;QACNC,IAAI,EAAE;MACP,CAAC;MACDA,IAAI,EAAE;QACLA,IAAI,EAAE;MACP,CAAC;MACDsC,QAAQ,EAAE;QACTtC,IAAI,EAAE;MACP,CAAC;MACDJ,WAAW,EAAE;QACZI,IAAI,EAAE;MACP,CAAC;MACDE,EAAE,EAAE;QACHF,IAAI,EAAE;MACP,CAAC;MACDG,aAAa,EAAE;QACdH,IAAI,EAAE,SAAS;QACfuC,OAAO,EAAE;MACV,CAAC;MACDnC,GAAG,EAAE;QACJJ,IAAI,EAAE;MACP;IACD,CAAC;IAEDwC,OAAOA,CAAE;MAAEF,QAAQ;MAAE,GAAGG;IAAK,CAAC,EAAG;MAChC,OAAO;QACNxC,GAAG,EAAEqC,QAAQ,GAAG,UAAU,GAAG,EAAE;QAC/B,GAAGG;MACJ,CAAC;IACF,CAAC;IAEDR,IAAIA,CAAA,EAAG;MACN,OAAO,IAAAS,MAAA,CAAAC,aAAA,EAAC9D,YAAA,CAAA+D,WAAW,CAACC,OAAO,MAAE,CAAC;IAC/B;EACD,CAAC,CACD;EACDC,UAAU,EAAVA;AACD,CAAC;AAACtB,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAEK,MAAMsB,IAAI,GAAGA,CAAA,KAAM;EACzB,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,sBAAsB,EACtBC,uCACD,CAAC;EAED,OAAO,IAAAC,kBAAS,EAAE;IAAE1D,IAAI;IAAEH,QAAQ;IAAEoC;EAAS,CAAE,CAAC;AACjD,CAAC;AAACD,OAAA,CAAAuB,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"names":["_i18n","require","_icons","_blockEditor","_hooks","_initBlock","_interopRequireDefault","_edit","_save","_hooks2","_transforms","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","label","type","rel","id","opensInNewTab","url","kind","isTopLevelLink","usesContext","supports","reusable","html","__experimentalSlashInserter","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","renaming","editorStyle","style","exports","settings","icon","linkIcon","__experimentalLabel","merge","leftAttributes","rightLabel","edit","save","example","_x","deprecated","isEligible","nofollow","default","migrate","rest","_react","createElement","InnerBlocks","Content","transforms","init","addFilter","enhanceNavigationLinkVariations","initBlock"],"sources":["@wordpress/block-library/src/navigation-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\nimport { InnerBlocks } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport { enhanceNavigationLinkVariations } from './hooks';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: linkIcon,\n\n\t__experimentalLabel: ( { label } ) => label,\n\n\tmerge( leftAttributes, { label: rightLabel = '' } ) {\n\t\treturn {\n\t\t\t...leftAttributes,\n\t\t\tlabel: leftAttributes.label + rightLabel,\n\t\t};\n\t},\n\n\tedit,\n\n\tsave,\n\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'Example Link', 'navigation link preview example' ),\n\t\t\turl: 'https://example.com',\n\t\t},\n\t},\n\n\tdeprecated: [\n\t\t{\n\t\t\tisEligible( attributes ) {\n\t\t\t\treturn attributes.nofollow;\n\t\t\t},\n\n\t\t\tattributes: {\n\t\t\t\tlabel: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tnofollow: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\topensInNewTab: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t},\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tmigrate( { nofollow, ...rest } ) {\n\t\t\t\treturn {\n\t\t\t\t\trel: nofollow ? 'nofollow' : '',\n\t\t\t\t\t...rest,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tsave() {\n\t\t\t\treturn <InnerBlocks.Content />;\n\t\t\t},\n\t\t},\n\t],\n\ttransforms,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/navigation-link',\n\t\tenhanceNavigationLinkVariations\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAC,sBAAA,CAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,KAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAhBA;AACA;AACA;AAMA;AACA;AACA;AAFA,MAAAU,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;I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UAAU,EAAE,CACX;IACCC,UAAUA,CAAExC,UAAU,EAAG;MACxB,OAAOA,UAAU,CAACyC,QAAQ;IAC3B,CAAC;IAEDzC,UAAU,EAAE;MACXC,KAAK,EAAE;QACNC,IAAI,EAAE;MACP,CAAC;MACDA,IAAI,EAAE;QACLA,IAAI,EAAE;MACP,CAAC;MACDuC,QAAQ,EAAE;QACTvC,IAAI,EAAE;MACP,CAAC;MACDJ,WAAW,EAAE;QACZI,IAAI,EAAE;MACP,CAAC;MACDE,EAAE,EAAE;QACHF,IAAI,EAAE;MACP,CAAC;MACDG,aAAa,EAAE;QACdH,IAAI,EAAE,SAAS;QACfwC,OAAO,EAAE;MACV,CAAC;MACDpC,GAAG,EAAE;QACJJ,IAAI,EAAE;MACP;IACD,CAAC;IAEDyC,OAAOA,CAAE;MAAEF,QAAQ;MAAE,GAAGG;IAAK,CAAC,EAAG;MAChC,OAAO;QACNzC,GAAG,EAAEsC,QAAQ,GAAG,UAAU,GAAG,EAAE;QAC/B,GAAGG;MACJ,CAAC;IACF,CAAC;IAEDR,IAAIA,CAAA,EAAG;MACN,OAAO,IAAAS,MAAA,CAAAC,aAAA,EAAC/D,YAAA,CAAAgE,WAAW,CAACC,OAAO,MAAE,CAAC;IAC/B;EACD,CAAC,CACD;EACDC,UAAU,EAAVA;AACD,CAAC;AAACtB,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAEK,MAAMsB,IAAI,GAAGA,CAAA,KAAM;EACzB,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,sBAAsB,EACtBC,uCACD,CAAC;EAED,OAAO,IAAAC,kBAAS,EAAE;IAAE3D,IAAI;IAAEH,QAAQ;IAAEqC;EAAS,CAAE,CAAC;AACjD,CAAC;AAACD,OAAA,CAAAuB,IAAA,GAAAA,IAAA"}
@@ -22,11 +22,9 @@ const PatternEdit = ({
22
22
  const currentThemeStylesheet = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme()?.stylesheet, []);
23
23
  const {
24
24
  replaceBlocks,
25
+ setBlockEditingMode,
25
26
  __unstableMarkNextChangeAsNotPersistent
26
27
  } = (0, _data.useDispatch)(_blockEditor.store);
27
- const {
28
- setBlockEditingMode
29
- } = (0, _data.useDispatch)(_blockEditor.store);
30
28
  const {
31
29
  getBlockRootClientId,
32
30
  getBlockEditingMode
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_element","_blockEditor","_coreData","PatternEdit","attributes","clientId","selectedPattern","useSelect","select","blockEditorStore","__experimentalGetParsedPattern","slug","currentThemeStylesheet","coreStore","getCurrentTheme","stylesheet","replaceBlocks","__unstableMarkNextChangeAsNotPersistent","useDispatch","setBlockEditingMode","getBlockRootClientId","getBlockEditingMode","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","theme","undefined","useEffect","blocks","window","queueMicrotask","rootClientId","clonedBlocks","cloneBlock","rootEditingMode","props","useBlockProps","_react","createElement","_default","exports","default"],"sources":["@wordpress/block-library/src/pattern/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst PatternEdit = ( { attributes, clientId } ) => {\n\tconst selectedPattern = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__experimentalGetParsedPattern(\n\t\t\t\tattributes.slug\n\t\t\t),\n\t\t[ attributes.slug ]\n\t);\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\n\tconst { replaceBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { setBlockEditingMode } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockEditingMode } =\n\t\tuseSelect( blockEditorStore );\n\n\t// Duplicated in packages/edit-site/src/components/start-template-options/index.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\t// Run this effect when the component loads.\n\t// This adds the Pattern's contents to the post.\n\t// This change won't be saved.\n\t// It will continue to pull from the pattern file unless changes are made to its respective template part.\n\tuseEffect( () => {\n\t\tif ( selectedPattern?.blocks ) {\n\t\t\t// We batch updates to block list settings to avoid triggering cascading renders\n\t\t\t// for each container block included in a tree and optimize initial render.\n\t\t\t// Since the above uses microtasks, we need to use a microtask here as well,\n\t\t\t// because nested pattern blocks cannot be inserted if the parent block supports\n\t\t\t// inner blocks but doesn't have blockSettings in the state.\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\t// Clone blocks from the pattern before insertion to ensure they receive\n\t\t\t\t// distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628.\n\t\t\t\tconst clonedBlocks = selectedPattern.blocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock(\n\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst rootEditingMode = getBlockEditingMode( rootClientId );\n\t\t\t\t// Temporarily set the root block to default mode to allow replacing the pattern.\n\t\t\t\t// This could happen when the page is disabling edits of non-content blocks.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, 'default' );\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlocks( clientId, clonedBlocks );\n\t\t\t\t// Restore the root block's original mode.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, rootEditingMode );\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tselectedPattern?.blocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlocks,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t\tgetBlockRootClientId,\n\t] );\n\n\tconst props = useBlockProps();\n\n\treturn <div { ...props } />;\n};\n\nexport default PatternEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,SAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAUA,MAAMK,WAAW,GAAGA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,KAAM;EACnD,MAAMC,eAAe,GAAG,IAAAC,eAAS,EAC9BC,MAAM,IACPA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,8BAA8B,CACxDN,UAAU,CAACO,IACZ,CAAC,EACF,CAAEP,UAAU,CAACO,IAAI,CAClB,CAAC;EAED,MAAMC,sBAAsB,GAAG,IAAAL,eAAS,EACrCC,MAAM,IAAMA,MAAM,CAAEK,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,EAAEC,UAAU,EAC/D,EACD,CAAC;EAED,MAAM;IAAEC,aAAa;IAAEC;EAAwC,CAAC,GAC/D,IAAAC,iBAAW,EAA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QAC3D;QACA;QACAlB,uCAAuC,CAAC,CAAC;QACzCE,mBAAmB,CAAEgB,YAAY,EAAE,SAAU,CAAC;QAC9ClB,uCAAuC,CAAC,CAAC;QACzCD,aAAa,CAAEX,QAAQ,EAAE+B,YAAa,CAAC;QACvC;QACAnB,uCAAuC,CAAC,CAAC;QACzCE,mBAAmB,CAAEgB,YAAY,EAAEG,eAAgB,CAAC;MACrD,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CACFjC,QAAQ,EACRC,eAAe,EAAE0B,MAAM,EACvBf,uCAAuC,EACvCD,aAAa,EACbK,mBAAmB,EACnBF,mBAAmB,EACnBC,oBAAoB,CACnB,CAAC;EAEH,MAAMmB,KAAK,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAE7B,OAAO,IAAAC,MAAA,CAAAC,aAAA;IAAA,GAAUH;EAAK,CAAI,CAAC;AAC5B,CAAC;AAAC,IAAAI,QAAA,GAEaxC,WAAW;AAAAyC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_blocks","require","_data","_element","_blockEditor","_coreData","PatternEdit","attributes","clientId","selectedPattern","useSelect","select","blockEditorStore","__experimentalGetParsedPattern","slug","currentThemeStylesheet","coreStore","getCurrentTheme","stylesheet","replaceBlocks","setBlockEditingMode","__unstableMarkNextChangeAsNotPersistent","useDispatch","getBlockRootClientId","getBlockEditingMode","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","theme","undefined","useEffect","blocks","window","queueMicrotask","rootClientId","clonedBlocks","cloneBlock","rootEditingMode","props","useBlockProps","_react","createElement","_default","exports","default"],"sources":["@wordpress/block-library/src/pattern/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst PatternEdit = ( { attributes, clientId } ) => {\n\tconst selectedPattern = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__experimentalGetParsedPattern(\n\t\t\t\tattributes.slug\n\t\t\t),\n\t\t[ attributes.slug ]\n\t);\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\n\tconst {\n\t\treplaceBlocks,\n\t\tsetBlockEditingMode,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockEditingMode } =\n\t\tuseSelect( blockEditorStore );\n\n\t// Duplicated in packages/edit-site/src/components/start-template-options/index.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\t// Run this effect when the component loads.\n\t// This adds the Pattern's contents to the post.\n\t// This change won't be saved.\n\t// It will continue to pull from the pattern file unless changes are made to its respective template part.\n\tuseEffect( () => {\n\t\tif ( selectedPattern?.blocks ) {\n\t\t\t// We batch updates to block list settings to avoid triggering cascading renders\n\t\t\t// for each container block included in a tree and optimize initial render.\n\t\t\t// Since the above uses microtasks, we need to use a microtask here as well,\n\t\t\t// because nested pattern blocks cannot be inserted if the parent block supports\n\t\t\t// inner blocks but doesn't have blockSettings in the state.\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\t// Clone blocks from the pattern before insertion to ensure they receive\n\t\t\t\t// distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628.\n\t\t\t\tconst clonedBlocks = selectedPattern.blocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock(\n\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst rootEditingMode = getBlockEditingMode( rootClientId );\n\t\t\t\t// Temporarily set the root block to default mode to allow replacing the pattern.\n\t\t\t\t// This could happen when the page is disabling edits of non-content blocks.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, 'default' );\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlocks( clientId, clonedBlocks );\n\t\t\t\t// Restore the root block's original mode.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, rootEditingMode );\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tselectedPattern?.blocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlocks,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t\tgetBlockRootClientId,\n\t] );\n\n\tconst props = useBlockProps();\n\n\treturn <div { ...props } />;\n};\n\nexport default PatternEdit;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,SAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAUA,MAAMK,WAAW,GAAGA,CAAE;EAAEC,U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B,eAAe,EAAE0B,MAAM,EAAG;MAC9B;MACA;MACA;MACA;MACA;MACAC,MAAM,CAACC,cAAc,CAAE,MAAM;QAC5B,MAAMC,YAAY,GAAGf,oBAAoB,CAAEf,QAAS,CAAC;QACrD;QACA;QACA,MAAM+B,YAAY,GAAG9B,eAAe,CAAC0B,MAAM,CAACJ,GAAG,CAAIL,KAAK,IACvD,IAAAc,kBAAU,EACTf,0CAA0C,CAAEC,KAAM,CACnD,CACD,CAAC;QACD,MAAMe,eAAe,GAAGjB,mBAAmB,CAAEc,YAAa,CAAC;QAC3D;QACA;QACAjB,uCAAuC,CAAC,CAAC;QACzCD,mBAAmB,CAAEkB,YAAY,EAAE,SAAU,CAAC;QAC9CjB,uCAAuC,CAAC,CAAC;QACzCF,aAAa,CAAEX,QAAQ,EAAE+B,YAAa,CAAC;QACvC;QACAlB,uCAAuC,CAAC,CAAC;QACzCD,mBAAmB,CAAEkB,YAAY,EAAEG,eAAgB,CAAC;MACrD,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CACFjC,QAAQ,EACRC,eAAe,EAAE0B,MAAM,EACvBd,uCAAuC,EACvCF,aAAa,EACbK,mBAAmB,EACnBJ,mBAAmB,EACnBG,oBAAoB,CACnB,CAAC;EAEH,MAAMmB,KAAK,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAE7B,OAAO,IAAAC,MAAA,CAAAC,aAAA;IAAA,GAAUH;EAAK,CAAI,CAAC;AAC5B,CAAC;AAAC,IAAAI,QAAA,GAEaxC,WAAW;AAAAyC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -125,7 +125,7 @@ function PostTemplateEdit({
125
125
  slug: templateSlug.replace('category-', '')
126
126
  });
127
127
  const query = {
128
- offset: perPage ? perPage + offset : 0,
128
+ offset: offset || 0,
129
129
  order,
130
130
  orderby: orderBy
131
131
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_i18n","_blockEditor","_components","_coreData","_icons","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","useInnerBlocksProps","className","template","__unstableDisableLayoutClassNames","_react","createElement","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","useBlockPreview","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","memo","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","useState","posts","useSelect","select","getEntityRecords","getTaxonomies","coreStore","getBlocks","blockEditorStore","taxonomies","per_page","templateCategory","startsWith","_fields","slug","replace","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","useMemo","map","post","postId","blockProps","useBlockProps","classnames","Spinner","__","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","list","title","isActive","grid","Fragment","BlockControls","ToolbarGroup","controls","blockContext","BlockContextProvider","key","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wp-block-post' },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wp-block-post',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: perPage ? perPage + offset : 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA,MAAMQ,QAAQ,GAAG,CAChB,CAAE,iBAAiB,CAAE,EACrB,CAAE,gBAAgB,CAAE,EACpB,CAAE,mBAAmB,CA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;EAAc,GAEpBA,YAAY,CAAClB,MAAM,MACnBvC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEI,MAAM,CAAE,GAC5B,IAAAtF,MAAA,CAAAC,aAAA,EAACP,uBAAuB,MAAE,CAAC,GACxB,IAAI,EACR,IAAAM,MAAA,CAAAC,aAAA,EAACiB,gCAAgC;IAChCf,MAAM,EAAGA,MAAQ;IACjBC,cAAc,EAAGoG,YAAY,CAAClB,MAAQ;IACtChF,uBAAuB,EACtBA,uBACA;IACDD,QAAQ,EACPmG,YAAY,CAAClB,MAAM,MACjBvC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEI,MAAM;EAC3B,CACD,CACoB,CACrB,CACA,CACH,CAAC;AAEL"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_i18n","_blockEditor","_components","_coreData","_icons","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","useInnerBlocksProps","className","template","__unstableDisableLayoutClassNames","_react","createElement","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","useBlockPreview","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","memo","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","useState","posts","useSelect","select","getEntityRecords","getTaxonomies","coreStore","getBlocks","blockEditorStore","taxonomies","per_page","templateCategory","startsWith","_fields","slug","replace","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","useMemo","map","post","postId","blockProps","useBlockProps","classnames","Spinner","__","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","list","title","isActive","grid","Fragment","BlockControls","ToolbarGroup","controls","blockContext","BlockContextProvider","key","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wp-block-post' },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wp-block-post',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t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UAAU,KAAK;EAC1B,CAAC,CACD;;EAED;EACA;EACA;EACA;EACA,OACC,IAAA7C,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAoG,QAAA,QACC,IAAApG,MAAA,CAAAC,aAAA,EAACZ,YAAA,CAAAgH,aAAa,QACb,IAAArG,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAgH,YAAY;IAACC,QAAQ,EAAGT;EAAuB,CAAE,CACpC,CAAC,EAEhB,IAAA9F,MAAA,CAAAC,aAAA;IAAA,GAASsF;EAAU,GAChBL,aAAa,IACdA,aAAa,CAACE,GAAG,CAAIoB,YAAY,IAChC,IAAAxG,MAAA,CAAAC,aAAA,EAACZ,YAAA,CAAAoH,oBAAoB;IACpBC,GAAG,EAAGF,YAAY,CAAClB,MAAQ;IAC3BqB,KAAK,EAAGH;EAAc,GAEpBA,YAAY,CAAClB,MAAM,MACnBvC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEI,MAAM,CAAE,GAC5B,IAAAtF,MAAA,CAAAC,aAAA,EAACP,uBAAuB,MAAE,CAAC,GACxB,IAAI,EACR,IAAAM,MAAA,CAAAC,aAAA,EAACiB,gCAAgC;IAChCf,MAAM,EAAGA,MAAQ;IACjBC,cAAc,EAAGoG,YAAY,CAAClB,MAAQ;IACtChF,uBAAuB,EACtBA,uBACA;IACDD,QAAQ,EACPmG,YAAY,CAAClB,MAAM,MACjBvC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEI,MAAM;EAC3B,CACD,CACoB,CACrB,CACA,CACH,CAAC;AAEL"}
@@ -15,76 +15,68 @@ const isValidEvent = event => event.button === 0 &&
15
15
  !event.altKey &&
16
16
  // Download.
17
17
  !event.shiftKey && !event.defaultPrevented;
18
- (0, _interactivity.store)({
19
- selectors: {
20
- core: {
21
- query: {
22
- startAnimation: ({
23
- context
24
- }) => context.core.query.animation === 'start',
25
- finishAnimation: ({
26
- context
27
- }) => context.core.query.animation === 'finish'
28
- }
18
+ (0, _interactivity.store)('core/query', {
19
+ state: {
20
+ get startAnimation() {
21
+ return (0, _interactivity.getContext)().animation === 'start';
22
+ },
23
+ get finishAnimation() {
24
+ return (0, _interactivity.getContext)().animation === 'finish';
29
25
  }
30
26
  },
31
27
  actions: {
32
- core: {
33
- query: {
34
- navigate: async ({
35
- event,
36
- ref,
37
- context
38
- }) => {
39
- const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
40
- if (isValidLink(ref) && isValidEvent(event) && !isDisabled) {
41
- event.preventDefault();
42
- const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
28
+ *navigate(event) {
29
+ const ctx = (0, _interactivity.getContext)();
30
+ const {
31
+ ref
32
+ } = (0, _interactivity.getElement)();
33
+ const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
34
+ if (isValidLink(ref) && isValidEvent(event) && !isDisabled) {
35
+ event.preventDefault();
36
+ const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
43
37
 
44
- // Don't announce the navigation immediately, wait 400 ms.
45
- const timeout = setTimeout(() => {
46
- context.core.query.message = context.core.query.loadingText;
47
- context.core.query.animation = 'start';
48
- }, 400);
49
- await (0, _interactivity.navigate)(ref.href);
38
+ // Don't announce the navigation immediately, wait 400 ms.
39
+ const timeout = setTimeout(() => {
40
+ ctx.message = ctx.loadingText;
41
+ ctx.animation = 'start';
42
+ }, 400);
43
+ yield (0, _interactivity.navigate)(ref.href);
50
44
 
51
- // Dismiss loading message if it hasn't been added yet.
52
- clearTimeout(timeout);
45
+ // Dismiss loading message if it hasn't been added yet.
46
+ clearTimeout(timeout);
53
47
 
54
- // Announce that the page has been loaded. If the message is the
55
- // same, we use a no-break space similar to the @wordpress/a11y
56
- // package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
57
- context.core.query.message = context.core.query.loadedText + (context.core.query.message === context.core.query.loadedText ? '\u00A0' : '');
58
- context.core.query.animation = 'finish';
59
- context.core.query.url = ref.href;
48
+ // Announce that the page has been loaded. If the message is the
49
+ // same, we use a no-break space similar to the @wordpress/a11y
50
+ // package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
51
+ ctx.message = ctx.loadedText + (ctx.message === ctx.loadedText ? '\u00A0' : '');
52
+ ctx.animation = 'finish';
53
+ ctx.url = ref.href;
60
54
 
61
- // Focus the first anchor of the Query block.
62
- const firstAnchor = `[data-wp-navigation-id=${id}] .wp-block-post-template a[href]`;
63
- document.querySelector(firstAnchor)?.focus();
64
- }
65
- },
66
- prefetch: async ({
67
- ref
68
- }) => {
69
- const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
70
- if (isValidLink(ref) && !isDisabled) {
71
- await (0, _interactivity.prefetch)(ref.href);
72
- }
73
- }
55
+ // Focus the first anchor of the Query block.
56
+ const firstAnchor = `[data-wp-navigation-id=${id}] .wp-block-post-template a[href]`;
57
+ document.querySelector(firstAnchor)?.focus();
58
+ }
59
+ },
60
+ *prefetch() {
61
+ const {
62
+ ref
63
+ } = (0, _interactivity.getElement)();
64
+ const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
65
+ if (isValidLink(ref) && !isDisabled) {
66
+ yield (0, _interactivity.prefetch)(ref.href);
74
67
  }
75
68
  }
76
69
  },
77
- effects: {
78
- core: {
79
- query: {
80
- prefetch: async ({
81
- ref,
82
- context
83
- }) => {
84
- if (context.core.query.url && isValidLink(ref)) {
85
- await (0, _interactivity.prefetch)(ref.href);
86
- }
87
- }
70
+ callbacks: {
71
+ *prefetch() {
72
+ const {
73
+ url
74
+ } = (0, _interactivity.getContext)();
75
+ const {
76
+ ref
77
+ } = (0, _interactivity.getElement)();
78
+ if (url && isValidLink(ref)) {
79
+ yield (0, _interactivity.prefetch)(ref.href);
88
80
  }
89
81
  }
90
82
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_interactivity","require","isValidLink","ref","window","HTMLAnchorElement","href","target","origin","location","isValidEvent","event","button","metaKey","ctrlKey","altKey","shiftKey","defaultPrevented","store","selectors","core","query","startAnimation","context","animation","finishAnimation","actions","navigate","isDisabled","closest","dataset","wpNavigationDisabled","preventDefault","id","wpNavigationId","timeout","setTimeout","message","loadingText","clearTimeout","loadedText","url","firstAnchor","document","querySelector","focus","prefetch","effects"],"sources":["@wordpress/block-library/src/query/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, navigate, prefetch } from '@wordpress/interactivity';\n\nconst isValidLink = ( ref ) =>\n\tref &&\n\tref instanceof window.HTMLAnchorElement &&\n\tref.href &&\n\t( ! ref.target || ref.target === '_self' ) &&\n\tref.origin === window.location.origin;\n\nconst isValidEvent = ( event ) =>\n\tevent.button === 0 && // Left clicks only.\n\t! event.metaKey && // Open in new tab (Mac).\n\t! event.ctrlKey && // Open in new tab (Windows).\n\t! event.altKey && // Download.\n\t! event.shiftKey &&\n\t! event.defaultPrevented;\n\nstore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tquery: {\n\t\t\t\tstartAnimation: ( { context } ) =>\n\t\t\t\t\tcontext.core.query.animation === 'start',\n\t\t\t\tfinishAnimation: ( { context } ) =>\n\t\t\t\t\tcontext.core.query.animation === 'finish',\n\t\t\t},\n\t\t},\n\t},\n\tactions: {\n\t\tcore: {\n\t\t\tquery: {\n\t\t\t\tnavigate: async ( { event, ref, context } ) => {\n\t\t\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )\n\t\t\t\t\t\t?.dataset.wpNavigationDisabled;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisValidLink( ref ) &&\n\t\t\t\t\t\tisValidEvent( event ) &&\n\t\t\t\t\t\t! isDisabled\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tconst id = ref.closest( '[data-wp-navigation-id]' )\n\t\t\t\t\t\t\t.dataset.wpNavigationId;\n\n\t\t\t\t\t\t// Don't announce the navigation immediately, wait 400 ms.\n\t\t\t\t\t\tconst timeout = setTimeout( () => {\n\t\t\t\t\t\t\tcontext.core.query.message =\n\t\t\t\t\t\t\t\tcontext.core.query.loadingText;\n\t\t\t\t\t\t\tcontext.core.query.animation = 'start';\n\t\t\t\t\t\t}, 400 );\n\n\t\t\t\t\t\tawait navigate( ref.href );\n\n\t\t\t\t\t\t// Dismiss loading message if it hasn't been added yet.\n\t\t\t\t\t\tclearTimeout( timeout );\n\n\t\t\t\t\t\t// Announce that the page has been loaded. If the message is the\n\t\t\t\t\t\t// same, we use a no-break space similar to the @wordpress/a11y\n\t\t\t\t\t\t// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26\n\t\t\t\t\t\tcontext.core.query.message =\n\t\t\t\t\t\t\tcontext.core.query.loadedText +\n\t\t\t\t\t\t\t( context.core.query.message ===\n\t\t\t\t\t\t\tcontext.core.query.loadedText\n\t\t\t\t\t\t\t\t? '\\u00A0'\n\t\t\t\t\t\t\t\t: '' );\n\n\t\t\t\t\t\tcontext.core.query.animation = 'finish';\n\t\t\t\t\t\tcontext.core.query.url = ref.href;\n\n\t\t\t\t\t\t// Focus the first anchor of the Query block.\n\t\t\t\t\t\tconst firstAnchor = `[data-wp-navigation-id=${ id }] .wp-block-post-template a[href]`;\n\t\t\t\t\t\tdocument.querySelector( firstAnchor )?.focus();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprefetch: async ( { ref } ) => {\n\t\t\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )\n\t\t\t\t\t\t?.dataset.wpNavigationDisabled;\n\t\t\t\t\tif ( isValidLink( ref ) && ! isDisabled ) {\n\t\t\t\t\t\tawait prefetch( ref.href );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\teffects: {\n\t\tcore: {\n\t\t\tquery: {\n\t\t\t\tprefetch: async ( { ref, context } ) => {\n\t\t\t\t\tif ( context.core.query.url && isValidLink( ref ) ) {\n\t\t\t\t\t\tawait prefetch( ref.href );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n} );\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,WAAW,GAAKC,GAAG,IACxBA,GAAG,IACHA,GAAG,YAAYC,MAAM,CAACC,iBAAiB,IACvCF,GAAG,CAACG,IAAI,KACN,CAAEH,GAAG,CAACI,MAAM,IAAIJ,GAAG,CAACI,MAAM,KAAK,OAAO,CAAE,IAC1CJ,GAAG,CAACK,MAAM,KAAKJ,MAAM,CAACK,QAAQ,CAACD,MAAM;AAEtC,MAAME,YAAY,GAAKC,KAAK,IAC3BA,KAAK,CAACC,MAAM,KAAK,CAAC;AAAI;AACtB,CAAED,KAAK,CAACE,OAAO;AAAI;AACnB,CAAEF,KAAK,CAACG,OAAO;AAAI;AACnB,CAAEH,KAAK,CAACI,MAAM;AAAI;AAClB,CAAEJ,KAAK,CAACK,QAAQ,IAChB,CAAEL,KAAK,CAACM,gBAAgB;AAEzB,IAAAC,oBAAK,EAAE;EACNC,SAAS,EAAE;IACVC,IAAI,EAAE;MACLC,KAAK,EAAE;QACNC,cAAc,EAAEA,CAAE;UAAEC;QAAQ,CAAC,KAC5BA,OAAO,CAACH,IAAI,CAACC,KAAK,CAACG,SAAS,KAAK,OAAO;QACzCC,eAAe,EAAEA,CAAE;UAAEF;QAAQ,CAAC,KAC7BA,OAAO,CAACH,IAAI,CAACC,KAAK,CAACG,SAAS,KAAK;MACnC;IACD;EACD,CAAC;EACDE,OAAO,EAAE;IACRN,IAAI,EAAE;MACLC,KAAK,EAAE;QACNM,QAAQ,EAAE,MAAAA,CAAQ;UAAEhB,KAAK;UAAER,GAAG;UAAEoB;QAAQ,CAAC,KAAM;UA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E,MAAAA,CAAQ;UAAE3C;QAAI,CAAC,KAAM;UAC9B,MAAMyB,UAAU,GAAGzB,GAAG,CAAC0B,OAAO,CAAE,yBAA0B,CAAC,EACxDC,OAAO,CAACC,oBAAoB;UAC/B,IAAK7B,WAAW,CAAEC,GAAI,CAAC,IAAI,CAAEyB,UAAU,EAAG;YACzC,MAAM,IAAAkB,uBAAQ,EAAE3C,GAAG,CAACG,IAAK,CAAC;UAC3B;QACD;MACD;IACD;EACD,CAAC;EACDyC,OAAO,EAAE;IACR3B,IAAI,EAAE;MACLC,KAAK,EAAE;QACNyB,QAAQ,EAAE,MAAAA,CAAQ;UAAE3C,GAAG;UAAEoB;QAAQ,CAAC,KAAM;UACvC,IAAKA,OAAO,CAACH,IAAI,CAACC,KAAK,CAACoB,GAAG,IAAIvC,WAAW,CAAEC,GAAI,CAAC,EAAG;YACnD,MAAM,IAAA2C,uBAAQ,EAAE3C,GAAG,CAACG,IAAK,CAAC;UAC3B;QACD;MACD;IACD;EACD;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_interactivity","require","isValidLink","ref","window","HTMLAnchorElement","href","target","origin","location","isValidEvent","event","button","metaKey","ctrlKey","altKey","shiftKey","defaultPrevented","store","state","startAnimation","getContext","animation","finishAnimation","actions","navigate","ctx","getElement","isDisabled","closest","dataset","wpNavigationDisabled","preventDefault","id","wpNavigationId","timeout","setTimeout","message","loadingText","clearTimeout","loadedText","url","firstAnchor","document","querySelector","focus","prefetch","callbacks"],"sources":["@wordpress/block-library/src/query/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\tnavigate,\n\tprefetch,\n} from '@wordpress/interactivity';\n\nconst isValidLink = ( ref ) =>\n\tref &&\n\tref instanceof window.HTMLAnchorElement &&\n\tref.href &&\n\t( ! ref.target || ref.target === '_self' ) &&\n\tref.origin === window.location.origin;\n\nconst isValidEvent = ( event ) =>\n\tevent.button === 0 && // Left clicks only.\n\t! event.metaKey && // Open in new tab (Mac).\n\t! event.ctrlKey && // Open in new tab (Windows).\n\t! event.altKey && // Download.\n\t! event.shiftKey &&\n\t! event.defaultPrevented;\n\nstore( 'core/query', {\n\tstate: {\n\t\tget startAnimation() {\n\t\t\treturn getContext().animation === 'start';\n\t\t},\n\t\tget finishAnimation() {\n\t\t\treturn getContext().animation === 'finish';\n\t\t},\n\t},\n\tactions: {\n\t\t*navigate( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )?.dataset\n\t\t\t\t.wpNavigationDisabled;\n\n\t\t\tif ( isValidLink( ref ) && isValidEvent( event ) && ! isDisabled ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst id = ref.closest( '[data-wp-navigation-id]' ).dataset\n\t\t\t\t\t.wpNavigationId;\n\n\t\t\t\t// Don't announce the navigation immediately, wait 400 ms.\n\t\t\t\tconst timeout = setTimeout( () => {\n\t\t\t\t\tctx.message = ctx.loadingText;\n\t\t\t\t\tctx.animation = 'start';\n\t\t\t\t}, 400 );\n\n\t\t\t\tyield navigate( ref.href );\n\n\t\t\t\t// Dismiss loading message if it hasn't been added yet.\n\t\t\t\tclearTimeout( timeout );\n\n\t\t\t\t// Announce that the page has been loaded. If the message is the\n\t\t\t\t// same, we use a no-break space similar to the @wordpress/a11y\n\t\t\t\t// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26\n\t\t\t\tctx.message =\n\t\t\t\t\tctx.loadedText +\n\t\t\t\t\t( ctx.message === ctx.loadedText ? '\\u00A0' : '' );\n\n\t\t\t\tctx.animation = 'finish';\n\t\t\t\tctx.url = ref.href;\n\n\t\t\t\t// Focus the first anchor of the Query block.\n\t\t\t\tconst firstAnchor = `[data-wp-navigation-id=${ id }] .wp-block-post-template a[href]`;\n\t\t\t\tdocument.querySelector( firstAnchor )?.focus();\n\t\t\t}\n\t\t},\n\t\t*prefetch() {\n\t\t\tconst { ref } = getElement();\n\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )?.dataset\n\t\t\t\t.wpNavigationDisabled;\n\t\t\tif ( isValidLink( ref ) && ! isDisabled ) {\n\t\t\t\tyield prefetch( ref.href );\n\t\t\t}\n\t\t},\n\t},\n\tcallbacks: {\n\t\t*prefetch() {\n\t\t\tconst { url } = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( url && isValidLink( ref ) ) {\n\t\t\t\tyield prefetch( ref.href );\n\t\t\t}\n\t\t},\n\t},\n} );\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AASA,MAAMC,WAAW,GAAKC,GAAG,IACxBA,GAAG,IACHA,GAAG,YAAYC,MAAM,CAACC,iBAAiB,IACvCF,GAAG,CAACG,IAAI,KACN,CAAEH,GAAG,CAACI,MAAM,IAAIJ,GAAG,CAACI,MAAM,KAAK,OAAO,CAAE,IAC1CJ,GAAG,CAACK,MAAM,KAAKJ,MAAM,CAACK,QAAQ,CAACD,MAAM;AAEtC,MAAME,YAAY,GAAKC,KAAK,IAC3BA,KAAK,CAACC,MAAM,KAAK,CAAC;AAAI;AACtB,CAAED,KAAK,CAACE,OAAO;AAAI;AACnB,CAAEF,KAAK,CAACG,OAAO;AAAI;AACnB,CAAEH,KAAK,CAACI,MAAM;AAAI;AAClB,CAAEJ,KAAK,CAACK,QAAQ,IAChB,CAAEL,KAAK,CAACM,gBAAgB;AAEzB,IAAAC,oBAAK,EAAE,YAAY,EAAE;EACpBC,KAAK,EAAE;IACN,IAAIC,cAAcA,CAAA,EAAG;MACpB,OAAO,IAAAC,yBAAU,EAAC,CAAC,CAACC,SAAS,KAAK,OAAO;IAC1C,CAAC;IACD,IAAIC,eAAeA,CAAA,EAAG;MACrB,OAAO,IAAAF,yBAAU,EAAC,CAAC,CAACC,SAAS,KAAK,QAAQ;IAC3C;EACD,CAA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AG,IAAAwB,yBAAU,EAAC,CAAC;MAC5B,MAAMC,UAAU,GAAGzB,GAAG,CAAC0B,OAAO,CAAE,yBAA0B,CAAC,EAAEC,OAAO,CAClEC,oBAAoB;MACtB,IAAK7B,WAAW,CAAEC,GAAI,CAAC,IAAI,CAAEyB,UAAU,EAAG;QACzC,MAAM,IAAAkB,uBAAQ,EAAE3C,GAAG,CAACG,IAAK,CAAC;MAC3B;IACD;EACD,CAAC;EACDyC,SAAS,EAAE;IACV,CAACD,QAAQA,CAAA,EAAG;MACX,MAAM;QAAEL;MAAI,CAAC,GAAG,IAAApB,yBAAU,EAAC,CAAC;MAC5B,MAAM;QAAElB;MAAI,CAAC,GAAG,IAAAwB,yBAAU,EAAC,CAAC;MAC5B,IAAKc,GAAG,IAAIvC,WAAW,CAAEC,GAAI,CAAC,EAAG;QAChC,MAAM,IAAA2C,uBAAQ,EAAE3C,GAAG,CAACG,IAAK,CAAC;MAC3B;IACD;EACD;AACD,CAAE,CAAC"}
@@ -5,83 +5,75 @@ var _interactivity = require("@wordpress/interactivity");
5
5
  * WordPress dependencies
6
6
  */
7
7
 
8
- (0, _interactivity.store)({
9
- selectors: {
10
- core: {
11
- search: {
12
- ariaLabel: ({
13
- context
14
- }) => {
15
- const {
16
- ariaLabelCollapsed,
17
- ariaLabelExpanded
18
- } = context.core.search;
19
- return context.core.search.isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed;
20
- },
21
- ariaControls: ({
22
- context
23
- }) => {
24
- return context.core.search.isSearchInputVisible ? null : context.core.search.inputId;
25
- },
26
- type: ({
27
- context
28
- }) => {
29
- return context.core.search.isSearchInputVisible ? 'submit' : 'button';
30
- },
31
- tabindex: ({
32
- context
33
- }) => {
34
- return context.core.search.isSearchInputVisible ? '0' : '-1';
35
- }
36
- }
8
+ const {
9
+ actions
10
+ } = (0, _interactivity.store)('core/search', {
11
+ state: {
12
+ get ariaLabel() {
13
+ const {
14
+ isSearchInputVisible,
15
+ ariaLabelCollapsed,
16
+ ariaLabelExpanded
17
+ } = (0, _interactivity.getContext)();
18
+ return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed;
19
+ },
20
+ get ariaControls() {
21
+ const {
22
+ isSearchInputVisible,
23
+ inputId
24
+ } = (0, _interactivity.getContext)();
25
+ return isSearchInputVisible ? null : inputId;
26
+ },
27
+ get type() {
28
+ const {
29
+ isSearchInputVisible
30
+ } = (0, _interactivity.getContext)();
31
+ return isSearchInputVisible ? 'submit' : 'button';
32
+ },
33
+ get tabindex() {
34
+ const {
35
+ isSearchInputVisible
36
+ } = (0, _interactivity.getContext)();
37
+ return isSearchInputVisible ? '0' : '-1';
37
38
  }
38
39
  },
39
40
  actions: {
40
- core: {
41
- search: {
42
- openSearchInput: ({
43
- context,
44
- event,
45
- ref
46
- }) => {
47
- if (!context.core.search.isSearchInputVisible) {
48
- event.preventDefault();
49
- context.core.search.isSearchInputVisible = true;
50
- ref.parentElement.querySelector('input').focus();
51
- }
52
- },
53
- closeSearchInput: ({
54
- context
55
- }) => {
56
- context.core.search.isSearchInputVisible = false;
57
- },
58
- handleSearchKeydown: store => {
59
- const {
60
- actions,
61
- event,
62
- ref
63
- } = store;
64
- // If Escape close the menu.
65
- if (event?.key === 'Escape') {
66
- actions.core.search.closeSearchInput(store);
67
- ref.querySelector('button').focus();
68
- }
69
- },
70
- handleSearchFocusout: store => {
71
- const {
72
- actions,
73
- event,
74
- ref
75
- } = store;
76
- // If focus is outside search form, and in the document, close menu
77
- // event.target === The element losing focus
78
- // event.relatedTarget === The element receiving focus (if any)
79
- // When focusout is outside the document,
80
- // `window.document.activeElement` doesn't change.
81
- if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
82
- actions.core.search.closeSearchInput(store);
83
- }
84
- }
41
+ openSearchInput(event) {
42
+ const ctx = (0, _interactivity.getContext)();
43
+ const {
44
+ ref
45
+ } = (0, _interactivity.getElement)();
46
+ if (!ctx.isSearchInputVisible) {
47
+ event.preventDefault();
48
+ ctx.isSearchInputVisible = true;
49
+ ref.parentElement.querySelector('input').focus();
50
+ }
51
+ },
52
+ closeSearchInput() {
53
+ const ctx = (0, _interactivity.getContext)();
54
+ ctx.isSearchInputVisible = false;
55
+ },
56
+ handleSearchKeydown(event) {
57
+ const {
58
+ ref
59
+ } = (0, _interactivity.getElement)();
60
+ // If Escape close the menu.
61
+ if (event?.key === 'Escape') {
62
+ actions.closeSearchInput();
63
+ ref.querySelector('button').focus();
64
+ }
65
+ },
66
+ handleSearchFocusout(event) {
67
+ const {
68
+ ref
69
+ } = (0, _interactivity.getElement)();
70
+ // If focus is outside search form, and in the document, close menu
71
+ // event.target === The element losing focus
72
+ // event.relatedTarget === The element receiving focus (if any)
73
+ // When focusout is outside the document,
74
+ // `window.document.activeElement` doesn't change.
75
+ if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
76
+ actions.closeSearchInput();
85
77
  }
86
78
  }
87
79
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_interactivity","require","wpStore","selectors","core","search","ariaLabel","context","ariaLabelCollapsed","ariaLabelExpanded","isSearchInputVisible","ariaControls","inputId","type","tabindex","actions","openSearchInput","event","ref","preventDefault","parentElement","querySelector","focus","closeSearchInput","handleSearchKeydown","store","key","handleSearchFocusout","contains","relatedTarget","target","window","document","activeElement"],"sources":["@wordpress/block-library/src/search/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as wpStore } from '@wordpress/interactivity';\n\nwpStore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tsearch: {\n\t\t\t\tariaLabel: ( { context } ) => {\n\t\t\t\t\tconst { ariaLabelCollapsed, ariaLabelExpanded } =\n\t\t\t\t\t\tcontext.core.search;\n\t\t\t\t\treturn context.core.search.isSearchInputVisible\n\t\t\t\t\t\t? ariaLabelExpanded\n\t\t\t\t\t\t: ariaLabelCollapsed;\n\t\t\t\t},\n\t\t\t\tariaControls: ( { context } ) => {\n\t\t\t\t\treturn context.core.search.isSearchInputVisible\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: context.core.search.inputId;\n\t\t\t\t},\n\t\t\t\ttype: ( { context } ) => {\n\t\t\t\t\treturn context.core.search.isSearchInputVisible\n\t\t\t\t\t\t? 'submit'\n\t\t\t\t\t\t: 'button';\n\t\t\t\t},\n\t\t\t\ttabindex: ( { context } ) => {\n\t\t\t\t\treturn context.core.search.isSearchInputVisible\n\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t: '-1';\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tactions: {\n\t\tcore: {\n\t\t\tsearch: {\n\t\t\t\topenSearchInput: ( { context, event, ref } ) => {\n\t\t\t\t\tif ( ! context.core.search.isSearchInputVisible ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tcontext.core.search.isSearchInputVisible = true;\n\t\t\t\t\t\tref.parentElement.querySelector( 'input' ).focus();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcloseSearchInput: ( { context } ) => {\n\t\t\t\t\tcontext.core.search.isSearchInputVisible = false;\n\t\t\t\t},\n\t\t\t\thandleSearchKeydown: ( store ) => {\n\t\t\t\t\tconst { actions, event, ref } = store;\n\t\t\t\t\t// If Escape close the menu.\n\t\t\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\t\t\tactions.core.search.closeSearchInput( store );\n\t\t\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\thandleSearchFocusout: ( store ) => {\n\t\t\t\t\tconst { actions, event, ref } = store;\n\t\t\t\t\t// If focus is outside search form, and in the document, close menu\n\t\t\t\t\t// event.target === The element losing focus\n\t\t\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t\t\t// When focusout is outside the document,\n\t\t\t\t\t// `window.document.activeElement` doesn't change.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! ref.contains( event.relatedTarget ) &&\n\t\t\t\t\t\tevent.target !== window.document.activeElement\n\t\t\t\t\t) {\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,IAAI,CAACC,MAAM,CAACK,oBAAoB,GAAG,IAAI;YAC/CQ,GAAG,CAACE,aAAa,CAACC,aAAa,CAAE,OAAQ,CAAC,CAACC,KAAK,CAAC,CAAC;UACnD;QACD,CAAC;QACDC,gBAAgB,EAAEA,CAAE;UAAEhB;QAAQ,CAAC,KAAM;UACpCA,OAAO,CAACH,IAAI,CAACC,MAAM,CAACK,oBAAoB,GAAG,KAAK;QACjD,CAAC;QACDc,mBAAmB,EAAIC,KAAK,IAAM;UACjC,MAAM;YAAEV,OAAO;YAAEE,KAAK;YAAEC;UAAI,CAAC,GAAGO,KAAK;UACrC;UACA,IAAKR,KAAK,EAAES,GAAG,KAAK,QAAQ,EAAG;YAC9BX,OAAO,CAACX,IAAI,CAACC,MAAM,CAACkB,gBAAgB,CAAEE,KAAM,CAAC;YAC7CP,GAAG,CAACG,aAAa,CAAE,QAAS,CAAC,CAACC,KAAK,CAAC,CAAC;UACtC;QACD,CAAC;QACDK,oBAAoB,EAAIF,KAAK,IAAM;UAClC,MAAM;YAAEV,OAAO;YAAEE,KAAK;YAAEC;UAAI,CAAC,GAAGO,KAAK;UACrC;UACA;UACA;UACA;UACA;UACA,IACC,CAAEP,GAAG,CAACU,QAAQ,CAAEX,KAAK,CAACY,aAAc,CAAC,IACrCZ,KAAK,CAACa,MAAM,KAAKC,MAAM,CAACC,QAAQ,CAACC,aAAa,EAC7C;YACDlB,OAAO,CAACX,IAAI,CAACC,MAAM,CAACkB,gBAAgB,CAAEE,KAAM,CAAC;UAC9C;QACD;MACD;IACD;EACD;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_interactivity","require","actions","store","state","ariaLabel","isSearchInputVisible","ariaLabelCollapsed","ariaLabelExpanded","getContext","ariaControls","inputId","type","tabindex","openSearchInput","event","ctx","ref","getElement","preventDefault","parentElement","querySelector","focus","closeSearchInput","handleSearchKeydown","key","handleSearchFocusout","contains","relatedTarget","target","window","document","activeElement"],"sources":["@wordpress/block-library/src/search/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst { actions } = store( 'core/search', {\n\tstate: {\n\t\tget ariaLabel() {\n\t\t\tconst {\n\t\t\t\tisSearchInputVisible,\n\t\t\t\tariaLabelCollapsed,\n\t\t\t\tariaLabelExpanded,\n\t\t\t} = getContext();\n\t\t\treturn isSearchInputVisible\n\t\t\t\t? ariaLabelExpanded\n\t\t\t\t: ariaLabelCollapsed;\n\t\t},\n\t\tget ariaControls() {\n\t\t\tconst { isSearchInputVisible, inputId } = getContext();\n\t\t\treturn isSearchInputVisible ? null : inputId;\n\t\t},\n\t\tget type() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? 'submit' : 'button';\n\t\t},\n\t\tget tabindex() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? '0' : '-1';\n\t\t},\n\t},\n\tactions: {\n\t\topenSearchInput( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( ! ctx.isSearchInputVisible ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tctx.isSearchInputVisible = true;\n\t\t\t\tref.parentElement.querySelector( 'input' ).focus();\n\t\t\t}\n\t\t},\n\t\tcloseSearchInput() {\n\t\t\tconst ctx = getContext();\n\t\t\tctx.isSearchInputVisible = false;\n\t\t},\n\t\thandleSearchKeydown( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If Escape close the menu.\n\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t}\n\t\t},\n\t\thandleSearchFocusout( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If focus is outside search form, and in the document, close menu\n\t\t\t// event.target === The element losing focus\n\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t// When focusout is outside the document,\n\t\t\t// `window.document.activeElement` doesn't change.\n\t\t\tif (\n\t\t\t\t! ref.contains( event.relatedTarget ) &&\n\t\t\t\tevent.target !== window.document.activeElement\n\t\t\t) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t}\n\t\t},\n\t},\n} );\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAM;EAAEC;AAAQ,CAAC,GAAG,IAAAC,oBAAK,EAAE,aAAa,EAAE;EACzCC,KAAK,EAAE;IACN,IAAIC,SAASA,CAAA,EAAG;MACf,MAAM;QACLC,oBAAoB;QACpBC,kBAAkB;QAClBC;MACD,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAChB,OAAOH,oBAAoB,GACxBE,iBAAiB,GACjBD,kBAAkB;IACtB,CAAC;IACD,IAAIG,YAAYA,CAAA,EAAG;MAClB,MAAM;QAAEJ,oBAAoB;QAAEK;MAAQ,CAAC,GAAG,IAAAF,yBAAU,EAAC,CAAC;MACtD,OAAOH,oBAAoB,GAAG,IAAI,GAAGK,OAAO;IAC7C,CAAC;IACD,IAAIC,IAAIA,CAAA,EAAG;MACV,MAAM;QAAEN;MAAqB,CAAC,GAAG,IAAAG,yBAAU,EAAC,CAAC;MAC7C,OAAOH,oBAAoB,GAAG,QAAQ,GAAG,QAAQ;IAClD,CAAC;IACD,IAAIO,QAAQA,CAAA,EAAG;MACd,MAAM;QAAEP;MAAqB,CAAC,GAAG,IAAAG,yBAAU,EAAC,CAAC;MAC7C,OAAOH,oBAAoB,GAAG,GAAG,GAAG,IAAI;IACzC;EACD,CAAC;EACDJ,OAAO,EAAE;IACRY,eAAeA,CAAEC,KAAK,EAAG;MACxB,MAAMC,GAAG,GAAG,IAAAP,yBAAU,EAAC,CAAC;MACxB,MAAM;QAAEQ;MAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAC5B,IAAK,CAAEF,GAAG,CAACV,oBAAoB,EAAG;QACjCS,KAAK,CAACI,cAAc,CAAC,CAAC;QACtBH,GAAG,CAACV,oBAAoB,GAAG,IAAI;QAC/BW,GAAG,CAACG,aAAa,CAACC,aAAa,CAAE,OAAQ,CAAC,CAACC,KAAK,CAAC,CAAC;MACnD;IACD,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MAClB,MAAMP,GAAG,GAAG,IAAAP,yBAAU,EAAC,CAAC;MACxBO,GAAG,CAACV,oBAAoB,GAAG,KAAK;IACjC,CAAC;IACDkB,mBAAmBA,CAAET,KAAK,EAAG;MAC5B,MAAM;QAAEE;MAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAC5B;MACA,IAAKH,KAAK,EAAEU,GAAG,KAAK,QAAQ,EAAG;QAC9BvB,OAAO,CAACqB,gBAAgB,CAAC,CAAC;QAC1BN,GAAG,CAACI,aAAa,CAAE,QAAS,CAAC,CAACC,KAAK,CAAC,CAAC;MACtC;IACD,CAAC;IACDI,oBAAoBA,CAAEX,KAAK,EAAG;MAC7B,MAAM;QAAEE;MAAI,CAAC,GAAG,IAAAC,yBAAU,EAAC,CAAC;MAC5B;MACA;MACA;MACA;MACA;MACA,IACC,CAAED,GAAG,CAACU,QAAQ,CAAEZ,KAAK,CAACa,aAAc,CAAC,IACrCb,KAAK,CAACc,MAAM,KAAKC,MAAM,CAACC,QAAQ,CAACC,aAAa,EAC7C;QACD9B,OAAO,CAACqB,gBAAgB,CAAC,CAAC;MAC3B;IACD;EACD;AACD,CAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = removeAnchorTag;
7
+ /**
8
+ * Removes anchor tags from a string.
9
+ *
10
+ * @param {string} value The value to remove anchor tags from.
11
+ *
12
+ * @return {string} The value with anchor tags removed.
13
+ */
14
+ function removeAnchorTag(value) {
15
+ return value.replace(/<\/?a[^>]*>/g, '');
16
+ }
17
+ //# sourceMappingURL=remove-anchor-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["removeAnchorTag","value","replace"],"sources":["@wordpress/block-library/src/utils/remove-anchor-tag.js"],"sourcesContent":["/**\n * Removes anchor tags from a string.\n *\n * @param {string} value The value to remove anchor tags from.\n *\n * @return {string} The value with anchor tags removed.\n */\nexport default function removeAnchorTag( value ) {\n\treturn value.replace( /<\\/?a[^>]*>/g, '' );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,eAAeA,CAAEC,KAAK,EAAG;EAChD,OAAOA,KAAK,CAACC,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAC3C"}
@@ -81,20 +81,15 @@ export default function ReusableBlockEdit({
81
81
  onChange,
82
82
  renderAppender: blocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
83
83
  });
84
+ let children = null;
84
85
  if (hasAlreadyRendered) {
85
- return createElement("div", {
86
- ...blockProps
87
- }, createElement(Warning, null, __('Block cannot be rendered inside itself.')));
86
+ children = createElement(Warning, null, __('Block cannot be rendered inside itself.'));
88
87
  }
89
88
  if (isMissing) {
90
- return createElement("div", {
91
- ...blockProps
92
- }, createElement(Warning, null, __('Block has been deleted or is unavailable.')));
89
+ children = createElement(Warning, null, __('Block has been deleted or is unavailable.'));
93
90
  }
94
91
  if (!hasResolved) {
95
- return createElement("div", {
96
- ...blockProps
97
- }, createElement(Placeholder, null, createElement(Spinner, null)));
92
+ children = createElement(Placeholder, null, createElement(Spinner, null));
98
93
  }
99
94
  return createElement(RecursionProvider, {
100
95
  uniqueId: ref
@@ -104,8 +99,10 @@ export default function ReusableBlockEdit({
104
99
  onChange: setTitle,
105
100
  __nextHasNoMarginBottom: true,
106
101
  __next40pxDefaultSize: true
107
- }))), createElement("div", {
102
+ }))), children === null ? createElement("div", {
108
103
  ...innerBlocksProps
109
- }));
104
+ }) : createElement("div", {
105
+ ...blockProps
106
+ }, children));
110
107
  }
111
108
  //# sourceMappingURL=edit.js.map