@crystallize/react-image
Advanced tools
Comparing version 4.0.0-beta.4 to 4.0.0-beta.5
@@ -1,2 +0,2 @@ | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("react")),r=t(require("prop-types"));function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(){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(t){return!1}}function l(t,e,r){return(l=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return l(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function p(t,e){if(null==t)return{};var r,n,o={},u=Object.keys(t);for(n=0;n<u.length;n++)e.indexOf(r=u[n])>=0||(o[r]=t[r]);return o}function s(t,e){s=function(t,e){return new i(t,void 0,e)};var r=a(RegExp),n=RegExp.prototype,u=new WeakMap;function i(t,e,n){var o=r.call(this,t,e);return u.set(o,n||u.get(t)),o}function c(t,e){var r=u.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return o(i,r),i.prototype.exec=function(t){var e=n.exec.call(this,t);return e&&(e.groups=c(e,this)),e},i.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=u.get(this);return n[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var o=this;return n[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,o)),e.apply(this,t)})}return n[Symbol.replace].call(this,t,e)},s.apply(this,arguments)}var f=function(t){return t.url+" "+t.width+"w"},h=function(t){var r=t.children,o=p(t,["children"]);if(o.src)return r?r(o):e.createElement("img",o);var u=o.url,i=o.sizes,c=o.variants,l=o.altText,a=o.alt,h=o.className,y=p(o,["url","sizes","variants","altText","alt","className"]),g=c||[],b="string"==typeof a?a:l,v=g.length>0,m={};v&&console.log({vars:g},g.sort(function(t,e){return e.width-t.width}));var d=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=d.map(f).join(", "),j=w.map(f).join(", "),x="jpeg";d.length>0&&"jpg"===(x=d[0].url.match(s(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=u||(v?d[0].url:void 0);return r?r(n({src:S,srcSet:O,srcSetWebp:j,sizes:i,className:h},y,{alt:b,originalFileExtension:x})):e.createElement("picture",{className:h},j.length>0&&e.createElement("source",{srcSet:j,type:"image/webp",sizes:i}),O.length>0&&e.createElement("source",{srcSet:O,type:"image/"+x,sizes:i}),e.createElement("img",n({src:S,sizes:i,width:m.width,height:m.height},y,{alt:b})))};h.propTypes={children:r.func,src:r.string,url:r.string,sizes:r.string,variants:r.arrayOf(r.shape({url:r.string,width:r.number,height:r.number}))},module.exports=h; | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("react")),r=t(require("prop-types"));function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(){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(t){return!1}}function l(t,e,r){return(l=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var u=new(Function.bind.apply(t,n));return r&&o(u,r.prototype),u}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return l(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function p(t,e){if(null==t)return{};var r,n,u={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(u[r]=t[r]);return u}function s(t,e){s=function(t,e){return new o(t,void 0,e)};var r=a(RegExp),n=RegExp.prototype,i=new WeakMap;function o(t,e,n){var u=r.call(this,t,e);return i.set(u,n||i.get(t)),u}function c(t,e){var r=i.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return u(o,r),o.prototype.exec=function(t){var e=n.exec.call(this,t);return e&&(e.groups=c(e,this)),e},o.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=i.get(this);return n[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var u=this;return n[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,u)),e.apply(this,t)})}return n[Symbol.replace].call(this,t,e)},s.apply(this,arguments)}var f=function(t){return t.url+" "+t.width+"w"},h=function(t){var r=t.children,u=p(t,["children"]);if(u.src)return r?r(u):e.createElement("img",u);var i=u.url,o=u.sizes,c=u.variants,l=u.altText,a=u.alt,h=u.className,y=p(u,["url","sizes","variants","altText","alt","className"]),g=c||[],b="string"==typeof a?a:l,v=g.length>0,m={};v&&(m=g.filter(function(t){return!!t}).reduce(function(t,e){return!t.width||e.width>t.width?e:t},{}));var d=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=d.map(f).join(", "),j=w.map(f).join(", "),x="jpeg";d.length>0&&"jpg"===(x=d[0].url.match(s(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=i||(v?d[0].url:void 0);return r?r(n({src:S,srcSet:O,srcSetWebp:j,sizes:o,className:h},y,{alt:b,originalFileExtension:x})):e.createElement("picture",{className:h},j.length>0&&e.createElement("source",{srcSet:j,type:"image/webp",sizes:o}),O.length>0&&e.createElement("source",{srcSet:O,type:"image/"+x,sizes:o}),e.createElement("img",n({src:S,sizes:o,width:m.width,height:m.height},y,{alt:b})))};h.propTypes={children:r.func,src:r.string,url:r.string,sizes:r.string,variants:r.arrayOf(r.shape({url:r.string,width:r.number,height:r.number}))},module.exports=h; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react";import e from"prop-types";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(){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(t){return!1}}function u(t,e,r){return(u=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return u(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function a(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}function s(t,e){s=function(t,e){return new c(t,void 0,e)};var r=l(RegExp),o=RegExp.prototype,i=new WeakMap;function c(t,e,n){var o=r.call(this,t,e);return i.set(o,n||i.get(t)),o}function u(t,e){var r=i.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(c,r),c.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=u(e,this)),e},c.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=i.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(u(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},s.apply(this,arguments)}const p=t=>`${t.url} ${t.width}w`,f=e=>{let{children:n}=e,o=a(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);const{url:i,sizes:c,variants:u,altText:l,alt:f,className:h}=o,y=a(o,["url","sizes","variants","altText","alt","className"]),g=u||[],m="string"==typeof f?f:l,b=g.length>0;let v={};b&&console.log({vars:g},g.sort((t,e)=>e.width-t.width));const d=g.filter(t=>t.url&&!t.url.endsWith(".webp")),w=g.filter(t=>t.url&&t.url.endsWith(".webp")),O=d.map(p).join(", "),j=w.map(p).join(", ");let x="jpeg";d.length>0&&(({groups:{name:x}}=d[0].url.match(s(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1}))),"jpg"===x&&(x="jpeg"));const S=i||(b?d[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:c,className:h},y,{alt:m,originalFileExtension:x})):t.createElement("picture",{className:h},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:c}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:c}),t.createElement("img",r({src:S,sizes:c,width:v.width,height:v.height},y,{alt:m})))};f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))};export default f; | ||
import t from"react";import e from"prop-types";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(){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(t){return!1}}function u(t,e,r){return(u=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return u(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function a(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}function p(t,e){p=function(t,e){return new c(t,void 0,e)};var r=l(RegExp),o=RegExp.prototype,i=new WeakMap;function c(t,e,n){var o=r.call(this,t,e);return i.set(o,n||i.get(t)),o}function u(t,e){var r=i.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(c,r),c.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=u(e,this)),e},c.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=i.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(u(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},p.apply(this,arguments)}const s=t=>`${t.url} ${t.width}w`,f=e=>{let{children:n}=e,o=a(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);const{url:i,sizes:c,variants:u,altText:l,alt:f,className:h}=o,y=a(o,["url","sizes","variants","altText","alt","className"]),g=u||[],m="string"==typeof f?f:l,b=g.length>0;let d={};b&&(d=g.filter(t=>!!t).reduce((t,e)=>!t.width||e.width>t.width?e:t,{}));const v=g.filter(t=>t.url&&!t.url.endsWith(".webp")),w=g.filter(t=>t.url&&t.url.endsWith(".webp")),O=v.map(s).join(", "),j=w.map(s).join(", ");let x="jpeg";v.length>0&&(({groups:{name:x}}=v[0].url.match(p(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1}))),"jpg"===x&&(x="jpeg"));const S=i||(b?v[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:c,className:h},y,{alt:m,originalFileExtension:x})):t.createElement("picture",{className:h},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:c}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:c}),t.createElement("img",r({src:S,sizes:c,width:d.width,height:d.height},y,{alt:m})))};f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))};export default f; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react";import e from"prop-types";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}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(t){return!1}}function c(t,e,r){return(c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function a(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}function p(t,e){p=function(t,e){return new u(t,void 0,e)};var r=l(RegExp),o=RegExp.prototype,i=new WeakMap;function u(t,e,n){var o=r.call(this,t,e);return i.set(o,n||i.get(t)),o}function c(t,e){var r=i.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(u,r),u.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=c(e,this)),e},u.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=i.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},p.apply(this,arguments)}var s=function(t){return t.url+" "+t.width+"w"},f=function(e){var n=e.children,o=a(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);var i=o.url,u=o.sizes,c=o.variants,l=o.altText,f=o.alt,h=o.className,y=a(o,["url","sizes","variants","altText","alt","className"]),g=c||[],m="string"==typeof f?f:l,b=g.length>0,v={};b&&console.log({vars:g},g.sort(function(t,e){return e.width-t.width}));var d=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=d.map(s).join(", "),j=w.map(s).join(", "),x="jpeg";d.length>0&&"jpg"===(x=d[0].url.match(p(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=i||(b?d[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:u,className:h},y,{alt:m,originalFileExtension:x})):t.createElement("picture",{className:h},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:u}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:u}),t.createElement("img",r({src:S,sizes:u,width:v.width,height:v.height},y,{alt:m})))};f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))};export default f; | ||
import t from"react";import e from"prop-types";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}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(t){return!1}}function c(t,e,r){return(c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}function a(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e.indexOf(r=i[n])>=0||(o[r]=t[r]);return o}function p(t,e){p=function(t,e){return new u(t,void 0,e)};var r=l(RegExp),o=RegExp.prototype,i=new WeakMap;function u(t,e,n){var o=r.call(this,t,e);return i.set(o,n||i.get(t)),o}function c(t,e){var r=i.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(u,r),u.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=c(e,this)),e},u.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=i.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},p.apply(this,arguments)}var s=function(t){return t.url+" "+t.width+"w"},f=function(e){var n=e.children,o=a(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);var i=o.url,u=o.sizes,c=o.variants,l=o.altText,f=o.alt,h=o.className,y=a(o,["url","sizes","variants","altText","alt","className"]),g=c||[],m="string"==typeof f?f:l,b=g.length>0,v={};b&&(v=g.filter(function(t){return!!t}).reduce(function(t,e){return!t.width||e.width>t.width?e:t},{}));var d=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=d.map(s).join(", "),j=w.map(s).join(", "),x="jpeg";d.length>0&&"jpg"===(x=d[0].url.match(p(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=i||(b?d[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:u,className:h},y,{alt:m,originalFileExtension:x})):t.createElement("picture",{className:h},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:u}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:u}),t.createElement("img",r({src:S,sizes:u,width:v.width,height:v.height},y,{alt:m})))};f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))};export default f; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],e):(t=t||self).reactImage=e(t.react,t.propTypes)}(this,function(t,e){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(){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(t){return!1}}function c(t,e,r){return(c=i()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&u(o,r.prototype),o}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)})(t)}function l(t,e){if(null==t)return{};var r,n,o={},u=Object.keys(t);for(n=0;n<u.length;n++)e.indexOf(r=u[n])>=0||(o[r]=t[r]);return o}function p(t,e){p=function(t,e){return new i(t,void 0,e)};var r=a(RegExp),o=RegExp.prototype,u=new WeakMap;function i(t,e,n){var o=r.call(this,t,e);return u.set(o,n||u.get(t)),o}function c(t,e){var r=u.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(i,r),i.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=c(e,this)),e},i.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=u.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},p.apply(this,arguments)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var s=function(t){return t.url+" "+t.width+"w"},f=function(e){var n=e.children,o=l(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);var u=o.url,i=o.sizes,c=o.variants,a=o.altText,f=o.alt,y=o.className,h=l(o,["url","sizes","variants","altText","alt","className"]),g=c||[],d="string"==typeof f?f:a,b=g.length>0,m={};b&&console.log({vars:g},g.sort(function(t,e){return e.width-t.width}));var v=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=v.map(s).join(", "),j=w.map(s).join(", "),x="jpeg";v.length>0&&"jpg"===(x=v[0].url.match(p(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=u||(b?v[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:i,className:y},h,{alt:d,originalFileExtension:x})):t.createElement("picture",{className:y},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:i}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:i}),t.createElement("img",r({src:S,sizes:i,width:m.width,height:m.height},h,{alt:d})))};return f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))},f}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],e):(t=t||self).reactImage=e(t.react,t.propTypes)}(this,function(t,e){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(){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(t){return!1}}function c(t,e,r){return(c=i()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&u(o,r.prototype),o}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)})(t)}function l(t,e){if(null==t)return{};var r,n,o={},u=Object.keys(t);for(n=0;n<u.length;n++)e.indexOf(r=u[n])>=0||(o[r]=t[r]);return o}function p(t,e){p=function(t,e){return new i(t,void 0,e)};var r=a(RegExp),o=RegExp.prototype,u=new WeakMap;function i(t,e,n){var o=r.call(this,t,e);return u.set(o,n||u.get(t)),o}function c(t,e){var r=u.get(e);return Object.keys(r).reduce(function(e,n){return e[n]=t[r[n]],e},Object.create(null))}return n(i,r),i.prototype.exec=function(t){var e=o.exec.call(this,t);return e&&(e.groups=c(e,this)),e},i.prototype[Symbol.replace]=function(t,e){if("string"==typeof e){var r=u.get(this);return o[Symbol.replace].call(this,t,e.replace(/\$<([^>]+)>/g,function(t,e){return"$"+r[e]}))}if("function"==typeof e){var n=this;return o[Symbol.replace].call(this,t,function(){var t=[];return t.push.apply(t,arguments),"object"!=typeof t[t.length-1]&&t.push(c(t,n)),e.apply(this,t)})}return o[Symbol.replace].call(this,t,e)},p.apply(this,arguments)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var s=function(t){return t.url+" "+t.width+"w"},f=function(e){var n=e.children,o=l(e,["children"]);if(o.src)return n?n(o):t.createElement("img",o);var u=o.url,i=o.sizes,c=o.variants,a=o.altText,f=o.alt,y=o.className,h=l(o,["url","sizes","variants","altText","alt","className"]),g=c||[],d="string"==typeof f?f:a,b=g.length>0,m={};b&&(m=g.filter(function(t){return!!t}).reduce(function(t,e){return!t.width||e.width>t.width?e:t},{}));var v=g.filter(function(t){return t.url&&!t.url.endsWith(".webp")}),w=g.filter(function(t){return t.url&&t.url.endsWith(".webp")}),O=v.map(s).join(", "),j=w.map(s).join(", "),x="jpeg";v.length>0&&"jpg"===(x=v[0].url.match(p(/\.([\0-\x2D\/-\uFFFF]+)$/,{name:1})).groups.name)&&(x="jpeg");var S=u||(b?v[0].url:void 0);return n?n(r({src:S,srcSet:O,srcSetWebp:j,sizes:i,className:y},h,{alt:d,originalFileExtension:x})):t.createElement("picture",{className:y},j.length>0&&t.createElement("source",{srcSet:j,type:"image/webp",sizes:i}),O.length>0&&t.createElement("source",{srcSet:O,type:"image/"+x,sizes:i}),t.createElement("img",r({src:S,sizes:i,width:m.width,height:m.height},h,{alt:d})))};return f.propTypes={children:e.func,src:e.string,url:e.string,sizes:e.string,variants:e.arrayOf(e.shape({url:e.string,width:e.number,height:e.number}))},f}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@crystallize/react-image", | ||
"description": "Output a modern and responsive image based on the source variations from Crystallize", | ||
"version": "4.0.0-beta.4", | ||
"version": "4.0.0-beta.5", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54942
67