New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rax-image

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rax-image - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

2

CHANGELOG.md
# changelog
## 2.2.4
- [feat] Support loading
## 2.2.2
- [feat] Support ref

2

dist/index-es6.js

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

!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(1);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t};const a={},c=Object(n.forwardRef)((e,r)=>{var{source:t,fallbackSource:c,onLoad:l,onError:s,style:f,resizeMode:p}=e,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode"]);t=t||a,c=c||a;const d=b,[y,O]=Object(n.useState)({});d.onError=Object(n.useCallback)(e=>{void 0===y.uri&&O({uri:t.uri}),s&&s(e)},[t.uri,s,y]),d.onLoad=Object(n.useCallback)(e=>{o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):s&&s(e)},[l,s]),void 0!==y.uri&&(y.uri!==t.uri?y.uri=void 0:null!=c.uri&&(t=c));const{width:g,height:v,uri:j}=t;return d.src=j,d.style=Object.assign({width:g,height:v},f),(p=p||d.style.resizeMode)&&(o.isWeex?(d.resize=p,d.style.resizeMode=p):d.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},d,{ref:r})):Object(n.createElement)("img",i({},d,{ref:r}))});r.default=c}]);
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t};const a={},c=Object(n.forwardRef)((e,r)=>{var{source:t,fallbackSource:c,onLoad:l,onError:s,style:f,resizeMode:p,loading:d}=e,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;const y=b,[g,O]=Object(n.useState)({});y.onError=Object(n.useCallback)(e=>{void 0===g.uri&&O({uri:t.uri}),s&&s(e)},[t.uri,s,g]),y.onLoad=Object(n.useCallback)(e=>{o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):s&&s(e)},[l,s]),void 0!==g.uri&&(g.uri!==t.uri?g.uri=void 0:null!=c.uri&&(t=c));const{width:v,height:j,uri:h}=t;return y.src=h,y.style=Object.assign({width:v,height:j},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))});r.default=c}]);

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

!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(1);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,f=e.onError,s=e.style,p=e.resizeMode,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode"]);t=t||a,c=c||a;var d=b,y=Object(n.useState)({}),O=y[0],v=y[1];d.onError=Object(n.useCallback)((function(e){void 0===O.uri&&v({uri:t.uri}),f&&f(e)}),[t.uri,f,O]),d.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):f&&f(e)}),[l,f]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var g=t,j=g.width,h=g.height,m=g.uri;return d.src=m,d.style=Object.assign({width:j,height:h},s),(p=p||d.style.resizeMode)&&(o.isWeex?(d.resize=p,d.style.resizeMode=p):d.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},d,{ref:r})):Object(n.createElement)("img",i({},d,{ref:r}))}));r.default=c}]);
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,s=e.onError,f=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],v=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&v({uri:t.uri}),s&&s(e)}),[t.uri,s,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):s&&s(e)}),[l,s]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var j=t,h=j.width,m=j.height,x=j.uri;return y.src=x,y.style=Object.assign({width:h,height:m},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}]);

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

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxImage=r():e.raxImage=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("rax")},function(e,r){e.exports=require("universal-env")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(0),o=t(1);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,f=e.onError,s=e.style,p=e.resizeMode,d=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode"]);t=t||a,c=c||a;var b=d,y=Object(n.useState)({}),O=y[0],g=y[1];b.onError=Object(n.useCallback)((function(e){void 0===O.uri&&g({uri:t.uri}),f&&f(e)}),[t.uri,f,O]),b.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):f&&f(e)}),[l,f]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var j=t,v=j.width,m=j.height,x=j.uri;return b.src=x,b.style=Object.assign({width:v,height:m},s),(p=p||b.style.resizeMode)&&(o.isWeex?(b.resize=p,b.style.resizeMode=p):b.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},b,{ref:r})):Object(n.createElement)("img",i({},b,{ref:r}))}));r.default=c}])}));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxImage=r():e.raxImage=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,f=e.onError,s=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],j=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&j({uri:t.uri}),f&&f(e)}),[t.uri,f,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):f&&f(e)}),[l,f]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var v=t,m=v.width,x=v.height,h=v.uri;return y.src=h,y.style=Object.assign({width:m,height:x},s),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}])}));

@@ -34,2 +34,6 @@ "use strict";

},
loading: {
type: String,
value: 'eager'
},
lazyLoad: {

@@ -36,0 +40,0 @@ type: Boolean,

@@ -33,3 +33,4 @@ "use strict";

resizeMode = _a.resizeMode,
otherProps = __rest(_a, ["source", "fallbackSource", "onLoad", "onError", "style", "resizeMode"]);
loading = _a.loading,
otherProps = __rest(_a, ["source", "fallbackSource", "onLoad", "onError", "style", "resizeMode", "loading"]);

@@ -84,4 +85,13 @@ source = source || EMPTY_SOURCE;

height: height
}, style); // for cover and contain
}, style);
if (loading) {
if (_universalEnv.isWeb) {
nativeProps.loading = loading;
} else if (_universalEnv.isMiniApp || _universalEnv.isWeChatMiniProgram || _universalEnv.isByteDanceMicroApp) {
nativeProps['lazy-load'] = loading === 'lazy';
}
} // for cover and contain
resizeMode = resizeMode || nativeProps.style.resizeMode;

@@ -99,8 +109,12 @@

return _universalEnv.isWeex ? (0, _rax.createElement)("image", _extends({
quality: "original"
}, nativeProps, {
if (_universalEnv.isWeex) {
return (0, _rax.createElement)("image", _extends({
quality: "original"
}, nativeProps, {
ref: ref
}));
}
return (0, _rax.createElement)("img", _extends({}, nativeProps, {
ref: ref
})) : (0, _rax.createElement)("img", _extends({}, nativeProps, {
ref: ref
}));

@@ -107,0 +121,0 @@ });

@@ -33,2 +33,6 @@ "use strict";

value: false
},
loading: {
type: String,
value: 'eager'
}

@@ -66,3 +70,3 @@ },

initImage: function initImage(type, newValue) {
var _ref = type === 'source' ? newValue : this.properties.source || {},
var _ref = (type === 'source' ? newValue : this.properties.source) || {},
_ref$width = _ref.width,

@@ -69,0 +73,0 @@ width = _ref$width === void 0 ? null : _ref$width,

@@ -20,2 +20,3 @@ "use strict";

mode: 'scaleToFill',
loading: 'eager',
lazyLoad: false,

@@ -22,0 +23,0 @@ onClick: noop,

@@ -47,2 +47,6 @@ import { HTMLAttributes, RefAttributes, CSSProperties, SyntheticEvent } from 'rax';

/**
* loading: how the client should load the image
*/
loading?: 'eager' | 'lazy';
/**
* callback of success

@@ -49,0 +53,0 @@ */

{
"name": "rax-image",
"version": "2.2.3",
"version": "2.2.4",
"description": "Image component for Rax.",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

@@ -31,2 +31,3 @@ # Image

| fallbackSource | `object: { width: string, height: string, uri: string}` | - | false | 备用图片的 uri(当主图加载失败时加载)。height和width为可选项,优先级低于style上的同名属性,一般高于其他CSS中的同名属性。 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /><img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> |
| loading | `string: 'eager' 'lazy'` | `eager` | false | 客户端如何加载图片,其中 Web 下需要浏览器原生支持`loading`属性。 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /><img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"><img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> |
| resizeMode | `string: 'contain' 'cover' 'stretch'` | - | false | 决定当组件尺寸和图片尺寸不成比例的时候如何调整图片的大小 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /><img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> |

@@ -39,3 +40,3 @@ | mode | String: | scaleToFill | false | 小程序中的[图片模式](https://docs.alipay.com/mini/component/image),可选项更多 | <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /><img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"><img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> |

| onError | `function` | - | false | 图片加载失败的回调函数 | <img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /><img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /><img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /><img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"><img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"><img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> |
| src | `string` | - | false | 图片下载完成后将显示 src 中指定的图片。 | <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px">
| src | `string` | - | false | 图片下载完成后将显示 src 中指定的图片。 | <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> |

@@ -42,0 +43,0 @@ ### onLoad onError 返回

@@ -30,2 +30,6 @@ import fmtEvent from './fmtEvent';

},
loading: {
type: String,
value: 'eager'
},
lazyLoad: {

@@ -32,0 +36,0 @@ type: Boolean,

@@ -30,2 +30,6 @@ import fmtEvent from './fmtEvent';

},
loading: {
type: String,
value: 'eager'
},
},

@@ -62,3 +66,3 @@ lifetimes: {

initImage(type, newValue) {
const { width = null, height = null } = type === 'source' ? newValue : this.properties.source || {};
const { width = null, height = null } = (type === 'source' ? newValue : this.properties.source) || {};
let style = type === 'styleSheet' ? newValue : this.properties.styleSheet || '';

@@ -65,0 +69,0 @@ if (width) style += 'width:' + width + 'rpx;';

@@ -15,2 +15,3 @@ import fmtEvent from './fmtEvent';

mode: 'scaleToFill',
loading: 'eager',
lazyLoad: false,

@@ -17,0 +18,0 @@ onClick: noop,

@@ -54,2 +54,6 @@ import {

/**
* loading: how the client should load the image
*/
loading?: 'eager' | 'lazy';
/**
* callback of success

@@ -56,0 +60,0 @@ */

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

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