@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/all.d.ts
CHANGED
|
@@ -13446,9 +13446,11 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
13446
13446
|
format?: PlasmicImgFormat;
|
|
13447
13447
|
/**
|
|
13448
13448
|
* ImageLoader to use for loading different dimensions of the image.
|
|
13449
|
+
* "plasmic" uses Plasmic's image optimizer, and a URL string uses the image
|
|
13450
|
+
* optimizer hosted at that base URL.
|
|
13449
13451
|
* If none specified, will not attempt to load different dimensions.
|
|
13450
13452
|
*/
|
|
13451
|
-
loader?: "plasmic" | ImageLoader;
|
|
13453
|
+
loader?: "plasmic" | string | ImageLoader;
|
|
13452
13454
|
/**
|
|
13453
13455
|
* Style applied to the wrapper element. objectFit and objectPosition
|
|
13454
13456
|
* rules are applied to the img element.
|
package/dist/index.cjs.js
CHANGED
|
@@ -797,10 +797,11 @@ var PlasmicImg = React.forwardRef(function PlasmicImg(props, outerRef) {
|
|
|
797
797
|
if (aspectRatio && isFinite(aspectRatio) && isSvg(srcStr)) {
|
|
798
798
|
// For SVGs, fullWidth and fullHeight can be rounded values, which would
|
|
799
799
|
// cause some discrepancy between the actual aspect ratio and the aspect
|
|
800
|
-
// ratio from those values. So, for those cases, we
|
|
801
|
-
//
|
|
800
|
+
// ratio from those values. So, for those cases, we size the spacer from
|
|
801
|
+
// the aspect ratio instead. The height isn't rounded, because even at this
|
|
802
|
+
// width rounding it changes the rendered height by a fraction of a pixel.
|
|
802
803
|
spacerWidth = DEFAULT_SVG_WIDTH;
|
|
803
|
-
spacerHeight =
|
|
804
|
+
spacerHeight = spacerWidth / aspectRatio;
|
|
804
805
|
}
|
|
805
806
|
var _b = getWidths(computedDisplayWidth, fullWidth, {
|
|
806
807
|
minWidth: displayMinWidth,
|
|
@@ -1031,7 +1032,10 @@ function getImageLoader(loader) {
|
|
|
1031
1032
|
return undefined;
|
|
1032
1033
|
}
|
|
1033
1034
|
else if (loader === "plasmic") {
|
|
1034
|
-
return
|
|
1035
|
+
return makePlasmicImageLoader(IMG_OPTIMIZER_HOST);
|
|
1036
|
+
}
|
|
1037
|
+
else if (typeof loader === "string") {
|
|
1038
|
+
return makePlasmicImageLoader(loader);
|
|
1035
1039
|
}
|
|
1036
1040
|
else {
|
|
1037
1041
|
return loader;
|
|
@@ -1040,7 +1044,7 @@ function getImageLoader(loader) {
|
|
|
1040
1044
|
function isInternalKey(src) {
|
|
1041
1045
|
return /^([a-f0-9]{32})\..{1,16}$/i.test(src);
|
|
1042
1046
|
}
|
|
1043
|
-
var
|
|
1047
|
+
var makePlasmicImageLoader = function (host) { return ({
|
|
1044
1048
|
supportsUrl: function (src) {
|
|
1045
1049
|
return (src.startsWith("http") || isInternalKey(src)) && !isSvg(src);
|
|
1046
1050
|
},
|
|
@@ -1052,9 +1056,9 @@ var PLASMIC_IMAGE_LOADER = {
|
|
|
1052
1056
|
"q=".concat((_a = opts.quality) !== null && _a !== void 0 ? _a : 75),
|
|
1053
1057
|
opts.format ? "f=".concat(opts.format) : undefined,
|
|
1054
1058
|
].filter(function (x) { return !!x; });
|
|
1055
|
-
return "".concat(
|
|
1059
|
+
return "".concat(host, "/img-optimizer/v1/img?").concat(params.join("&"));
|
|
1056
1060
|
},
|
|
1057
|
-
};
|
|
1061
|
+
}); };
|
|
1058
1062
|
|
|
1059
1063
|
// These props are used internally by PlasmicLink to determine how to render the link
|
|
1060
1064
|
var INTERNAL_PROPS = ["component", "platform", "legacyBehavior"];
|