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

nuke-image

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-image - npm Package Compare versions

Comparing version 2.0.6 to 2.1.1-4.1

build/index.react.cmd.js

2

build/index.cmd.js
// {"framework" : "Rax"}
define("nuke-image",["rax"],function(t,e,o){o.exports=function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="/build/",e(0)}([function(t,e,o){"use strict";function r(t,e){var o={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r]);return o}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},l=function(){function t(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),e}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=o(1),d="object"===("undefined"==typeof navigator?"undefined":u(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),p=1,h=1,f=function(t){function e(t){n(this,e);var o=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.state={width:p,height:h},o.load=o.load.bind(o),o}return a(e,t),l(e,[{key:"convertToRem",value:function(t){var e=void 0;return e=d?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*t/e)}},{key:"load",value:function(t){var e=void 0,o=void 0;d?t.target&&(e=this.convertToRem(t.target.naturalWidth),o=this.convertToRem(t.target.naturalHeight),t.size={naturalWidth:e,naturalHeight:o}):t.size&&t.size.naturalWidth>0&&t.size.naturalHeight>0&&(e=this.convertToRem(t.size.naturalWidth),o=this.convertToRem(t.size.naturalHeight)),this.props.autoFit&&e&&o&&this.setState({width:e,height:o}),this.props.onLoad&&this.props.onLoad(t)}},{key:"render",value:function(){var t=this.props,e=t.style,o=t.autoFit,n=t.src,i=t.source,a=void 0===i?{}:i,l=t.resizeMode,u=(t.onLoad,t.onPress),f=t.onClick,y=r(t,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),v=a.uri,b=a.width,g=void 0===b?p:b,m=a.height,w=void 0===m?h:m;if(!n&&!v)return null;var x=void 0;x=d?"img":"image";var O=s({src:n||v,quality:"original",style:s({width:o?this.state.width:g,height:o?this.state.height:w},e),onLoad:this.load},y);(u||f)&&(O.onClick=u||f),O.style.flex&&(O.style.width===p&&delete O.style.width,O.style.height===h&&delete O.style.height);var j=l||O.style.resizeMode;return j&&(d?(delete O.style.flex,O.style.width=O.style.width||"100%",O.style.height=O.style.height||"100%",O.style.objectFit=j):(O.resize=j,O.style.resizeMode=j)),(0,c.createElement)(x,O)}}]),e}(c.Component);f.propTypes={src:c.PropTypes.string,style:c.PropTypes.object},f.defaultProps={style:{},autoFit:!1},e.default=f,t.exports=e.default},function(e,o){e.exports=t("rax")}])});
define("nuke-image",["rax"],function(e,t,o){o.exports=function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/build/",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},n=function(){function e(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,o,r){return o&&e(t.prototype,o),r&&e(t,r),t}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=o(1);var u="object"===("undefined"==typeof navigator?"undefined":i(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),l=1,s=1,c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={width:l,height:s},o.load=o.load.bind(o),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),n(t,[{key:"convertToRem",value:function(e){var t=void 0;return t=u?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*e/t)}},{key:"load",value:function(e){var t=void 0,o=void 0;u?e.target&&(t=this.convertToRem(e.target.naturalWidth),o=this.convertToRem(e.target.naturalHeight),e.size={naturalWidth:t,naturalHeight:o}):e.size&&e.size.naturalWidth>0&&e.size.naturalHeight>0&&(t=this.convertToRem(e.size.naturalWidth),o=this.convertToRem(e.size.naturalHeight)),this.props.autoFit&&t&&o&&this.setState({width:t,height:o}),this.props.onLoad&&this.props.onLoad(e)}},{key:"render",value:function(){var e=this.props,t=e.style,o=e.autoFit,n=e.src,i=e.source,c=void 0===i?{}:i,f=e.resizeMode,d=(e.onLoad,e.onPress),p=e.onClick,y=function(e,t){var o={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),h=c.uri,v=c.width,b=void 0===v?l:v,g=c.height,m=void 0===g?s:g;if(!n&&!h)return null;var O=void 0;O=u?"img":"image";var j=r({src:n||h,quality:"original",style:r({width:o?this.state.width:b,height:o?this.state.height:m},t),onLoad:this.load},y);(d||p)&&(j.onClick=d||p),j.style.flex&&(j.style.width===l&&delete j.style.width,j.style.height===s&&delete j.style.height);var w=f||j.style.resizeMode;return w&&(u?(delete j.style.flex,j.style.width=j.style.width||"100%",j.style.height=j.style.height||"100%",j.style.objectFit=w):(j.resize=w,j.style.resizeMode=w)),(0,a.createElement)(O,j)}}]),t}();c.propTypes={src:a.PropTypes.string,style:a.PropTypes.object},c.defaultProps={style:{},autoFit:!1},t.default=c,e.exports=t.default},function(t,o){t.exports=e("rax")}])});
// {"framework" : "Rax"}
define("nuke-image",["rax"],function(t,e,o){o.exports=function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="/build/",e(0)}([function(t,e,o){"use strict";function r(t,e){var o={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r]);return o}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},l=function(){function t(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),e}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=o(1),d="object"===("undefined"==typeof navigator?"undefined":u(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),p=1,h=1,f=function(t){function e(t){n(this,e);var o=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.state={width:p,height:h},o.load=o.load.bind(o),o}return a(e,t),l(e,[{key:"convertToRem",value:function(t){var e=void 0;return e=d?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*t/e)}},{key:"load",value:function(t){var e=void 0,o=void 0;d?t.target&&(e=this.convertToRem(t.target.naturalWidth),o=this.convertToRem(t.target.naturalHeight),t.size={naturalWidth:e,naturalHeight:o}):t.size&&t.size.naturalWidth>0&&t.size.naturalHeight>0&&(e=this.convertToRem(t.size.naturalWidth),o=this.convertToRem(t.size.naturalHeight)),this.props.autoFit&&e&&o&&this.setState({width:e,height:o}),this.props.onLoad&&this.props.onLoad(t)}},{key:"render",value:function(){var t=this.props,e=t.style,o=t.autoFit,n=t.src,i=t.source,a=void 0===i?{}:i,l=t.resizeMode,u=(t.onLoad,t.onPress),f=t.onClick,y=r(t,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),v=a.uri,b=a.width,g=void 0===b?p:b,m=a.height,w=void 0===m?h:m;if(!n&&!v)return null;var x=void 0;x=d?"img":"image";var O=s({src:n||v,quality:"original",style:s({width:o?this.state.width:g,height:o?this.state.height:w},e),onLoad:this.load},y);(u||f)&&(O.onClick=u||f),O.style.flex&&(O.style.width===p&&delete O.style.width,O.style.height===h&&delete O.style.height);var j=l||O.style.resizeMode;return j&&(d?(delete O.style.flex,O.style.width=O.style.width||"100%",O.style.height=O.style.height||"100%",O.style.objectFit=j):(O.resize=j,O.style.resizeMode=j)),(0,c.createElement)(x,O)}}]),e}(c.Component);f.propTypes={src:c.PropTypes.string,style:c.PropTypes.object},f.defaultProps={style:{},autoFit:!1},e.default=f,t.exports=e.default},function(e,o){e.exports=t("rax")}])});
define("nuke-image",["rax"],function(e,t,o){o.exports=function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/build/",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},n=function(){function e(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,o,r){return o&&e(t.prototype,o),r&&e(t,r),t}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=o(1);var u="object"===("undefined"==typeof navigator?"undefined":i(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),l=1,s=1,c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={width:l,height:s},o.load=o.load.bind(o),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),n(t,[{key:"convertToRem",value:function(e){var t=void 0;return t=u?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*e/t)}},{key:"load",value:function(e){var t=void 0,o=void 0;u?e.target&&(t=this.convertToRem(e.target.naturalWidth),o=this.convertToRem(e.target.naturalHeight),e.size={naturalWidth:t,naturalHeight:o}):e.size&&e.size.naturalWidth>0&&e.size.naturalHeight>0&&(t=this.convertToRem(e.size.naturalWidth),o=this.convertToRem(e.size.naturalHeight)),this.props.autoFit&&t&&o&&this.setState({width:t,height:o}),this.props.onLoad&&this.props.onLoad(e)}},{key:"render",value:function(){var e=this.props,t=e.style,o=e.autoFit,n=e.src,i=e.source,c=void 0===i?{}:i,f=e.resizeMode,d=(e.onLoad,e.onPress),p=e.onClick,y=function(e,t){var o={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),h=c.uri,v=c.width,b=void 0===v?l:v,g=c.height,m=void 0===g?s:g;if(!n&&!h)return null;var O=void 0;O=u?"img":"image";var j=r({src:n||h,quality:"original",style:r({width:o?this.state.width:b,height:o?this.state.height:m},t),onLoad:this.load},y);(d||p)&&(j.onClick=d||p),j.style.flex&&(j.style.width===l&&delete j.style.width,j.style.height===s&&delete j.style.height);var w=f||j.style.resizeMode;return w&&(u?(delete j.style.flex,j.style.width=j.style.width||"100%",j.style.height=j.style.height||"100%",j.style.objectFit=w):(j.resize=w,j.style.resizeMode=w)),(0,a.createElement)(O,j)}}]),t}();c.propTypes={src:a.PropTypes.string,style:a.PropTypes.object},c.defaultProps={style:{},autoFit:!1},t.default=c,e.exports=t.default},function(t,o){t.exports=e("rax")}])});
// {"framework" : "Rax"}
define("nuke-image",["rax"],function(t,e,o){o.exports=function(t){function e(r){if(o[r])return o[r].exports;var n=o[r]={exports:{},id:r,loaded:!1};return t[r].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="/build/",e(0)}([function(t,e,o){"use strict";function r(t,e){var o={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r]);return o}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},l=function(){function t(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),e}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=o(1),d="object"===("undefined"==typeof navigator?"undefined":u(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),p=1,h=1,f=function(t){function e(t){n(this,e);var o=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return o.state={width:p,height:h},o.load=o.load.bind(o),o}return a(e,t),l(e,[{key:"convertToRem",value:function(t){var e=void 0;return e=d?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*t/e)}},{key:"load",value:function(t){var e=void 0,o=void 0;d?t.target&&(e=this.convertToRem(t.target.naturalWidth),o=this.convertToRem(t.target.naturalHeight),t.size={naturalWidth:e,naturalHeight:o}):t.size&&t.size.naturalWidth>0&&t.size.naturalHeight>0&&(e=this.convertToRem(t.size.naturalWidth),o=this.convertToRem(t.size.naturalHeight)),this.props.autoFit&&e&&o&&this.setState({width:e,height:o}),this.props.onLoad&&this.props.onLoad(t)}},{key:"render",value:function(){var t=this.props,e=t.style,o=t.autoFit,n=t.src,i=t.source,a=void 0===i?{}:i,l=t.resizeMode,u=(t.onLoad,t.onPress),f=t.onClick,y=r(t,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),v=a.uri,b=a.width,g=void 0===b?p:b,m=a.height,w=void 0===m?h:m;if(!n&&!v)return null;var x=void 0;x=d?"img":"image";var O=s({src:n||v,quality:"original",style:s({width:o?this.state.width:g,height:o?this.state.height:w},e),onLoad:this.load},y);(u||f)&&(O.onClick=u||f),O.style.flex&&(O.style.width===p&&delete O.style.width,O.style.height===h&&delete O.style.height);var j=l||O.style.resizeMode;return j&&(d?(delete O.style.flex,O.style.width=O.style.width||"100%",O.style.height=O.style.height||"100%",O.style.objectFit=j):(O.resize=j,O.style.resizeMode=j)),(0,c.createElement)(x,O)}}]),e}(c.Component);f.propTypes={src:c.PropTypes.string,style:c.PropTypes.object},f.defaultProps={style:{},autoFit:!1},e.default=f,t.exports=e.default},function(e,o){e.exports=t("rax")}])});
define("nuke-image",["rax"],function(e,t,o){o.exports=function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/build/",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},n=function(){function e(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,o,r){return o&&e(t.prototype,o),r&&e(t,r),t}}(),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=o(1);var u="object"===("undefined"==typeof navigator?"undefined":i(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),l=1,s=1,c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.state={width:l,height:s},o.load=o.load.bind(o),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.Component),n(t,[{key:"convertToRem",value:function(e){var t=void 0;return t=u?document.documentElement.clientWidth*devicePixelRatio:WXEnvironment.deviceWidth,Math.round(750*e/t)}},{key:"load",value:function(e){var t=void 0,o=void 0;u?e.target&&(t=this.convertToRem(e.target.naturalWidth),o=this.convertToRem(e.target.naturalHeight),e.size={naturalWidth:t,naturalHeight:o}):e.size&&e.size.naturalWidth>0&&e.size.naturalHeight>0&&(t=this.convertToRem(e.size.naturalWidth),o=this.convertToRem(e.size.naturalHeight)),this.props.autoFit&&t&&o&&this.setState({width:t,height:o}),this.props.onLoad&&this.props.onLoad(e)}},{key:"render",value:function(){var e=this.props,t=e.style,o=e.autoFit,n=e.src,i=e.source,c=void 0===i?{}:i,f=e.resizeMode,d=(e.onLoad,e.onPress),p=e.onClick,y=function(e,t){var o={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["style","autoFit","src","source","resizeMode","onLoad","onPress","onClick"]),h=c.uri,v=c.width,b=void 0===v?l:v,g=c.height,m=void 0===g?s:g;if(!n&&!h)return null;var O=void 0;O=u?"img":"image";var j=r({src:n||h,quality:"original",style:r({width:o?this.state.width:b,height:o?this.state.height:m},t),onLoad:this.load},y);(d||p)&&(j.onClick=d||p),j.style.flex&&(j.style.width===l&&delete j.style.width,j.style.height===s&&delete j.style.height);var w=f||j.style.resizeMode;return w&&(u?(delete j.style.flex,j.style.width=j.style.width||"100%",j.style.height=j.style.height||"100%",j.style.objectFit=w):(j.resize=w,j.style.resizeMode=w)),(0,a.createElement)(O,j)}}]),t}();c.propTypes={src:a.PropTypes.string,style:a.PropTypes.object},c.defaultProps={style:{},autoFit:!1},t.default=c,e.exports=t.default},function(t,o){t.exports=e("rax")}])});

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

{"npm/nuke-env/2.0.2/index.cmd":{"requires":[]},"npm/nuke-env/2.0.2/index.native.cmd":{"requires":[]},"npm/nuke-view/2.0.2/index.cmd":{"requires":[]},"npm/nuke-image/2.0.0/index.native.cmd":{"requires":["npm/nuke-env/2.0.2/index.native.cmd","npm/nuke-view/2.0.2/index.cmd"]},"npm/nuke-image/2.0.0/index.cmd":{"requires":["npm/nuke-env/2.0.2/index.cmd","npm/nuke-view/2.0.2/index.cmd"]},"npm/nuke-image/2.0.1/index.native.cmd":{"requires":["npm/nuke-env/2.0.2/index.native.cmd","npm/nuke-view/2.0.2/index.cmd"]},"npm/nuke-image/2.0.1/index.cmd":{"requires":["npm/nuke-env/2.0.2/index.cmd","npm/nuke-view/2.0.2/index.cmd"]},"npm/nuke-image/2.0.2/index.cmd":{"requires":["npm/nuke-env/2.0.2/index.cmd"]},"npm/nuke-image/2.0.2/index.native.cmd":{"requires":["npm/nuke-env/2.0.2/index.native.cmd"]},"npm/nuke-image/2.0.3/index.cmd":{"requires":["npm/nuke-env/2.0.2/index.cmd"]},"npm/nuke-image/2.0.3/index.native.cmd":{"requires":["npm/nuke-env/2.0.2/index.native.cmd"]},"npm/nuke-image/2.0.4/index.cmd":{"requires":["npm/nuke-env/2.0.2/index.cmd"]},"npm/nuke-image/2.0.4/index.native.cmd":{"requires":["npm/nuke-env/2.0.2/index.native.cmd"]},"npm/nuke-image/2.0.5/index.cmd":{"requires":[]},"npm/nuke-image/2.0.5/index.native.cmd":{"requires":[]},"npm/nuke-image/2.0.6/index.cmd":{"requires":[]},"npm/nuke-image/2.0.6/index.native.cmd":{"requires":[]}}
{"npm/nuke-image/2.1.0/index.cmd":{"requires":[]}}
{
"name": "nuke-image",
"version": "2.0.6",
"version": "2.1.1-4.1",
"description": "图片",

@@ -39,9 +39,2 @@ "main": "lib/index",

},
"scripts": {
"dev": "nuke-bin server",
"build": "nuke-bin build",
"prepublish": "nuke-bin build",
"test": "nuke-bin test",
"lint": "eslint '@(src|docs)/**/*.@(js|jsx|md)' || true"
},
"repository": {

@@ -51,13 +44,12 @@ "type": "git",

},
"dependencies": {},
"devDependencies": {
"nuke-page": "^2.x.x",
"nuke-text": "^2.x.x",
"nuke-view": "^2.x.x",
"babel-eslint": "^7.2.3",
"eslint": "3.19.0",
"babel-eslint": "^7.2.3",
"eslint-config-ali": "2.0.0",
"eslint-plugin-import": "2.6.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-react": "7.1.0"
"eslint-plugin-react": "7.1.0",
"nuke-page": "^2.1.1-4.1",
"nuke-text": "^2.1.1-4.1",
"nuke-view": "^2.1.1-4.1"
},

@@ -67,3 +59,4 @@ "publishConfig": {

},
"license": "Apache"
"license": "Apache",
"gitHead": "c3b08914160f6096ce08e646af7b565e50bddbae"
}
/** @jsx createElement */
import {createElement, Component,render} from 'rax';
import { createElement, Component, render } from 'rax';
import Text from 'nuke-text';

@@ -10,67 +10,65 @@ import View from 'nuke-view';

class ImageDemo extends Component {
constructor() {
super();
this.state={
data: [
{src:'http://img.alicdn.com/tps/TB1SrmcOVXXXXXFXpXXXXXXXXXX-520-280.jpg',autoFit:true},
{src:'http://img.alicdn.com/tfs/TB1xCFCPVXXXXchXXXXXXXXXXXX-160-160.gif',autoFit:true},
{src:'https://ubanner.alicdn.com/7857/4348/7461.png?getAvatar=avatar',autoFit:true},
{src:'https://gw.alicdn.com/tps/TB12ShfQXXXXXXLapXXXXXXXXXX-1600-380.jpg',autoFit:false,width:'10rem',height:'10rem'}
]
}
}
imageArrLoadHandler=(index,e)=>{
if(!e.size) return;
console.log('onload',index,e.size.naturalWidth,e.size.naturalHeight);
constructor() {
super();
this.state = {
data: [
{ src: 'http://img.alicdn.com/tps/TB1SrmcOVXXXXXFXpXXXXXXXXXX-520-280.jpg', autoFit: true },
{ src: 'http://img.alicdn.com/tfs/TB1xCFCPVXXXXchXXXXXXXXXXXX-160-160.gif', autoFit: true },
{ src: 'https://ubanner.alicdn.com/7857/4348/7461.png?getAvatar=avatar', autoFit: true },
{ src: 'https://gw.alicdn.com/tps/TB12ShfQXXXXXXLapXXXXXXXXXX-1600-380.jpg', autoFit: false, width: '10rem', height: '10rem' },
],
};
}
imageArrLoadHandler=(index, e) => {
if (!e.size) return;
console.log('onload', index, e.size.naturalWidth, e.size.naturalHeight);
let newData = Object.assign([],this.state.data);
// > 600 以 600 为基准
if(e.size.naturalWidth > 600){
newData[index].width = '600rem';
newData[index].height = Math.round(600 * e.size.naturalHeight/e.size.naturalWidth)+ 'rem';
}
this.setState({ data : newData })
const newData = Object.assign([], this.state.data);
// > 600 以 600 为基准
if (e.size.naturalWidth > 600) {
newData[index].width = '600rem';
newData[index].height = `${Math.round(600 * e.size.naturalHeight / e.size.naturalWidth)}rem`;
}
this.setState({ data: newData });
}
render(){
let data = this.state.data;
return (
<Page title="Image">
{
data.map((item,index)=>{
return (
render() {
const data = this.state.data;
return (
<Page title="Image">
{
data.map((item, index) => (
<View style={styles.itemWrapper}>
<View style={styles.item}>
<Image ref="testimage" src={item.src} autoFit={item.autoFit} style={[{quality:'original'},!item.autoFit?{width:item.width,height:item.height}:{}]} onLoad={(e)=>{this.imageArrLoadHandler(index,e)}} />
</View>
</View>
)
})
}
</Page>
)
<View style={styles.itemWrapper}>
<View style={styles.item}>
<Image ref="testimage" src={item.src} autoFit={item.autoFit} style={[{ quality: 'original' }, !item.autoFit ? { width: item.width, height: item.height } : {}]} onLoad={(e) => { this.imageArrLoadHandler(index, e); }} />
</View>
</View>
))
}
</Page>
);
}
}
const styles={
itemWrapper:{
margin:'30rem',
},
label:{
fontSize:'28rem'
},
item:{
marginTop:'30rem',
marginBottom:'30rem',
borderColor:'#dddddd',
borderWidth:'1rem',
borderStyle:'dashed',
height:'500rem',
justifyContent:'center',
alignItems:'center',
},
img:{
}
}
render(<ImageDemo />);
const styles = {
itemWrapper: {
margin: '30rem',
},
label: {
fontSize: '28rem',
},
item: {
marginTop: '30rem',
marginBottom: '30rem',
borderColor: '#dddddd',
borderWidth: '1rem',
borderStyle: 'dashed',
height: '500rem',
justifyContent: 'center',
alignItems: 'center',
},
img: {
},
};
render(<ImageDemo />);
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