@websolutespa/bom-mixer-ui 1.2.1 → 1.2.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
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: MediaImage.
8
+
3
9
  ## 1.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -3970,6 +3970,15 @@ function useMediaGalleryContext() {
3970
3970
  return React.useContext(MediaGalleryContext);
3971
3971
  }
3972
3972
 
3973
+ exports.ImageStrategy = void 0;
3974
+ (function (ImageStrategy) {
3975
+ ImageStrategy["None"] = "none";
3976
+ ImageStrategy["Next"] = "next";
3977
+ ImageStrategy["Custom"] = "custom";
3978
+ })(exports.ImageStrategy || (exports.ImageStrategy = {}));
3979
+ const IMAGE_QUALITY = process.env.IMAGE_QUALITY ? parseInt(process.env.IMAGE_QUALITY) : 80;
3980
+ const IMAGE_SIZES = process.env.IMAGE_SIZES ? process.env.IMAGE_SIZES.split(',').map(x => parseInt(x)) : [640, 828, 1080, 1200, 1920];
3981
+ const IMAGE_STRATEGY = process.env.IMAGE_STRATEGY ? process.env.IMAGE_STRATEGY : exports.ImageStrategy.Next;
3973
3982
  const StyledMediaImage = styled__default.default.img`
3974
3983
  max-width: 100%;
3975
3984
  // height: auto;
@@ -3997,8 +4006,13 @@ function getImageProps(_a) {
3997
4006
  src
3998
4007
  } = _a,
3999
4008
  props = __rest(_a, ["src"]);
4009
+ if (IMAGE_STRATEGY === exports.ImageStrategy.None || isSVG(src)) {
4010
+ return {
4011
+ src
4012
+ };
4013
+ }
4000
4014
  const ratio = props.width && props.height ? parseInt(props.width.toString()) / parseInt(props.height.toString()) : 0;
4001
- const sizes = [640, 828, 1080, 1200, 1920];
4015
+ const sizes = IMAGE_SIZES;
4002
4016
  return Object.assign({
4003
4017
  src: getImageSrc(src, ratio, sizes[0]),
4004
4018
  srcSet: getImageSrcset(src, ratio, sizes),
@@ -4007,7 +4021,7 @@ function getImageProps(_a) {
4007
4021
  }
4008
4022
  function getImageSrc(src, ratio, width, quality) {
4009
4023
  if (quality === void 0) {
4010
- quality = 75;
4024
+ quality = IMAGE_QUALITY;
4011
4025
  }
4012
4026
  if (isSVG(src)) {
4013
4027
  return src;
@@ -4016,7 +4030,7 @@ function getImageSrc(src, ratio, width, quality) {
4016
4030
  }
4017
4031
  function getImageSrcset(src, ratio, widths, quality) {
4018
4032
  if (quality === void 0) {
4019
- quality = 75;
4033
+ quality = IMAGE_QUALITY;
4020
4034
  }
4021
4035
  if (isSVG(src)) {
4022
4036
  return undefined;