@plasmicapp/react-web 1.0.40 → 1.0.42
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 +3 -1
- package/dist/index.cjs.js +11 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +11 -7
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +3 -1
- package/dist/stories/PlasmicImg.stories.d.ts +2 -2
- package/dist/stories/UseDollarState.stories.d.ts +23 -23
- package/package.json +1 -1
- package/skinny/dist/render/PlasmicImg/index.d.ts +3 -1
- package/skinny/dist/render/PlasmicImg/index.js +11 -7
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
- package/skinny/dist/stories/PlasmicImg.stories.d.ts +2 -2
- package/skinny/dist/stories/UseDollarState.stories.d.ts +23 -23
package/dist/react-web.esm.js
CHANGED
|
@@ -778,10 +778,11 @@ var PlasmicImg = React__default.forwardRef(function PlasmicImg(props, outerRef)
|
|
|
778
778
|
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
779
779
|
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
780
780
|
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
781
|
-
// ratio from those values. So, for those cases, we
|
|
782
|
-
//
|
|
781
|
+
// ratio from those values. So, for those cases, we size the spacer from
|
|
782
|
+
// the aspect ratio instead. The height isn't rounded, because even at this
|
|
783
|
+
// width rounding it changes the rendered height by a fraction of a pixel.
|
|
783
784
|
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
784
|
-
spacerHeight =
|
|
785
|
+
spacerHeight = spacerWidth / aspectRatio;
|
|
785
786
|
}
|
|
786
787
|
var _b = getWidths(computedDisplayWidth, fullWidth, {
|
|
787
788
|
minWidth: displayMinWidth,
|
|
@@ -1012,7 +1013,10 @@ function getImageLoader(loader) {
|
|
|
1012
1013
|
return undefined;
|
|
1013
1014
|
}
|
|
1014
1015
|
else if (loader === "plasmic") {
|
|
1015
|
-
return
|
|
1016
|
+
return makePlasmicImageLoader(IMG_OPTIMIZER_HOST);
|
|
1017
|
+
}
|
|
1018
|
+
else if (typeof loader === "string") {
|
|
1019
|
+
return makePlasmicImageLoader(loader);
|
|
1016
1020
|
}
|
|
1017
1021
|
else {
|
|
1018
1022
|
return loader;
|
|
@@ -1021,7 +1025,7 @@ function getImageLoader(loader) {
|
|
|
1021
1025
|
function isInternalKey(src) {
|
|
1022
1026
|
return /^([a-f0-9]{32})\..{1,16}$/i.test(src);
|
|
1023
1027
|
}
|
|
1024
|
-
var
|
|
1028
|
+
var makePlasmicImageLoader = function (host) { return ({
|
|
1025
1029
|
supportsUrl: function (src) {
|
|
1026
1030
|
return (src.startsWith("http") || isInternalKey(src)) && !isSvg(src);
|
|
1027
1031
|
},
|
|
@@ -1033,9 +1037,9 @@ var PLASMIC_IMAGE_LOADER = {
|
|
|
1033
1037
|
"q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
|
|
1034
1038
|
opts.format ? "f=".concat(opts.format) : undefined,
|
|
1035
1039
|
].filter(function (x) { return !!x; });
|
|
1036
|
-
return "".concat(
|
|
1040
|
+
return "".concat(host, "/img-optimizer/v1/img?").concat(params.join("&"));
|
|
1037
1041
|
},
|
|
1038
|
-
};
|
|
1042
|
+
}); };
|
|
1039
1043
|
|
|
1040
1044
|
// These props are used internally by PlasmicLink to determine how to render the link
|
|
1041
1045
|
var INTERNAL_PROPS = ["component", "platform", "legacyBehavior"];
|