@wordpress/block-library 7.9.0 → 7.10.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 (205) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/comment-template/index.js +1 -1
  3. package/build/comments/deprecated.js +65 -0
  4. package/build/comments/deprecated.js.map +1 -0
  5. package/build/comments/index.js +5 -2
  6. package/build/comments/index.js.map +1 -1
  7. package/build/comments-pagination/index.js +1 -1
  8. package/build/comments-title/deprecated.js +1 -1
  9. package/build/comments-title/index.js +1 -1
  10. package/build/cover/edit/block-controls.js +2 -12
  11. package/build/cover/edit/block-controls.js.map +1 -1
  12. package/build/cover/edit/cover-placeholder.js +3 -1
  13. package/build/cover/edit/cover-placeholder.js.map +1 -1
  14. package/build/cover/edit/index.js +19 -4
  15. package/build/cover/edit/index.js.map +1 -1
  16. package/build/gallery/edit.js +9 -17
  17. package/build/gallery/edit.js.map +1 -1
  18. package/build/gallery/transforms.js +30 -20
  19. package/build/gallery/transforms.js.map +1 -1
  20. package/build/gallery/use-get-media.js +7 -18
  21. package/build/gallery/use-get-media.js.map +1 -1
  22. package/build/group/edit.js +1 -3
  23. package/build/group/edit.js.map +1 -1
  24. package/build/heading/heading-level-dropdown.js +2 -1
  25. package/build/heading/heading-level-dropdown.js.map +1 -1
  26. package/build/heading/index.js +9 -4
  27. package/build/heading/index.js.map +1 -1
  28. package/build/latest-posts/edit.js +1 -1
  29. package/build/latest-posts/edit.js.map +1 -1
  30. package/build/more/edit.js +2 -4
  31. package/build/more/edit.js.map +1 -1
  32. package/build/navigation/view.js +7 -4
  33. package/build/navigation/view.js.map +1 -1
  34. package/build/navigation-link/hooks.js +0 -16
  35. package/build/navigation-link/hooks.js.map +1 -1
  36. package/build/navigation-link/index.js +1 -1
  37. package/build/navigation-link/index.js.map +1 -1
  38. package/build/navigation-submenu/view.js +7 -4
  39. package/build/navigation-submenu/view.js.map +1 -1
  40. package/build/nextpage/edit.js +1 -3
  41. package/build/nextpage/edit.js.map +1 -1
  42. package/build/page-list/edit.js +2 -2
  43. package/build/page-list/edit.js.map +1 -1
  44. package/build/post-comments-form/edit.js +2 -4
  45. package/build/post-comments-form/edit.js.map +1 -1
  46. package/build/post-terms/index.js +1 -1
  47. package/build/post-terms/index.js.map +1 -1
  48. package/build/post-title/index.js +1 -0
  49. package/build/post-title/index.js.map +1 -1
  50. package/build/query/edit/inspector-controls/index.js +1 -1
  51. package/build/query/edit/inspector-controls/index.js.map +1 -1
  52. package/build/query/index.js +1 -1
  53. package/build/query/index.js.map +1 -1
  54. package/build/site-logo/edit.js +5 -13
  55. package/build/site-logo/edit.js.map +1 -1
  56. package/build/site-title/edit/level-toolbar.js +2 -1
  57. package/build/site-title/edit/level-toolbar.js.map +1 -1
  58. package/build/template-part/index.js +1 -1
  59. package/build/template-part/index.js.map +1 -1
  60. package/build/template-part/variations.js +0 -16
  61. package/build/template-part/variations.js.map +1 -1
  62. package/build/utils/clean-empty-object.js +5 -3
  63. package/build/utils/clean-empty-object.js.map +1 -1
  64. package/build/video/tracks-editor.js +9 -11
  65. package/build/video/tracks-editor.js.map +1 -1
  66. package/build-module/comment-template/index.js +1 -1
  67. package/build-module/comments/deprecated.js +54 -0
  68. package/build-module/comments/deprecated.js.map +1 -0
  69. package/build-module/comments/index.js +4 -2
  70. package/build-module/comments/index.js.map +1 -1
  71. package/build-module/comments-pagination/index.js +1 -1
  72. package/build-module/comments-title/deprecated.js +1 -1
  73. package/build-module/comments-title/index.js +1 -1
  74. package/build-module/cover/edit/block-controls.js +3 -13
  75. package/build-module/cover/edit/block-controls.js.map +1 -1
  76. package/build-module/cover/edit/cover-placeholder.js +3 -1
  77. package/build-module/cover/edit/cover-placeholder.js.map +1 -1
  78. package/build-module/cover/edit/index.js +19 -4
  79. package/build-module/cover/edit/index.js.map +1 -1
  80. package/build-module/gallery/edit.js +9 -16
  81. package/build-module/gallery/edit.js.map +1 -1
  82. package/build-module/gallery/transforms.js +30 -20
  83. package/build-module/gallery/transforms.js.map +1 -1
  84. package/build-module/gallery/use-get-media.js +6 -16
  85. package/build-module/gallery/use-get-media.js.map +1 -1
  86. package/build-module/group/edit.js +1 -3
  87. package/build-module/group/edit.js.map +1 -1
  88. package/build-module/heading/heading-level-dropdown.js +2 -1
  89. package/build-module/heading/heading-level-dropdown.js.map +1 -1
  90. package/build-module/heading/index.js +9 -4
  91. package/build-module/heading/index.js.map +1 -1
  92. package/build-module/latest-posts/edit.js +2 -2
  93. package/build-module/latest-posts/edit.js.map +1 -1
  94. package/build-module/more/edit.js +2 -4
  95. package/build-module/more/edit.js.map +1 -1
  96. package/build-module/navigation/view.js +7 -4
  97. package/build-module/navigation/view.js.map +1 -1
  98. package/build-module/navigation-link/hooks.js +0 -13
  99. package/build-module/navigation-link/hooks.js.map +1 -1
  100. package/build-module/navigation-link/index.js +1 -1
  101. package/build-module/navigation-link/index.js.map +1 -1
  102. package/build-module/navigation-submenu/view.js +7 -4
  103. package/build-module/navigation-submenu/view.js.map +1 -1
  104. package/build-module/nextpage/edit.js +1 -3
  105. package/build-module/nextpage/edit.js.map +1 -1
  106. package/build-module/page-list/edit.js +2 -2
  107. package/build-module/page-list/edit.js.map +1 -1
  108. package/build-module/post-comments-form/edit.js +2 -4
  109. package/build-module/post-comments-form/edit.js.map +1 -1
  110. package/build-module/post-terms/index.js +1 -1
  111. package/build-module/post-terms/index.js.map +1 -1
  112. package/build-module/post-title/index.js +1 -0
  113. package/build-module/post-title/index.js.map +1 -1
  114. package/build-module/query/edit/inspector-controls/index.js +1 -1
  115. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  116. package/build-module/query/index.js +1 -1
  117. package/build-module/query/index.js.map +1 -1
  118. package/build-module/site-logo/edit.js +5 -13
  119. package/build-module/site-logo/edit.js.map +1 -1
  120. package/build-module/site-title/edit/level-toolbar.js +2 -1
  121. package/build-module/site-title/edit/level-toolbar.js.map +1 -1
  122. package/build-module/template-part/index.js +1 -1
  123. package/build-module/template-part/index.js.map +1 -1
  124. package/build-module/template-part/variations.js +0 -13
  125. package/build-module/template-part/variations.js.map +1 -1
  126. package/build-module/utils/clean-empty-object.js +5 -2
  127. package/build-module/utils/clean-empty-object.js.map +1 -1
  128. package/build-module/video/tracks-editor.js +9 -11
  129. package/build-module/video/tracks-editor.js.map +1 -1
  130. package/build-style/comment-template/style-rtl.css +12 -0
  131. package/build-style/comment-template/style.css +12 -0
  132. package/build-style/editor-rtl.css +1 -1
  133. package/build-style/editor.css +1 -1
  134. package/build-style/elements-rtl.css +82 -0
  135. package/build-style/elements.css +82 -0
  136. package/build-style/query/editor-rtl.css +1 -1
  137. package/build-style/query/editor.css +1 -1
  138. package/build-style/search/theme-rtl.css +5 -0
  139. package/build-style/search/theme.css +5 -0
  140. package/build-style/style-rtl.css +19 -0
  141. package/build-style/style.css +19 -0
  142. package/build-style/theme-rtl.css +5 -0
  143. package/build-style/theme.css +5 -0
  144. package/package.json +28 -28
  145. package/src/comment-template/block.json +1 -1
  146. package/src/comment-template/style.scss +14 -0
  147. package/src/comments/block.json +1 -1
  148. package/src/comments/deprecated.js +53 -0
  149. package/src/comments/index.js +2 -0
  150. package/src/comments-pagination/block.json +1 -1
  151. package/src/comments-title/block.json +1 -1
  152. package/src/cover/edit/block-controls.js +4 -20
  153. package/src/cover/edit/cover-placeholder.js +2 -0
  154. package/src/cover/edit/index.js +16 -0
  155. package/src/elements.scss +6 -0
  156. package/src/gallery/edit.js +8 -21
  157. package/src/gallery/index.php +1 -1
  158. package/src/gallery/transforms.js +25 -10
  159. package/src/gallery/use-get-media.js +11 -28
  160. package/src/group/edit.js +1 -3
  161. package/src/heading/heading-level-dropdown.js +1 -0
  162. package/src/heading/index.js +8 -2
  163. package/src/latest-posts/edit.js +2 -6
  164. package/src/more/edit.js +9 -11
  165. package/src/navigation/style.scss +1 -1
  166. package/src/navigation/view.js +6 -6
  167. package/src/navigation-link/hooks.js +0 -14
  168. package/src/navigation-link/index.js +1 -1
  169. package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
  170. package/src/navigation-link/test/hooks.js +0 -12
  171. package/src/navigation-submenu/view.js +6 -6
  172. package/src/nextpage/edit.js +1 -3
  173. package/src/page-list/edit.js +3 -5
  174. package/src/post-comments-form/edit.js +4 -7
  175. package/src/post-template/index.php +8 -14
  176. package/src/post-terms/index.js +1 -1
  177. package/src/post-title/block.json +1 -0
  178. package/src/query/edit/inspector-controls/index.js +1 -1
  179. package/src/query/editor.scss +1 -1
  180. package/src/query/index.js +1 -1
  181. package/src/query-no-results/index.php +10 -8
  182. package/src/search/theme.scss +5 -0
  183. package/src/site-logo/edit.js +2 -11
  184. package/src/site-title/edit/level-toolbar.js +1 -0
  185. package/src/social-link/index.php +16 -0
  186. package/src/style.scss +1 -0
  187. package/src/template-part/index.js +1 -1
  188. package/src/template-part/variations.js +0 -11
  189. package/src/utils/clean-empty-object.js +8 -2
  190. package/src/video/tracks-editor.js +1 -1
  191. package/build/gallery/use-short-code-transform.js +0 -64
  192. package/build/gallery/use-short-code-transform.js.map +0 -1
  193. package/build/navigation-link/fallback-variations.js +0 -75
  194. package/build/navigation-link/fallback-variations.js.map +0 -1
  195. package/build/template-part/fallback-variations.js +0 -59
  196. package/build/template-part/fallback-variations.js.map +0 -1
  197. package/build-module/gallery/use-short-code-transform.js +0 -54
  198. package/build-module/gallery/use-short-code-transform.js.map +0 -1
  199. package/build-module/navigation-link/fallback-variations.js +0 -65
  200. package/build-module/navigation-link/fallback-variations.js.map +0 -1
  201. package/build-module/template-part/fallback-variations.js +0 -47
  202. package/build-module/template-part/fallback-variations.js.map +0 -1
  203. package/src/gallery/use-short-code-transform.js +0 -55
  204. package/src/navigation-link/fallback-variations.js +0 -65
  205. package/src/template-part/fallback-variations.js +0 -51
@@ -1,65 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { category as categoryIcon, page as pageIcon, postContent as postIcon, tag as tagIcon } from '@wordpress/icons'; // FALLBACK: this is only used when the server does not understand the variations property in the
6
- // register_block_type call. see navigation-link/index.php.
7
- // Delete this file when supported WP ranges understand the `variations` property when passed to
8
- // register_block_type in index.php.
9
-
10
- const fallbackVariations = [{
11
- name: 'link',
12
- isDefault: true,
13
- title: __('Custom Link'),
14
- description: __('A link to a custom URL.'),
15
- attributes: {}
16
- }, {
17
- name: 'post',
18
- icon: postIcon,
19
- title: __('Post Link'),
20
- description: __('A link to a post.'),
21
- attributes: {
22
- type: 'post',
23
- kind: 'post-type'
24
- }
25
- }, {
26
- name: 'page',
27
- icon: pageIcon,
28
- title: __('Page Link'),
29
- description: __('A link to a page.'),
30
- attributes: {
31
- type: 'page',
32
- kind: 'post-type'
33
- }
34
- }, {
35
- name: 'category',
36
- icon: categoryIcon,
37
- title: __('Category Link'),
38
- description: __('A link to a category.'),
39
- attributes: {
40
- type: 'category',
41
- kind: 'taxonomy'
42
- }
43
- }, {
44
- name: 'tag',
45
- icon: tagIcon,
46
- title: __('Tag Link'),
47
- description: __('A link to a tag.'),
48
- attributes: {
49
- type: 'tag',
50
- kind: 'taxonomy'
51
- }
52
- }];
53
- /**
54
- * Add `isActive` function to all `navigation link` variations, if not defined.
55
- * `isActive` function is used to find a variation match from a created
56
- * Block by providing its attributes.
57
- */
58
-
59
- fallbackVariations.forEach(variation => {
60
- if (variation.isActive) return;
61
-
62
- variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
63
- });
64
- export default fallbackVariations;
65
- //# sourceMappingURL=fallback-variations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation-link/fallback-variations.js"],"names":["__","category","categoryIcon","page","pageIcon","postContent","postIcon","tag","tagIcon","fallbackVariations","name","isDefault","title","description","attributes","icon","type","kind","forEach","variation","isActive","blockAttributes","variationAttributes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,QAAQ,IAAIC,YADb,EAECC,IAAI,IAAIC,QAFT,EAGCC,WAAW,IAAIC,QAHhB,EAICC,GAAG,IAAIC,OAJR,QAKO,kBALP,C,CAOA;AACA;AACA;AACA;;AACA,MAAMC,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,MADP;AAECC,EAAAA,SAAS,EAAE,IAFZ;AAGCC,EAAAA,KAAK,EAAEZ,EAAE,CAAE,aAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,yBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AALb,CAD0B,EAQ1B;AACCJ,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAET,QAFP;AAGCM,EAAAA,KAAK,EAAEZ,EAAE,CAAE,WAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,mBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAR0B,EAe1B;AACCP,EAAAA,IAAI,EAAE,MADP;AAECK,EAAAA,IAAI,EAAEX,QAFP;AAGCQ,EAAAA,KAAK,EAAEZ,EAAE,CAAE,WAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,mBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,MAAR;AAAgBC,IAAAA,IAAI,EAAE;AAAtB;AALb,CAf0B,EAsB1B;AACCP,EAAAA,IAAI,EAAE,UADP;AAECK,EAAAA,IAAI,EAAEb,YAFP;AAGCU,EAAAA,KAAK,EAAEZ,EAAE,CAAE,eAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,uBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,UAAR;AAAoBC,IAAAA,IAAI,EAAE;AAA1B;AALb,CAtB0B,EA6B1B;AACCP,EAAAA,IAAI,EAAE,KADP;AAECK,EAAAA,IAAI,EAAEP,OAFP;AAGCI,EAAAA,KAAK,EAAEZ,EAAE,CAAE,UAAF,CAHV;AAICa,EAAAA,WAAW,EAAEb,EAAE,CAAE,kBAAF,CAJhB;AAKCc,EAAAA,UAAU,EAAE;AAAEE,IAAAA,IAAI,EAAE,KAAR;AAAeC,IAAAA,IAAI,EAAE;AAArB;AALb,CA7B0B,CAA3B;AAsCA;AACA;AACA;AACA;AACA;;AACAR,kBAAkB,CAACS,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KACpBD,eAAe,CAACL,IAAhB,KAAyBM,mBAAmB,CAACN,IAD9C;AAEA,CAJD;AAMA,eAAeP,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcategory as categoryIcon,\n\tpage as pageIcon,\n\tpostContent as postIcon,\n\ttag as tagIcon,\n} from '@wordpress/icons';\n\n// FALLBACK: this is only used when the server does not understand the variations property in the\n// register_block_type call. see navigation-link/index.php.\n// Delete this file when supported WP ranges understand the `variations` property when passed to\n// register_block_type in index.php.\nconst fallbackVariations = [\n\t{\n\t\tname: 'link',\n\t\tisDefault: true,\n\t\ttitle: __( 'Custom Link' ),\n\t\tdescription: __( 'A link to a custom URL.' ),\n\t\tattributes: {},\n\t},\n\t{\n\t\tname: 'post',\n\t\ticon: postIcon,\n\t\ttitle: __( 'Post Link' ),\n\t\tdescription: __( 'A link to a post.' ),\n\t\tattributes: { type: 'post', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'page',\n\t\ticon: pageIcon,\n\t\ttitle: __( 'Page Link' ),\n\t\tdescription: __( 'A link to a page.' ),\n\t\tattributes: { type: 'page', kind: 'post-type' },\n\t},\n\t{\n\t\tname: 'category',\n\t\ticon: categoryIcon,\n\t\ttitle: __( 'Category Link' ),\n\t\tdescription: __( 'A link to a category.' ),\n\t\tattributes: { type: 'category', kind: 'taxonomy' },\n\t},\n\t{\n\t\tname: 'tag',\n\t\ticon: tagIcon,\n\t\ttitle: __( 'Tag Link' ),\n\t\tdescription: __( 'A link to a tag.' ),\n\t\tattributes: { type: 'tag', kind: 'taxonomy' },\n\t},\n];\n\n/**\n * Add `isActive` function to all `navigation link` variations, if not defined.\n * `isActive` function is used to find a variation match from a created\n * Block by providing its attributes.\n */\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) =>\n\t\tblockAttributes.type === variationAttributes.type;\n} );\n\nexport default fallbackVariations;\n"]}
@@ -1,47 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { header as headerIcon, footer as footerIcon } from '@wordpress/icons';
6
- import { store as coreDataStore } from '@wordpress/core-data';
7
- import { select } from '@wordpress/data';
8
- const fallbackVariations = [{
9
- name: 'header',
10
- icon: headerIcon,
11
- title: __('Header'),
12
- description: __('The Header template defines a page area that typically contains a title, logo, and main navigation.'),
13
- attributes: {
14
- area: 'header'
15
- },
16
- scope: ['inserter']
17
- }, {
18
- name: 'footer',
19
- icon: footerIcon,
20
- title: __('Footer'),
21
- description: __('The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'),
22
- attributes: {
23
- area: 'footer'
24
- },
25
- scope: ['inserter']
26
- }];
27
- fallbackVariations.forEach(variation => {
28
- if (variation.isActive) return;
29
-
30
- variation.isActive = (blockAttributes, variationAttributes) => {
31
- const {
32
- area,
33
- theme,
34
- slug
35
- } = blockAttributes; // We first check the `area` block attribute which is set during insertion.
36
- // This property is removed on the creation of a template part.
37
-
38
- if (area) return area === variationAttributes.area; // Find a matching variation from the created template part
39
- // by checking the entity's `area` property.
40
-
41
- if (!slug) return false;
42
- const entity = select(coreDataStore).getEntityRecord('postType', 'wp_template_part', `${theme}//${slug}`);
43
- return (entity === null || entity === void 0 ? void 0 : entity.area) === variationAttributes.area;
44
- };
45
- });
46
- export default fallbackVariations;
47
- //# sourceMappingURL=fallback-variations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/fallback-variations.js"],"names":["__","header","headerIcon","footer","footerIcon","store","coreDataStore","select","fallbackVariations","name","icon","title","description","attributes","area","scope","forEach","variation","isActive","blockAttributes","variationAttributes","theme","slug","entity","getEntityRecord"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,MAAM,IAAIC,UAAzC,QAA2D,kBAA3D;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,MAAT,QAAuB,iBAAvB;AAEA,MAAMC,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAER,UAFP;AAGCS,EAAAA,KAAK,EAAEX,EAAE,CAAE,QAAF,CAHV;AAICY,EAAAA,WAAW,EAAEZ,EAAE,CACd,qGADc,CAJhB;AAOCa,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAD0B,EAW1B;AACCN,EAAAA,IAAI,EAAE,QADP;AAECC,EAAAA,IAAI,EAAEN,UAFP;AAGCO,EAAAA,KAAK,EAAEX,EAAE,CAAE,QAAF,CAHV;AAICY,EAAAA,WAAW,EAAEZ,EAAE,CACd,iIADc,CAJhB;AAOCa,EAAAA,UAAU,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAPb;AAQCC,EAAAA,KAAK,EAAE,CAAE,UAAF;AARR,CAX0B,CAA3B;AAuBAP,kBAAkB,CAACQ,OAAnB,CAA8BC,SAAF,IAAiB;AAC5C,MAAKA,SAAS,CAACC,QAAf,EAA0B;;AAC1BD,EAAAA,SAAS,CAACC,QAAV,GAAqB,CAAEC,eAAF,EAAmBC,mBAAnB,KAA4C;AAChE,UAAM;AAAEN,MAAAA,IAAF;AAAQO,MAAAA,KAAR;AAAeC,MAAAA;AAAf,QAAwBH,eAA9B,CADgE,CAEhE;AACA;;AACA,QAAKL,IAAL,EAAY,OAAOA,IAAI,KAAKM,mBAAmB,CAACN,IAApC,CAJoD,CAKhE;AACA;;AACA,QAAK,CAAEQ,IAAP,EAAc,OAAO,KAAP;AACd,UAAMC,MAAM,GAAGhB,MAAM,CAAED,aAAF,CAAN,CAAwBkB,eAAxB,CACd,UADc,EAEd,kBAFc,EAGb,GAAGH,KAAO,KAAKC,IAAM,EAHR,CAAf;AAKA,WAAO,CAAAC,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAET,IAAR,MAAiBM,mBAAmB,CAACN,IAA5C;AACA,GAdD;AAeA,CAjBD;AAmBA,eAAeN,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { header as headerIcon, footer as footerIcon } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\n\nconst fallbackVariations = [\n\t{\n\t\tname: 'header',\n\t\ticon: headerIcon,\n\t\ttitle: __( 'Header' ),\n\t\tdescription: __(\n\t\t\t'The Header template defines a page area that typically contains a title, logo, and main navigation.'\n\t\t),\n\t\tattributes: { area: 'header' },\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tname: 'footer',\n\t\ticon: footerIcon,\n\t\ttitle: __( 'Footer' ),\n\t\tdescription: __(\n\t\t\t'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'\n\t\t),\n\t\tattributes: { area: 'footer' },\n\t\tscope: [ 'inserter' ],\n\t},\n];\n\nfallbackVariations.forEach( ( variation ) => {\n\tif ( variation.isActive ) return;\n\tvariation.isActive = ( blockAttributes, variationAttributes ) => {\n\t\tconst { area, theme, slug } = blockAttributes;\n\t\t// We first check the `area` block attribute which is set during insertion.\n\t\t// This property is removed on the creation of a template part.\n\t\tif ( area ) return area === variationAttributes.area;\n\t\t// Find a matching variation from the created template part\n\t\t// by checking the entity's `area` property.\n\t\tif ( ! slug ) return false;\n\t\tconst entity = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t`${ theme }//${ slug }`\n\t\t);\n\t\treturn entity?.area === variationAttributes.area;\n\t};\n} );\n\nexport default fallbackVariations;\n"]}
@@ -1,55 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { every } from 'lodash';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { useSelect } from '@wordpress/data';
10
- import { store as coreStore } from '@wordpress/core-data';
11
-
12
- /**
13
- * Shortcode transforms don't currently have a tranform method and so can't use a selector to
14
- * retrieve the data for each image being transformer, so this selector handle this post transformation.
15
- *
16
- * @param {Array} shortCodeTransforms An array of image data passed from the shortcode transform.
17
- *
18
- * @return {Array} An array of extended image data objects for each of the shortcode transform images.
19
- */
20
- export default function useShortCodeTransform( shortCodeTransforms ) {
21
- const newImageData = useSelect(
22
- ( select ) => {
23
- if ( ! shortCodeTransforms || shortCodeTransforms.length === 0 ) {
24
- return;
25
- }
26
-
27
- const imageIds = shortCodeTransforms.map( ( image ) => image.id );
28
-
29
- return select( coreStore ).getMediaItems( {
30
- include: imageIds.join( ',' ),
31
- per_page: imageIds.length,
32
- orderby: 'include',
33
- } );
34
- },
35
- [ shortCodeTransforms ]
36
- );
37
-
38
- if ( ! newImageData ) {
39
- return;
40
- }
41
-
42
- if ( every( newImageData, ( img ) => img && img.source_url ) ) {
43
- return newImageData.map( ( imageData ) => {
44
- return {
45
- id: imageData.id,
46
- type: 'image',
47
- url: imageData.source_url,
48
- mime: imageData.mime_type,
49
- alt: imageData.alt_text,
50
- link: imageData.link,
51
- caption: imageData?.caption?.raw,
52
- };
53
- } );
54
- }
55
- }
@@ -1,65 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import {
6
- category as categoryIcon,
7
- page as pageIcon,
8
- postContent as postIcon,
9
- tag as tagIcon,
10
- } from '@wordpress/icons';
11
-
12
- // FALLBACK: this is only used when the server does not understand the variations property in the
13
- // register_block_type call. see navigation-link/index.php.
14
- // Delete this file when supported WP ranges understand the `variations` property when passed to
15
- // register_block_type in index.php.
16
- const fallbackVariations = [
17
- {
18
- name: 'link',
19
- isDefault: true,
20
- title: __( 'Custom Link' ),
21
- description: __( 'A link to a custom URL.' ),
22
- attributes: {},
23
- },
24
- {
25
- name: 'post',
26
- icon: postIcon,
27
- title: __( 'Post Link' ),
28
- description: __( 'A link to a post.' ),
29
- attributes: { type: 'post', kind: 'post-type' },
30
- },
31
- {
32
- name: 'page',
33
- icon: pageIcon,
34
- title: __( 'Page Link' ),
35
- description: __( 'A link to a page.' ),
36
- attributes: { type: 'page', kind: 'post-type' },
37
- },
38
- {
39
- name: 'category',
40
- icon: categoryIcon,
41
- title: __( 'Category Link' ),
42
- description: __( 'A link to a category.' ),
43
- attributes: { type: 'category', kind: 'taxonomy' },
44
- },
45
- {
46
- name: 'tag',
47
- icon: tagIcon,
48
- title: __( 'Tag Link' ),
49
- description: __( 'A link to a tag.' ),
50
- attributes: { type: 'tag', kind: 'taxonomy' },
51
- },
52
- ];
53
-
54
- /**
55
- * Add `isActive` function to all `navigation link` variations, if not defined.
56
- * `isActive` function is used to find a variation match from a created
57
- * Block by providing its attributes.
58
- */
59
- fallbackVariations.forEach( ( variation ) => {
60
- if ( variation.isActive ) return;
61
- variation.isActive = ( blockAttributes, variationAttributes ) =>
62
- blockAttributes.type === variationAttributes.type;
63
- } );
64
-
65
- export default fallbackVariations;
@@ -1,51 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { header as headerIcon, footer as footerIcon } from '@wordpress/icons';
6
- import { store as coreDataStore } from '@wordpress/core-data';
7
- import { select } from '@wordpress/data';
8
-
9
- const fallbackVariations = [
10
- {
11
- name: 'header',
12
- icon: headerIcon,
13
- title: __( 'Header' ),
14
- description: __(
15
- 'The Header template defines a page area that typically contains a title, logo, and main navigation.'
16
- ),
17
- attributes: { area: 'header' },
18
- scope: [ 'inserter' ],
19
- },
20
- {
21
- name: 'footer',
22
- icon: footerIcon,
23
- title: __( 'Footer' ),
24
- description: __(
25
- 'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'
26
- ),
27
- attributes: { area: 'footer' },
28
- scope: [ 'inserter' ],
29
- },
30
- ];
31
-
32
- fallbackVariations.forEach( ( variation ) => {
33
- if ( variation.isActive ) return;
34
- variation.isActive = ( blockAttributes, variationAttributes ) => {
35
- const { area, theme, slug } = blockAttributes;
36
- // We first check the `area` block attribute which is set during insertion.
37
- // This property is removed on the creation of a template part.
38
- if ( area ) return area === variationAttributes.area;
39
- // Find a matching variation from the created template part
40
- // by checking the entity's `area` property.
41
- if ( ! slug ) return false;
42
- const entity = select( coreDataStore ).getEntityRecord(
43
- 'postType',
44
- 'wp_template_part',
45
- `${ theme }//${ slug }`
46
- );
47
- return entity?.area === variationAttributes.area;
48
- };
49
- } );
50
-
51
- export default fallbackVariations;