Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crystallize/react-image

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crystallize/react-image - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2

2

dist/index.d.ts

@@ -5,3 +5,3 @@ import { FC, HTMLAttributes, FunctionComponent } from 'react';

width: number;
height: number;
height?: number;
size?: number;

@@ -8,0 +8,0 @@ }

@@ -9,2 +9,65 @@ 'use strict';

function _wrapRegExp() {
_wrapRegExp = function (re, groups) {
return new BabelRegExp(re, undefined, groups);
};
var _super = RegExp.prototype;
var _groups = new WeakMap();
function BabelRegExp(re, flags, groups) {
var _this = new RegExp(re, flags);
_groups.set(_this, groups || _groups.get(re));
return _setPrototypeOf(_this, BabelRegExp.prototype);
}
_inherits(BabelRegExp, RegExp);
BabelRegExp.prototype.exec = function (str) {
var result = _super.exec.call(this, str);
if (result) result.groups = buildGroups(result, this);
return result;
};
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
if (typeof substitution === "string") {
var groups = _groups.get(this);
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
return "$" + groups[name];
}));
} else if (typeof substitution === "function") {
var _this = this;
return _super[Symbol.replace].call(this, str, function () {
var args = arguments;
if (typeof args[args.length - 1] !== "object") {
args = [].slice.call(args);
args.push(buildGroups(args, _this));
}
return substitution.apply(this, args);
});
} else {
return _super[Symbol.replace].call(this, str, substitution);
}
};
function buildGroups(result, re) {
var g = _groups.get(re);
return Object.keys(g).reduce(function (groups, name) {
groups[name] = result[g[name]];
return groups;
}, Object.create(null));
}
return _wrapRegExp.apply(this, arguments);
}
function _extends() {

@@ -43,9 +106,2 @@ _extends = Object.assign || function (target) {

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -60,70 +116,2 @@ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -144,67 +132,5 @@ if (source == null) return {};

function _wrapRegExp(re, groups) {
_wrapRegExp = function (re, groups) {
return new BabelRegExp(re, undefined, groups);
};
var _excluded = ["children"],
_excluded2 = ["src", "url", "sizes", "variants", "altText", "alt", "caption", "className"];
var _RegExp = _wrapNativeSuper(RegExp);
var _super = RegExp.prototype;
var _groups = new WeakMap();
function BabelRegExp(re, flags, groups) {
var _this = _RegExp.call(this, re, flags);
_groups.set(_this, groups || _groups.get(re));
return _this;
}
_inherits(BabelRegExp, _RegExp);
BabelRegExp.prototype.exec = function (str) {
var result = _super.exec.call(this, str);
if (result) result.groups = buildGroups(result, this);
return result;
};
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
if (typeof substitution === "string") {
var groups = _groups.get(this);
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
return "$" + groups[name];
}));
} else if (typeof substitution === "function") {
var _this = this;
return _super[Symbol.replace].call(this, str, function () {
var args = [];
args.push.apply(args, arguments);
if (typeof args[args.length - 1] !== "object") {
args.push(buildGroups(args, _this));
}
return substitution.apply(this, args);
});
} else {
return _super[Symbol.replace].call(this, str, substitution);
}
};
function buildGroups(result, re) {
var g = _groups.get(re);
return Object.keys(g).reduce(function (groups, name) {
groups[name] = result[g[name]];
return groups;
}, Object.create(null));
}
return _wrapRegExp.apply(this, arguments);
}
function getVariantSrc(variant) {

@@ -218,3 +144,3 @@ return variant.url + " " + variant.width + "w";

var children = _ref.children,
restOfAllProps = _objectWithoutPropertiesLoose(_ref, ["children"]);
restOfAllProps = _objectWithoutPropertiesLoose(_ref, _excluded);

@@ -229,3 +155,3 @@ var src = restOfAllProps.src,

className = restOfAllProps.className,
rest = _objectWithoutPropertiesLoose(restOfAllProps, ["src", "url", "sizes", "variants", "altText", "alt", "caption", "className"]);
rest = _objectWithoutPropertiesLoose(restOfAllProps, _excluded2);

@@ -281,3 +207,15 @@ var vars = (variants || []).filter(function (v) {

};
var useWebP = srcSetWebp.length > 0;
var useAvif = srcSetAvif.length > 0; // If image size is given, let's pick the smallest version
if (useWebP && useAvif) {
var firstWebp = webp[0];
var firstAvif = avif[0];
if (firstWebp.size && firstAvif.size) {
useWebP = firstWebp.size < firstAvif.size;
useAvif = !useWebP;
}
}
if (children) {

@@ -287,2 +225,3 @@ return children(_extends({

srcSetWebp: srcSetWebp,
srcSetAvif: srcSetAvif,
className: className,

@@ -296,15 +235,2 @@ sizes: sizes

var captionString = (caption == null ? void 0 : (_caption$html = caption.html) == null ? void 0 : _caption$html[0]) || (caption == null ? void 0 : (_caption$plainText = caption.plainText) == null ? void 0 : _caption$plainText[0]) || '';
var useWebP = srcSetWebp.length > 0;
var useAvif = srcSetAvif.length > 0; // If image size is given, let's pick the smallest version
if (useWebP && useAvif) {
var firstWebp = webp[0];
var firstAvif = avif[0];
if (firstWebp.size && firstAvif.size) {
useWebP = firstWebp.size < firstAvif.size;
useAvif = !useWebP;
}
}
return React.createElement("figure", {

@@ -311,0 +237,0 @@ className: className

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function c(e,t,r){return(c=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i}).apply(null,arguments)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return c(e,arguments,i(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)})(e)}function a(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}function s(e,t){s=function(e,t){return new u(e,void 0,t)};var r=l(RegExp),i=RegExp.prototype,o=new WeakMap;function u(e,t,n){var i=r.call(this,e,t);return o.set(i,n||o.get(e)),i}function c(e,t){var r=o.get(t);return Object.keys(r).reduce((function(t,n){return t[n]=e[r[n]],t}),Object.create(null))}return n(u,r),u.prototype.exec=function(e){var t=i.exec.call(this,e);return t&&(t.groups=c(t,this)),t},u.prototype[Symbol.replace]=function(e,t){if("string"==typeof t){var r=o.get(this);return i[Symbol.replace].call(this,e,t.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+r[t]})))}if("function"==typeof t){var n=this;return i[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!=typeof e[e.length-1]&&e.push(c(e,n)),t.apply(this,e)}))}return i[Symbol.replace].call(this,e,t)},s.apply(this,arguments)}function p(e){return e.url+" "+e.width+"w"}exports.Image=function(e){var n,i,o,u,c=e.children,l=a(e,["children"]),f=l.src,h=l.url,y=l.sizes,g=l.variants,v=l.altText,d=l.alt,b=l.caption,m=l.className,w=a(l,["src","url","sizes","variants","altText","alt","caption","className"]),j=(g||[]).filter((function(e){return!!e})),O="string"==typeof d?d:v,x=j.length>0,S=j[0];x&&(S=j.reduce((function(e,t){return!e.width||t.width>e.width?t:e}),j[0]));var E=j.filter((function(e){return e.url&&!e.url.endsWith(".webp")&&!e.url.endsWith(".avif")})),_=j.filter((function(e){return e.url&&e.url.endsWith(".webp")})),z=j.filter((function(e){return e.url&&e.url.endsWith(".avif")})),P=E.map(p).join(", "),R=_.map(p).join(", "),T=z.map(p).join(", ");E.length>0&&E[0].url.match(s(/\.((?:(?!\.)[\s\S])+)$/,{name:1}));var W={src:f||h||(x?E[0].url:void 0),alt:O,caption:b,width:null==(n=S)?void 0:n.width,height:null==(i=S)?void 0:i.height};if(c)return c(r({srcSet:P,srcSetWebp:R,className:m,sizes:y},W,w,{originalFileExtension:"jpeg"}));var M=(null==b||null==(o=b.html)?void 0:o[0])||(null==b||null==(u=b.plainText)?void 0:u[0])||"",N=R.length>0,k=T.length>0;if(N&&k){var F=_[0],$=z[0];F.size&&$.size&&(k=!(N=F.size<$.size))}return t.createElement("figure",{className:m},t.createElement("picture",null,k&&t.createElement("source",{srcSet:T,type:"image/avif",sizes:y}),N&&t.createElement("source",{srcSet:R,type:"image/webp",sizes:y}),P.length>0&&t.createElement("source",{srcSet:P,type:"image/jpeg",sizes:y}),t.createElement("img",Object.assign({},W,w))),M&&t.createElement("figcaption",{dangerouslySetInnerHTML:{__html:M}}))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function r(){r=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,i){var u=new RegExp(e,r);return t.set(u,i||t.get(e)),l(u,n.prototype)}function u(e,r){var n=t.get(r);return Object.keys(n).reduce((function(t,r){return t[r]=e[n[r]],t}),Object.create(null))}return i(n,RegExp),n.prototype.exec=function(t){var r=e.exec.call(this,t);return r&&(r.groups=u(r,this)),r},n.prototype[Symbol.replace]=function(r,n){if("string"==typeof n){var i=t.get(this);return e[Symbol.replace].call(this,r,n.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+i[t]})))}if("function"==typeof n){var l=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(u(e,l)),n.apply(this,e)}))}return e[Symbol.replace].call(this,r,n)},r.apply(this,arguments)}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){if(null==e)return{};var r,n,i={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(r=l[n])>=0||(i[r]=e[r]);return i}var a=["children"],c=["src","url","sizes","variants","altText","alt","caption","className"];function o(e){return e.url+" "+e.width+"w"}exports.Image=function(e){var i,l,s,p,f=e.children,h=u(e,a),g=h.src,v=h.url,y=h.sizes,m=h.variants,d=h.altText,b=h.alt,w=h.caption,j=h.className,x=u(h,c),S=(m||[]).filter((function(e){return!!e})),E="string"==typeof b?b:d,O=S.length>0,z=S[0];O&&(z=S.reduce((function(e,t){return!e.width||t.width>e.width?t:e}),S[0]));var _=S.filter((function(e){return e.url&&!e.url.endsWith(".webp")&&!e.url.endsWith(".avif")})),W=S.filter((function(e){return e.url&&e.url.endsWith(".webp")})),T=S.filter((function(e){return e.url&&e.url.endsWith(".avif")})),N=_.map(o).join(", "),k=W.map(o).join(", "),M=T.map(o).join(", ");_.length>0&&_[0].url.match(r(/\.((?:(?!\.)[\s\S])+)$/,{name:1}));var P={src:g||v||(O?_[0].url:void 0),alt:E,caption:w,width:null==(i=z)?void 0:i.width,height:null==(l=z)?void 0:l.height},R=k.length>0,$=M.length>0;if(R&&$){var I=W[0],q=T[0];I.size&&q.size&&($=!(R=I.size<q.size))}if(f)return f(n({srcSet:N,srcSetWebp:k,srcSetAvif:M,className:j,sizes:y},P,x,{originalFileExtension:"jpeg"}));var A=(null==w||null==(s=w.html)?void 0:s[0])||(null==w||null==(p=w.plainText)?void 0:p[0])||"";return t.createElement("figure",{className:j},t.createElement("picture",null,$&&t.createElement("source",{srcSet:M,type:"image/avif",sizes:y}),R&&t.createElement("source",{srcSet:k,type:"image/webp",sizes:y}),N.length>0&&t.createElement("source",{srcSet:N,type:"image/jpeg",sizes:y}),t.createElement("img",Object.assign({},P,x))),A&&t.createElement("figcaption",{dangerouslySetInnerHTML:{__html:A}}))};
//# sourceMappingURL=react-image.cjs.production.min.js.map
import React from 'react';
function _wrapRegExp() {
_wrapRegExp = function (re, groups) {
return new BabelRegExp(re, undefined, groups);
};
var _super = RegExp.prototype;
var _groups = new WeakMap();
function BabelRegExp(re, flags, groups) {
var _this = new RegExp(re, flags);
_groups.set(_this, groups || _groups.get(re));
return _setPrototypeOf(_this, BabelRegExp.prototype);
}
_inherits(BabelRegExp, RegExp);
BabelRegExp.prototype.exec = function (str) {
var result = _super.exec.call(this, str);
if (result) result.groups = buildGroups(result, this);
return result;
};
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
if (typeof substitution === "string") {
var groups = _groups.get(this);
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
return "$" + groups[name];
}));
} else if (typeof substitution === "function") {
var _this = this;
return _super[Symbol.replace].call(this, str, function () {
var args = arguments;
if (typeof args[args.length - 1] !== "object") {
args = [].slice.call(args);
args.push(buildGroups(args, _this));
}
return substitution.apply(this, args);
});
} else {
return _super[Symbol.replace].call(this, str, substitution);
}
};
function buildGroups(result, re) {
var g = _groups.get(re);
return Object.keys(g).reduce(function (groups, name) {
groups[name] = result[g[name]];
return groups;
}, Object.create(null));
}
return _wrapRegExp.apply(this, arguments);
}
function _extends() {

@@ -36,9 +99,2 @@ _extends = Object.assign || function (target) {

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -53,70 +109,2 @@ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {

function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -137,67 +125,5 @@ if (source == null) return {};

function _wrapRegExp(re, groups) {
_wrapRegExp = function (re, groups) {
return new BabelRegExp(re, undefined, groups);
};
var _excluded = ["children"],
_excluded2 = ["src", "url", "sizes", "variants", "altText", "alt", "caption", "className"];
var _RegExp = _wrapNativeSuper(RegExp);
var _super = RegExp.prototype;
var _groups = new WeakMap();
function BabelRegExp(re, flags, groups) {
var _this = _RegExp.call(this, re, flags);
_groups.set(_this, groups || _groups.get(re));
return _this;
}
_inherits(BabelRegExp, _RegExp);
BabelRegExp.prototype.exec = function (str) {
var result = _super.exec.call(this, str);
if (result) result.groups = buildGroups(result, this);
return result;
};
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
if (typeof substitution === "string") {
var groups = _groups.get(this);
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
return "$" + groups[name];
}));
} else if (typeof substitution === "function") {
var _this = this;
return _super[Symbol.replace].call(this, str, function () {
var args = [];
args.push.apply(args, arguments);
if (typeof args[args.length - 1] !== "object") {
args.push(buildGroups(args, _this));
}
return substitution.apply(this, args);
});
} else {
return _super[Symbol.replace].call(this, str, substitution);
}
};
function buildGroups(result, re) {
var g = _groups.get(re);
return Object.keys(g).reduce(function (groups, name) {
groups[name] = result[g[name]];
return groups;
}, Object.create(null));
}
return _wrapRegExp.apply(this, arguments);
}
function getVariantSrc(variant) {

@@ -211,3 +137,3 @@ return variant.url + " " + variant.width + "w";

var children = _ref.children,
restOfAllProps = _objectWithoutPropertiesLoose(_ref, ["children"]);
restOfAllProps = _objectWithoutPropertiesLoose(_ref, _excluded);

@@ -222,3 +148,3 @@ var src = restOfAllProps.src,

className = restOfAllProps.className,
rest = _objectWithoutPropertiesLoose(restOfAllProps, ["src", "url", "sizes", "variants", "altText", "alt", "caption", "className"]);
rest = _objectWithoutPropertiesLoose(restOfAllProps, _excluded2);

@@ -274,3 +200,15 @@ var vars = (variants || []).filter(function (v) {

};
var useWebP = srcSetWebp.length > 0;
var useAvif = srcSetAvif.length > 0; // If image size is given, let's pick the smallest version
if (useWebP && useAvif) {
var firstWebp = webp[0];
var firstAvif = avif[0];
if (firstWebp.size && firstAvif.size) {
useWebP = firstWebp.size < firstAvif.size;
useAvif = !useWebP;
}
}
if (children) {

@@ -280,2 +218,3 @@ return children(_extends({

srcSetWebp: srcSetWebp,
srcSetAvif: srcSetAvif,
className: className,

@@ -289,15 +228,2 @@ sizes: sizes

var captionString = (caption == null ? void 0 : (_caption$html = caption.html) == null ? void 0 : _caption$html[0]) || (caption == null ? void 0 : (_caption$plainText = caption.plainText) == null ? void 0 : _caption$plainText[0]) || '';
var useWebP = srcSetWebp.length > 0;
var useAvif = srcSetAvif.length > 0; // If image size is given, let's pick the smallest version
if (useWebP && useAvif) {
var firstWebp = webp[0];
var firstAvif = avif[0];
if (firstWebp.size && firstAvif.size) {
useWebP = firstWebp.size < firstAvif.size;
useAvif = !useWebP;
}
}
return React.createElement("figure", {

@@ -304,0 +230,0 @@ className: className

{
"name": "@crystallize/react-image",
"description": "Modern and responsive images based on the source variations from Crystallize",
"version": "7.1.1",
"version": "7.1.2",
"keywords": [

@@ -30,3 +30,3 @@ "react",

"test": "tsdx test --passWithNoTests",
"lint": "tsdx lint",
"lint": "tsdx lint src",
"prepare": "tsdx build",

@@ -47,3 +47,3 @@ "size": "size-limit",

"hooks": {
"pre-commit": "tsdx lint"
"pre-commit": "tsdx lint src"
}

@@ -80,2 +80,3 @@ },

"husky": "^4.3.0",
"prettier": "^2.3.2",
"react": "^17.0.1",

@@ -82,0 +83,0 @@ "react-dom": "^17.0.1",

@@ -53,2 +53,10 @@ ![alt text](https://raw.githubusercontent.com/CrystallizeAPI/react-image/HEAD/media/logo.png 'An illustration of an atom')

<picture>
{srcSetAvif.length > 0 && (
<source
srcSet={srcSetAvif.join(", ")}
src={webp[0].url}
type="image/avif"
sizes={sizes}
/>
)}
{srcSetWebp.length > 0 && (

@@ -55,0 +63,0 @@ <source

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc