@plasmicapp/react-web 0.2.426 → 0.2.428
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/index.cjs.js +6 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +6 -3
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +6 -1
- package/dist/render/PlasmicImg/index.spec.d.ts +1 -0
- package/package.json +3 -3
- package/skinny/dist/render/PlasmicImg/index.d.ts +6 -1
- package/skinny/dist/render/PlasmicImg/index.js +6 -3
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
- package/skinny/dist/render/PlasmicImg/index.spec.d.ts +1 -0
package/dist/all.d.ts
CHANGED
|
@@ -12653,10 +12653,11 @@ interface ImageLoader {
|
|
|
12653
12653
|
src: string;
|
|
12654
12654
|
width?: number;
|
|
12655
12655
|
quality?: number;
|
|
12656
|
-
format?:
|
|
12656
|
+
format?: PlasmicImgFormat;
|
|
12657
12657
|
}) => string;
|
|
12658
12658
|
}
|
|
12659
12659
|
type ImgTagProps = Omit<React__default.ComponentProps<"img">, "src" | "srcSet" | "ref" | "style">;
|
|
12660
|
+
type PlasmicImgFormat = "avif" | "jpeg" | "png" | "webp";
|
|
12660
12661
|
interface PlasmicImgProps extends ImgTagProps {
|
|
12661
12662
|
/**
|
|
12662
12663
|
* Either an object with the src string, and its full width and height,
|
|
@@ -12705,6 +12706,10 @@ interface PlasmicImgProps extends ImgTagProps {
|
|
|
12705
12706
|
* For variable quality formats like jpg, the quality from 0 to 100
|
|
12706
12707
|
*/
|
|
12707
12708
|
quality?: number;
|
|
12709
|
+
/**
|
|
12710
|
+
* Choose the output image format.
|
|
12711
|
+
*/
|
|
12712
|
+
format?: PlasmicImgFormat;
|
|
12708
12713
|
/**
|
|
12709
12714
|
* ImageLoader to use for loading different dimensions of the image.
|
|
12710
12715
|
* If none specified, will not attempt to load different dimensions.
|
package/dist/index.cjs.js
CHANGED
|
@@ -748,7 +748,7 @@ var IMG_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
|
748
748
|
var DEVICE_SIZES = [640, 750, 828, 1080, 1200, 1920, 2048, 3840];
|
|
749
749
|
var ALL_SIZES = __spreadArray(__spreadArray([], __read(IMG_SIZES), false), __read(DEVICE_SIZES), false);
|
|
750
750
|
var PlasmicImg = React.forwardRef(function PlasmicImg(props, outerRef) {
|
|
751
|
-
var src = props.src, className = props.className, displayWidth = props.displayWidth, displayHeight = props.displayHeight, displayMinWidth = props.displayMinWidth, displayMinHeight = props.displayMinHeight, displayMaxWidth = props.displayMaxWidth, displayMaxHeight = props.displayMaxHeight, quality = props.quality, loader = props.loader, imgRef = props.imgRef, style = props.style, loading = props.loading, rest = __rest(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "loader", "imgRef", "style", "loading"]);
|
|
751
|
+
var src = props.src, className = props.className, displayWidth = props.displayWidth, displayHeight = props.displayHeight, displayMinWidth = props.displayMinWidth, displayMinHeight = props.displayMinHeight, displayMaxWidth = props.displayMaxWidth, displayMaxHeight = props.displayMaxHeight, quality = props.quality, format = props.format, loader = props.loader, imgRef = props.imgRef, style = props.style, loading = props.loading, rest = __rest(props, ["src", "className", "displayWidth", "displayHeight", "displayMinWidth", "displayMinHeight", "displayMaxWidth", "displayMaxHeight", "quality", "format", "loader", "imgRef", "style", "loading"]);
|
|
752
752
|
var imgProps = Object.assign({}, rest, {
|
|
753
753
|
// Default loading to "lazy" if not specified (which is different from the
|
|
754
754
|
// html img, which defaults to eager!)
|
|
@@ -871,6 +871,7 @@ var PlasmicImg = React.forwardRef(function PlasmicImg(props, outerRef) {
|
|
|
871
871
|
sizes: sizes,
|
|
872
872
|
src: srcStr,
|
|
873
873
|
quality: quality,
|
|
874
|
+
format: format,
|
|
874
875
|
ref: imgRef,
|
|
875
876
|
style: style ? pick(style, "objectFit", "objectPosition") : undefined,
|
|
876
877
|
imgProps: imgProps,
|
|
@@ -881,9 +882,9 @@ function makePicture(opts) {
|
|
|
881
882
|
// If imageLoader is undefined, then this renders to just a normal
|
|
882
883
|
// <img />. Else it will render to a <picture> with a <source> for
|
|
883
884
|
// webp, and srcSet/sizes set according to width requirements.
|
|
884
|
-
var imageLoader = opts.imageLoader, widthDescs = opts.widthDescs, src = opts.src, quality = opts.quality, style = opts.style, className = opts.className, sizes = opts.sizes, imgProps = opts.imgProps, ref = opts.ref;
|
|
885
|
+
var imageLoader = opts.imageLoader, widthDescs = opts.widthDescs, src = opts.src, quality = opts.quality, format = opts.format, style = opts.style, className = opts.className, sizes = opts.sizes, imgProps = opts.imgProps, ref = opts.ref;
|
|
885
886
|
return (React.createElement("picture", { className: "__wab_picture" },
|
|
886
|
-
imageLoader && imageLoader.supportsUrl(src) && (React.createElement("source", { type: "image/webp", srcSet: widthDescs
|
|
887
|
+
imageLoader && imageLoader.supportsUrl(src) && !format && (React.createElement("source", { type: "image/webp", srcSet: widthDescs
|
|
887
888
|
.map(function (wd) {
|
|
888
889
|
return "".concat(imageLoader.transformUrl({
|
|
889
890
|
src: src,
|
|
@@ -897,6 +898,7 @@ function makePicture(opts) {
|
|
|
897
898
|
? imageLoader.transformUrl({
|
|
898
899
|
src: src,
|
|
899
900
|
quality: quality,
|
|
901
|
+
format: format,
|
|
900
902
|
width: widthDescs[widthDescs.length - 1].width,
|
|
901
903
|
})
|
|
902
904
|
: src, srcSet: imageLoader && imageLoader.supportsUrl(src)
|
|
@@ -905,6 +907,7 @@ function makePicture(opts) {
|
|
|
905
907
|
return "".concat(imageLoader.transformUrl({
|
|
906
908
|
src: src,
|
|
907
909
|
quality: quality,
|
|
910
|
+
format: format,
|
|
908
911
|
width: wd.width,
|
|
909
912
|
}), " ").concat(wd.desc);
|
|
910
913
|
})
|