@plasmicapp/react-web 0.2.98 → 0.2.101
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/dist/all.d.ts +6 -1
- package/dist/react-web.cjs.development.js +11 -12
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +11 -12
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +6 -1
- package/package.json +2 -2
- package/skinny/dist/render/PlasmicImg/index.d.ts +6 -1
- package/skinny/dist/render/PlasmicImg/index.js +17 -9
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
package/dist/all.d.ts
CHANGED
|
@@ -106,7 +106,12 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
106
106
|
* or just a src string with unknown intrinsic dimensions.
|
|
107
107
|
*/
|
|
108
108
|
src?: string | {
|
|
109
|
-
src: string
|
|
109
|
+
src: string | {
|
|
110
|
+
src: string;
|
|
111
|
+
height: number;
|
|
112
|
+
width: number;
|
|
113
|
+
blurDataURL?: string;
|
|
114
|
+
};
|
|
110
115
|
fullHeight: number;
|
|
111
116
|
fullWidth: number;
|
|
112
117
|
aspectRatio?: number;
|
|
@@ -852,7 +852,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
852
852
|
fullHeight = _ref.fullHeight,
|
|
853
853
|
aspectRatio = _ref.aspectRatio;
|
|
854
854
|
|
|
855
|
-
var srcStr = src ? typeof src === "string" ? src : src.src : ""; // Assume external image if either dimension is null and use usual <img>
|
|
855
|
+
var srcStr = src ? typeof src === "string" ? src : typeof src.src === "string" ? src.src : src.src.src : ""; // Assume external image if either dimension is null and use usual <img>
|
|
856
856
|
|
|
857
857
|
if (fullHeight == null || fullWidth == null) {
|
|
858
858
|
return React__default.createElement("img", Object.assign({
|
|
@@ -869,6 +869,8 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
869
869
|
displayWidth = "100%";
|
|
870
870
|
}
|
|
871
871
|
|
|
872
|
+
var computedDisplayWidth = displayWidth;
|
|
873
|
+
|
|
872
874
|
if (fullWidth && fullHeight && (!displayWidth || displayWidth === "auto") && !!getPixelLength(displayHeight)) {
|
|
873
875
|
// If there's a pixel length specified for displayHeight but not displayWidth,
|
|
874
876
|
// then we can derive the pixel length for displayWidth. Having an explicit
|
|
@@ -878,7 +880,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
878
880
|
// We shouldn't do it for SVGs though, because `fullWidth` and
|
|
879
881
|
// `fullHeight` might have rounded values so the final
|
|
880
882
|
// `displayWidth` could differ by 1px or so.
|
|
881
|
-
|
|
883
|
+
computedDisplayWidth = getPixelLength(displayHeight) * fullWidth / fullHeight;
|
|
882
884
|
}
|
|
883
885
|
}
|
|
884
886
|
|
|
@@ -894,7 +896,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
894
896
|
spacerHeight = Math.round(spacerWidth / aspectRatio);
|
|
895
897
|
}
|
|
896
898
|
|
|
897
|
-
var _getWidths = getWidths(
|
|
899
|
+
var _getWidths = getWidths(computedDisplayWidth, fullWidth, {
|
|
898
900
|
minWidth: displayMinWidth
|
|
899
901
|
}),
|
|
900
902
|
sizes = _getWidths.sizes,
|
|
@@ -906,7 +908,7 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
906
908
|
|
|
907
909
|
var wrapperStyle = _extends({}, style || {});
|
|
908
910
|
|
|
909
|
-
var spacerStyle = pick(style || {}, "objectFit", "objectPosition");
|
|
911
|
+
var spacerStyle = _extends({}, pick(style || {}, "objectFit", "objectPosition"));
|
|
910
912
|
|
|
911
913
|
if (displayWidth != null && displayWidth !== "auto") {
|
|
912
914
|
// If width is set, set it on the wrapper along with min/max width
|
|
@@ -938,22 +940,19 @@ var PlasmicImg = /*#__PURE__*/React__default.forwardRef(function PlasmicImg(prop
|
|
|
938
940
|
}
|
|
939
941
|
|
|
940
942
|
if (displayHeight != null && displayHeight !== "auto") {
|
|
941
|
-
spacerStyle.height = "100%";
|
|
942
|
-
wrapperStyle.
|
|
943
|
-
wrapperStyle.
|
|
944
|
-
wrapperStyle.maxHeight = displayMaxHeight;
|
|
943
|
+
spacerStyle.height = "100%"; // wrapperStyle.height = displayHeight;
|
|
944
|
+
// wrapperStyle.minHeight = displayMinHeight;
|
|
945
|
+
// wrapperStyle.maxHeight = displayMaxHeight;
|
|
945
946
|
} else {
|
|
946
947
|
spacerStyle.height = displayHeight;
|
|
947
948
|
wrapperStyle.height = "auto";
|
|
948
949
|
|
|
949
950
|
if (displayMinHeight) {
|
|
950
|
-
spacerStyle.minHeight = "100%";
|
|
951
|
-
wrapperStyle.minHeight = displayMinHeight;
|
|
951
|
+
spacerStyle.minHeight = "100%"; // wrapperStyle.minHeight = displayMinHeight;
|
|
952
952
|
}
|
|
953
953
|
|
|
954
954
|
if (displayMaxHeight != null && displayMaxHeight !== "none") {
|
|
955
|
-
spacerStyle.maxHeight = "100%";
|
|
956
|
-
wrapperStyle.maxHeight = displayMaxHeight;
|
|
955
|
+
spacerStyle.maxHeight = "100%"; // wrapperStyle.maxHeight = displayMaxHeight;
|
|
957
956
|
}
|
|
958
957
|
}
|
|
959
958
|
|