@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.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 (114) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +38 -17
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/categories/index.js +10 -3
  5. package/build/categories/index.js.map +1 -1
  6. package/build/categories/variations.js +43 -0
  7. package/build/categories/variations.js.map +1 -0
  8. package/build/embed/edit.js +1 -0
  9. package/build/embed/edit.js.map +1 -1
  10. package/build/embed/edit.native.js +1 -0
  11. package/build/embed/edit.native.js.map +1 -1
  12. package/build/embed/embed-preview.js +80 -100
  13. package/build/embed/embed-preview.js.map +1 -1
  14. package/build/embed/embed-preview.native.js +1 -0
  15. package/build/embed/embed-preview.native.js.map +1 -1
  16. package/build/form/view.js +1 -0
  17. package/build/form/view.js.map +1 -1
  18. package/build/image/image.js +5 -2
  19. package/build/image/image.js.map +1 -1
  20. package/build/index.js +1 -0
  21. package/build/index.js.map +1 -1
  22. package/build/navigation-submenu/index.js +13 -0
  23. package/build/navigation-submenu/index.js.map +1 -1
  24. package/build/post-template/edit.js +6 -1
  25. package/build/post-template/edit.js.map +1 -1
  26. package/build/post-title/index.js +1 -4
  27. package/build/post-title/index.js.map +1 -1
  28. package/build/query/edit/inspector-controls/format-controls.js +102 -0
  29. package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
  30. package/build/query/edit/inspector-controls/index.js +45 -9
  31. package/build/query/edit/inspector-controls/index.js.map +1 -1
  32. package/build/query/edit/query-content.js +26 -10
  33. package/build/query/edit/query-content.js.map +1 -1
  34. package/build/query/index.js +3 -1
  35. package/build/query/index.js.map +1 -1
  36. package/build/query/utils.js +12 -1
  37. package/build/query/utils.js.map +1 -1
  38. package/build/site-title/index.js +1 -4
  39. package/build/site-title/index.js.map +1 -1
  40. package/build/social-link/edit.js +13 -11
  41. package/build/social-link/edit.js.map +1 -1
  42. package/build-module/categories/edit.js +40 -19
  43. package/build-module/categories/edit.js.map +1 -1
  44. package/build-module/categories/index.js +10 -3
  45. package/build-module/categories/index.js.map +1 -1
  46. package/build-module/categories/variations.js +36 -0
  47. package/build-module/categories/variations.js.map +1 -0
  48. package/build-module/embed/edit.js +1 -0
  49. package/build-module/embed/edit.js.map +1 -1
  50. package/build-module/embed/edit.native.js +1 -0
  51. package/build-module/embed/edit.native.js.map +1 -1
  52. package/build-module/embed/embed-preview.js +80 -100
  53. package/build-module/embed/embed-preview.js.map +1 -1
  54. package/build-module/embed/embed-preview.native.js +1 -0
  55. package/build-module/embed/embed-preview.native.js.map +1 -1
  56. package/build-module/form/view.js +1 -0
  57. package/build-module/form/view.js.map +1 -1
  58. package/build-module/image/image.js +5 -2
  59. package/build-module/image/image.js.map +1 -1
  60. package/build-module/index.js +1 -0
  61. package/build-module/index.js.map +1 -1
  62. package/build-module/navigation-submenu/index.js +13 -0
  63. package/build-module/navigation-submenu/index.js.map +1 -1
  64. package/build-module/post-template/edit.js +6 -1
  65. package/build-module/post-template/edit.js.map +1 -1
  66. package/build-module/post-title/index.js +1 -4
  67. package/build-module/post-title/index.js.map +1 -1
  68. package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
  69. package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
  70. package/build-module/query/edit/inspector-controls/index.js +45 -9
  71. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  72. package/build-module/query/edit/query-content.js +27 -11
  73. package/build-module/query/edit/query-content.js.map +1 -1
  74. package/build-module/query/index.js +3 -1
  75. package/build-module/query/index.js.map +1 -1
  76. package/build-module/query/utils.js +12 -1
  77. package/build-module/query/utils.js.map +1 -1
  78. package/build-module/site-title/index.js +1 -4
  79. package/build-module/site-title/index.js.map +1 -1
  80. package/build-module/social-link/edit.js +14 -12
  81. package/build-module/social-link/edit.js.map +1 -1
  82. package/build-style/editor-rtl.css +1 -1
  83. package/build-style/editor.css +1 -1
  84. package/build-style/gallery/editor-rtl.css +1 -1
  85. package/build-style/gallery/editor.css +1 -1
  86. package/build-style/post-title/style-rtl.css +4 -18
  87. package/build-style/post-title/style.css +4 -18
  88. package/build-style/site-title/style-rtl.css +4 -18
  89. package/build-style/site-title/style.css +4 -18
  90. package/build-style/style-rtl.css +8 -36
  91. package/build-style/style.css +8 -36
  92. package/package.json +35 -35
  93. package/src/categories/block.json +7 -2
  94. package/src/categories/edit.js +69 -30
  95. package/src/categories/index.js +2 -0
  96. package/src/categories/index.php +21 -9
  97. package/src/categories/variations.js +40 -0
  98. package/src/comments-pagination-next/index.php +1 -1
  99. package/src/comments-pagination-previous/index.php +2 -1
  100. package/src/embed/embed-preview.js +96 -112
  101. package/src/image/image.js +2 -1
  102. package/src/navigation-submenu/block.json +13 -0
  103. package/src/post-template/edit.js +6 -0
  104. package/src/post-template/index.php +5 -0
  105. package/src/post-title/block.json +1 -4
  106. package/src/post-title/style.scss +4 -21
  107. package/src/query/block.json +3 -1
  108. package/src/query/edit/inspector-controls/format-controls.js +90 -0
  109. package/src/query/edit/inspector-controls/index.js +68 -9
  110. package/src/query/edit/query-content.js +38 -5
  111. package/src/query/utils.js +16 -1
  112. package/src/site-title/block.json +1 -4
  113. package/src/site-title/style.scss +4 -21
  114. package/src/social-link/edit.js +11 -7
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { useInstanceId } from '@wordpress/compose';
6
- import { useEffect } from '@wordpress/element';
6
+ import { useEffect, useCallback } from '@wordpress/element';
7
7
  import {
8
8
  BlockControls,
9
9
  InspectorControls,
@@ -32,6 +32,7 @@ export default function QueryContent( {
32
32
  openPatternSelectionModal,
33
33
  name,
34
34
  clientId,
35
+ context,
35
36
  } ) {
36
37
  const {
37
38
  queryId,
@@ -41,6 +42,7 @@ export default function QueryContent( {
41
42
  tagName: TagName = 'div',
42
43
  query: { inherit } = {},
43
44
  } = attributes;
45
+ const { postType } = context;
44
46
  const { __unstableMarkNextChangeAsNotPersistent } =
45
47
  useDispatch( blockEditorStore );
46
48
  const instanceId = useInstanceId( QueryContent );
@@ -48,6 +50,16 @@ export default function QueryContent( {
48
50
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
49
51
  template: TEMPLATE,
50
52
  } );
53
+ const isTemplate = useSelect(
54
+ ( select ) => {
55
+ const currentTemplate =
56
+ select( coreStore ).__experimentalGetTemplateForLink()?.type;
57
+ const isInTemplate = 'wp_template' === currentTemplate;
58
+ const isInSingularContent = postType !== undefined;
59
+ return isInTemplate && ! isInSingularContent;
60
+ },
61
+ [ postType ]
62
+ );
51
63
  const { postsPerPage } = useSelect( ( select ) => {
52
64
  const { getSettings } = select( blockEditorStore );
53
65
  const { getEntityRecord, getEntityRecordEdits, canUser } =
@@ -81,6 +93,10 @@ export default function QueryContent( {
81
93
  // Changes in query property (which is an object) need to be in the same callback,
82
94
  // because updates are batched after the render and changes in different query properties
83
95
  // would cause to override previous wanted changes.
96
+ const updateQuery = useCallback(
97
+ ( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),
98
+ [ query, setAttributes ]
99
+ );
84
100
  useEffect( () => {
85
101
  const newQuery = {};
86
102
  // When we inherit from global query always need to set the `perPage`
@@ -90,11 +106,24 @@ export default function QueryContent( {
90
106
  } else if ( ! query.perPage && postsPerPage ) {
91
107
  newQuery.perPage = postsPerPage;
92
108
  }
109
+ // We need to reset the `inherit` value if not in a template, as queries
110
+ // are not inherited when outside a template (e.g. when in singular content).
111
+ if ( ! isTemplate && query.inherit ) {
112
+ newQuery.inherit = false;
113
+ }
93
114
  if ( !! Object.keys( newQuery ).length ) {
94
115
  __unstableMarkNextChangeAsNotPersistent();
95
116
  updateQuery( newQuery );
96
117
  }
97
- }, [ query.perPage, postsPerPage, inherit ] );
118
+ }, [
119
+ query.perPage,
120
+ postsPerPage,
121
+ inherit,
122
+ isTemplate,
123
+ query.inherit,
124
+ __unstableMarkNextChangeAsNotPersistent,
125
+ updateQuery,
126
+ ] );
98
127
  // We need this for multi-query block pagination.
99
128
  // Query parameters for each block are scoped to their ID.
100
129
  useEffect( () => {
@@ -102,9 +131,12 @@ export default function QueryContent( {
102
131
  __unstableMarkNextChangeAsNotPersistent();
103
132
  setAttributes( { queryId: instanceId } );
104
133
  }
105
- }, [ queryId, instanceId ] );
106
- const updateQuery = ( newQuery ) =>
107
- setAttributes( { query: { ...query, ...newQuery } } );
134
+ }, [
135
+ queryId,
136
+ instanceId,
137
+ __unstableMarkNextChangeAsNotPersistent,
138
+ setAttributes,
139
+ ] );
108
140
  const updateDisplayLayout = ( newDisplayLayout ) =>
109
141
  setAttributes( {
110
142
  displayLayout: { ...displayLayout, ...newDisplayLayout },
@@ -135,6 +167,7 @@ export default function QueryContent( {
135
167
  setDisplayLayout={ updateDisplayLayout }
136
168
  setAttributes={ setAttributes }
137
169
  clientId={ clientId }
170
+ isTemplate={ isTemplate }
138
171
  />
139
172
  </InspectorControls>
140
173
  <BlockControls>
@@ -94,6 +94,7 @@ export const mapToIHasNameAndId = ( entities, path ) => {
94
94
  * Returns a helper object that contains:
95
95
  * 1. An `options` object from the available post types, to be passed to a `SelectControl`.
96
96
  * 2. A helper map with available taxonomies per post type.
97
+ * 3. A helper map with post format support per post type.
97
98
  *
98
99
  * @return {Object} The helper object related to post types.
99
100
  */
@@ -124,7 +125,21 @@ export const usePostTypes = () => {
124
125
  } ) ),
125
126
  [ postTypes ]
126
127
  );
127
- return { postTypesTaxonomiesMap, postTypesSelectOptions };
128
+ const postTypeFormatSupportMap = useMemo( () => {
129
+ if ( ! postTypes?.length ) {
130
+ return {};
131
+ }
132
+ return postTypes.reduce( ( accumulator, type ) => {
133
+ accumulator[ type.slug ] =
134
+ type.supports?.[ 'post-formats' ] || false;
135
+ return accumulator;
136
+ }, {} );
137
+ }, [ postTypes ] );
138
+ return {
139
+ postTypesTaxonomiesMap,
140
+ postTypesSelectOptions,
141
+ postTypeFormatSupportMap,
142
+ };
128
143
  };
129
144
 
130
145
  /**
@@ -75,8 +75,5 @@
75
75
  }
76
76
  },
77
77
  "editorStyle": "wp-block-site-title-editor",
78
- "style": "wp-block-site-title",
79
- "selectors": {
80
- "typography": ".wp-block-site-title > span, .wp-block-site-title > a"
81
- }
78
+ "style": "wp-block-site-title"
82
79
  }
@@ -2,31 +2,14 @@
2
2
  // This block has customizable padding, border-box makes that more predictable.
3
3
  box-sizing: border-box;
4
4
 
5
- &[style*="font-weight"] :where(a) {
6
- font-weight: inherit;
7
- }
8
- &[class*="-font-family"] :where(a),
9
- &[style*="font-family"] :where(a) {
5
+ :where(a) {
6
+ color: inherit;
10
7
  font-family: inherit;
11
- }
12
- &[class*="-font-size"] :where(a),
13
- &[style*="font-size"] :where(a) {
14
8
  font-size: inherit;
15
- }
16
- &[style*="line-height"] :where(a) {
17
- line-height: inherit;
18
- }
19
- &[style*="font-style"] :where(a) {
20
9
  font-style: inherit;
21
- }
22
- &[style*="letter-spacing"] :where(a) {
10
+ font-weight: inherit;
23
11
  letter-spacing: inherit;
24
- }
25
- &[style*="text-decoration"] :where(a) {
12
+ line-height: inherit;
26
13
  text-decoration: inherit;
27
14
  }
28
-
29
- :where(a) {
30
- color: inherit;
31
- }
32
15
  }
@@ -22,6 +22,7 @@ import {
22
22
  PanelBody,
23
23
  PanelRow,
24
24
  TextControl,
25
+ __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
25
26
  } from '@wordpress/components';
26
27
  import { __ } from '@wordpress/i18n';
27
28
  import { keyboardReturn } from '@wordpress/icons';
@@ -78,15 +79,18 @@ const SocialLinkURLPopover = ( {
78
79
  }
79
80
  removeBlock( clientId );
80
81
  } }
82
+ suffix={
83
+ <InputControlSuffixWrapper variant="control">
84
+ <Button
85
+ icon={ keyboardReturn }
86
+ label={ __( 'Apply' ) }
87
+ type="submit"
88
+ size="small"
89
+ />
90
+ </InputControlSuffixWrapper>
91
+ }
81
92
  />
82
93
  </div>
83
- <Button
84
- // TODO: Switch to `true` (40px size) if possible.
85
- __next40pxDefaultSize={ false }
86
- icon={ keyboardReturn }
87
- label={ __( 'Apply' ) }
88
- type="submit"
89
- />
90
94
  </form>
91
95
  </URLPopover>
92
96
  );