@secretstache/wordpress-gutenberg 0.3.6 → 0.3.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,9 +37,12 @@ export const useDataQuery = (props) => {
37
37
  const isResolving = select('core/data').isResolving('core', 'getEntityRecords', ['postType', postType, queryArgs]);
38
38
  const isLoading = isResolving || postsToShow === undefined;
39
39
 
40
+ const isEmpty = postsToShow !== null && postsToShow?.length === 0;
41
+
40
42
  return {
41
43
  postsToShow,
42
44
  isLoading,
45
+ isEmpty,
43
46
  };
44
47
  }, dependencies);
45
48
  }
@@ -135,21 +135,38 @@ export const getDataQueryAttributes = (
135
135
  /**
136
136
  * Returns the base background attribute object with configurable default background color and media type.
137
137
  *
138
- * @param {string} [defaultBackgroundMediaType=''] - The default background media type.
139
- * @param {Object} defaultBackgroundColor - The background color configuration.
140
- * @param {string} defaultBackgroundColor.value - The hex value of the background color.
141
- * @param {string} defaultBackgroundColor.slug - The slug of the background color.
138
+ * @param {Object} options - The options for configuring the background attributes.
139
+ * @param {string} [options.defaultBackgroundMediaType=''] - The default background media type.
140
+ * @param {Object} options.defaultBackgroundColor - The background color configuration.
141
+ * @param {string} options.defaultBackgroundColor.value - The hex value of the background color.
142
+ * @param {string} options.defaultBackgroundColor.slug - The slug of the background color.
143
+ * @param {boolean} [options.hasIncludeBackgroundMediaAttribute=false] - Whether to include the background media attribute.
144
+ * @param {boolean} [options.hasIncludeOverlayAttribute=false] - Whether to include the overlay attribute.
142
145
  * @returns {Object} The base background attribute object.
143
146
  */
144
- export const getBaseBackgroundAttributes = (
147
+ export const getBaseBackgroundAttributes = ({
145
148
  defaultBackgroundMediaType = '',
146
149
  defaultBackgroundColor = { value: '', slug: '' },
147
- ) => {
148
- return {
150
+ hasIncludeBackgroundMediaAttribute = false,
151
+ hasIncludeOverlayAttribute = false,
152
+ } = {}) => {
153
+ const isIncludeOverlayAttribute = {
154
+ isIncludeOverlay: {
155
+ type: 'boolean',
156
+ default: false,
157
+ }
158
+ };
159
+
160
+ const isIncludeBackgroundMediaAttribute = {
149
161
  isIncludeBackgroundMedia: {
150
162
  type: 'boolean',
151
163
  default: false,
152
- },
164
+ }
165
+ };
166
+
167
+ return {
168
+ ...(hasIncludeBackgroundMediaAttribute ? isIncludeBackgroundMediaAttribute : {}),
169
+
153
170
  backgroundMediaType: {
154
171
  type: 'string',
155
172
  default: defaultBackgroundMediaType,
@@ -161,10 +178,7 @@ export const getBaseBackgroundAttributes = (
161
178
 
162
179
  ...mediaAttribute,
163
180
 
164
- isIncludeOverlay: {
165
- type: 'boolean',
166
- default: false,
167
- },
181
+ ...(hasIncludeOverlayAttribute ? isIncludeOverlayAttribute : {}),
168
182
  };
169
183
  };
170
184