@eightshift/frontend-libs-tailwind 1.3.0 → 1.3.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
6
6
 
7
+ ## [1.3.2] - 2024-09-19
8
+ - Fixing theme options to use stringified JSON instead of an object.
9
+
10
+ ## [1.3.1] - 2024-09-13
11
+ - Helper `getFilteredAttributes` used on SSR components to filter out unwanted attributes and optimize the output.
12
+
7
13
  ## [1.3.0] - 2024-08-08
8
14
  - `twClasses` and `twClassesEditor` can now be passed as an array
9
15
  - Updated schemas to account for the `twClasses`/`twClassesEditor` changes.
@@ -40,6 +46,8 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
40
46
 
41
47
  [Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
42
48
 
49
+ [1.3.2]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.1...1.3.2
50
+ [1.3.1]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.0...1.3.1
43
51
  [1.3.0]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.2.0...1.3.0
44
52
  [1.2.0]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.1.1...1.2.0
45
53
  [1.1.1]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.1.0...1.1.1
@@ -51,7 +51,7 @@
51
51
  "default": "metadata"
52
52
  },
53
53
  "videoPosterId": {
54
- "type": "string"
54
+ "type": "number"
55
55
  },
56
56
  "videoPosterUrl": {
57
57
  "type": "string"
@@ -26,7 +26,6 @@ if (empty($videoUrl)) {
26
26
  }
27
27
 
28
28
  $videoMimeType = Helpers::checkAttr('videoMimeType', $attributes, $manifest);
29
- $videoPosterId = Helpers::checkAttr('videoPosterId', $attributes, $manifest);
30
29
  $videoPosterUrl = Helpers::checkAttr('videoPosterUrl', $attributes, $manifest);
31
30
  $videoLoop = Helpers::checkAttr('videoLoop', $attributes, $manifest);
32
31
  $videoAutoplay = Helpers::checkAttr('videoAutoplay', $attributes, $manifest);
@@ -47,7 +46,6 @@ $additionalAttributes = Helpers::classnames([
47
46
  class="<?php echo esc_attr(Helpers::getTwPart('video', $manifest)); ?>"
48
47
  <?php echo esc_attr($additionalAttributes); ?>
49
48
  preload="<?php echo esc_attr($videoPreload); ?>"
50
- poster="<?php echo esc_attr($videoPosterUrl); ?>"
51
49
  <?php if ($videoPosterUrl) { ?>
52
50
  poster="<?php echo esc_attr($videoPosterUrl); ?>"
53
51
  <?php } ?>
@@ -25,7 +25,7 @@
25
25
  "type": "string"
26
26
  },
27
27
  "siteFooterLogoId": {
28
- "type": "string"
28
+ "type": "number"
29
29
  },
30
30
  "siteFooterCopyright": {
31
31
  "type": "string"
@@ -26,7 +26,7 @@
26
26
  "type": "string"
27
27
  },
28
28
  "siteNavigationLogoId": {
29
- "type": "string"
29
+ "type": "number"
30
30
  },
31
31
  "wrapperUse": {
32
32
  "type": "boolean",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/frontend-libs-tailwind",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
5
5
  "author": {
6
6
  "name": "Eightshift team",
@@ -9,7 +9,7 @@ export const useThemeOptions = (settingName) => {
9
9
 
10
10
  useEffect(() => {
11
11
  apiFetch({ path: '/wp/v2/settings' }).then((settings) => {
12
- setSettings(settings?.[settingName]);
12
+ setSettings(JSON.parse(settings?.[settingName]));
13
13
  });
14
14
  }, []);
15
15
 
@@ -21,7 +21,7 @@ export const useThemeOptions = (settingName) => {
21
21
  path: '/wp/v2/settings',
22
22
  method: 'POST',
23
23
  data: {
24
- [settingName]: settings,
24
+ [settingName]: JSON.stringify(settings),
25
25
  },
26
26
  });
27
27
 
@@ -301,3 +301,27 @@ export const props = (newName, attributes, manual = {}) => {
301
301
  // Return the original attribute for optimization purposes.
302
302
  return output;
303
303
  };
304
+
305
+ /**
306
+ * Filter attributes by array of keys. Used to provide alternative attributes to server side render component to prevent unnecessary rerender.
307
+ *
308
+ * @param {object} attributes Attributes data source.
309
+ * @param {array} filterAttributes Array of attributes to filter.
310
+ * @param {object} appendItems Append additional attributes.
311
+ *
312
+ * @returns {object}
313
+ */
314
+ export const getFilteredAttributes = (attributes, filterAttributes, appendItems = {}) => {
315
+ const output = {};
316
+
317
+ for (const [key, value] of Object.entries(attributes)) {
318
+ if (filterAttributes.includes(key)) {
319
+ output[key] = value;
320
+ }
321
+ }
322
+
323
+ return {
324
+ ...output,
325
+ ...appendItems,
326
+ };
327
+ };
package/bun.lockb DELETED
Binary file