@times-components/image 6.13.0 → 6.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/image.js +5 -0
- package/package.json +2 -2
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.13.1](https://github.com/newsuk/times-components/compare/@times-components/image@6.13.0...@times-components/image@6.13.1) (2022-09-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **TDP-000:** image without resize ([#3137](https://github.com/newsuk/times-components/issues/3137)) ([1238250](https://github.com/newsuk/times-components/commit/123825054ca14d8db8c8202d68adf7d709c22bdd))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [6.13.0](https://github.com/newsuk/times-components/compare/@times-components/image@6.12.8...@times-components/image@6.13.0) (2022-08-18)
|
|
7
18
|
|
|
8
19
|
|
package/dist/image.js
CHANGED
|
@@ -119,8 +119,11 @@ var TimesImage = /*#__PURE__*/function (_Component) {
|
|
|
119
119
|
url = _ref.url;
|
|
120
120
|
var highResIsLoaded = this.state.highResIsLoaded;
|
|
121
121
|
var accessibilityLabel = this.props.accessibilityLabel;
|
|
122
|
+
console.log("ImageRender", url, "highResImage", !lowResSize || highResSize);
|
|
122
123
|
|
|
123
124
|
if (!lowResSize || highResSize) {
|
|
125
|
+
console.log("ImageRender", url, "highResImage", highResSize);
|
|
126
|
+
console.log("ImageRender", url, "highResImage", (0, _utils.appendToImageURL)(url, "resize", highResSize));
|
|
124
127
|
return /*#__PURE__*/_react["default"].createElement(_responsive["default"], {
|
|
125
128
|
alt: accessibilityLabel,
|
|
126
129
|
ref: this.getHighResImage,
|
|
@@ -152,6 +155,8 @@ var TimesImage = /*#__PURE__*/function (_Component) {
|
|
|
152
155
|
imageSource = (0, _utils.appendToImageURL)(imageSource, "quality", lowResQuality);
|
|
153
156
|
}
|
|
154
157
|
|
|
158
|
+
console.log("ImageRender", url, "lowResImage", lowResSize, lowResQuality);
|
|
159
|
+
console.log("ImageRender", url, "lowResImage", imageSource);
|
|
155
160
|
return /*#__PURE__*/_react["default"].createElement(_responsive["default"], {
|
|
156
161
|
alt: accessibilityLabel,
|
|
157
162
|
ref: this.getLowResImage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/image",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.1",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"dev": "src/index",
|
|
6
6
|
"scripts": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "3df88abd59cac767ff875c11dab2eb7cc553af9a"
|
|
71
71
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(
|
|
1
|
+
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t,n){"use strict";n.r(t);var o=n(0),r=n.n(o),i=n(2),a=n(1),s=n.n(a),l=n(3),u={placeholder:{alignItems:"center",backgroundColor:l.colours.functional.backgroundSecondary,bottom:0,justifyContent:"center",left:0,position:"absolute",right:0,top:0,zIndex:0}};var c=function(){return r.a.createElement("svg",{height:"auto",version:"1.1",viewBox:"145 50 108 120",width:"100%",style:{maxWidth:"25%",maxHeight:"50%"}},r.a.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},r.a.createElement("path",{d:"M211.26076,54 L211.231367,54 L147.67512,54 L145,85.7081465 L146.922096,86.4489102 C146.922096,86.4489102 164.867589,68.1355181 168.301115,65.0001546 C171.728017,61.8689133 174.237132,61.0885763 176.436179,60.3527593 C180.998206,59.169681 185.977937,59.2150255 185.977937,59.2150255 L186.109581,59.2150255 L186.109581,156.560932 L169.259886,164.473953 L169.259886,166 L228.735147,166 L228.735147,164.473953 L211.889177,156.560932 L211.889177,59.2150255 L212.01751,59.2150255 C212.01751,59.2150255 216.992272,59.169681 221.558854,60.3527593 C223.757072,61.0885763 226.266601,61.8689133 229.691848,65.0001546 C233.130341,68.1355181 251.071695,86.4489102 251.071695,86.4489102 L253,85.7081465 L250.317842,54 L211.270695,54 L211.242545,54",fill:l.colours.functional.contrast})))};function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=function(e){var t=e.borderRadius,n=void 0===t?0:t,o=f(f({},u.placeholder),{},{borderRadius:n});return r.a.createElement(i.TcView,{height:"100%",style:o,width:"100%"},r.a.createElement(c,null))},h=(s.a.object,s.a.string,s.a.number,s.a.number,s.a.bool,s.a.bool,s.a.number,s.a.number,s.a.number,s.a.func,s.a.bool,s.a.string,{aspectRatio:void 0,disablePlaceholder:!1,fadeImageIn:!1,highResSize:null,lowResSize:null,rounded:!1,uri:null}),b=n(4),y=n.n(b).a.img.withConfig({displayName:"responsive",componentId:"sc-1nnon4d-0"})(["display:block;opacity:",";position:absolute;transition:opacity 0.3s ease-in-out;width:100%;z-index:",";"],(function(e){return e.isLoaded?1:0}),(function(e){return e.zIndex}));function m(e){return(m="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})(e)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=P(e);if(t){var r=P(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==m(t)&&"function"!=typeof t?j(e):t}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var S=function(e){!function(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&&w(e,t)}(s,e);var t,n,o,a=v(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=a.call(this,e)).state={highResIsLoaded:!1,highResIsVisible:!1,imageIsLoaded:!1,lowResIsLoaded:!e.fadeImageIn},t.handleHighResOnLoad=t.handleHighResOnLoad.bind(j(t)),t.handleLowResOnLoad=t.handleLowResOnLoad.bind(j(t)),t.onHighResTransitionEnd=t.onHighResTransitionEnd.bind(j(t)),t.getLowResImage=t.getLowResImage.bind(j(t)),t.getHighResImage=t.getHighResImage.bind(j(t)),t}return t=s,(n=[{key:"onHighResTransitionEnd",value:function(){this.setState({highResIsVisible:!0})}},{key:"getHighResImage",value:function(e){e&&e.complete&&this.handleHighResOnLoad()}},{key:"getLowResImage",value:function(e){e&&e.complete&&this.handleLowResOnLoad()}},{key:"handleLowResOnLoad",value:function(){this.setState({imageIsLoaded:!0,lowResIsLoaded:!0})}},{key:"handleHighResOnLoad",value:function(){this.setState({highResIsLoaded:!0,imageIsLoaded:!0})}},{key:"highResImage",value:function(e){var t=e.highResSize,n=e.lowResSize,o=e.url,a=this.state.highResIsLoaded,s=this.props.accessibilityLabel;return console.log("ImageRender",o,"highResImage",!n||t),!n||t?(console.log("ImageRender",o,"highResImage",t),console.log("ImageRender",o,"highResImage",Object(i.appendToImageURL)(o,"resize",t)),r.a.createElement(y,{alt:s,ref:this.getHighResImage,isLoaded:a,onLoad:this.handleHighResOnLoad,onTransitionEnd:this.onHighResTransitionEnd,src:Object(i.appendToImageURL)(o,"resize",t),zIndex:2})):null}},{key:"lowResImage",value:function(e){var t=e.lowResQuality,n=e.lowResSize,o=e.url,a=this.state,s=a.highResIsVisible,l=a.lowResIsLoaded,u=this.props.accessibilityLabel;if(n&&!s){var c=Object(i.appendToImageURL)(o,"resize",n);return t&&(c=Object(i.appendToImageURL)(c,"quality",t)),console.log("ImageRender",o,"lowResImage",n,t),console.log("ImageRender",o,"lowResImage",c),r.a.createElement(y,{alt:u,ref:this.getLowResImage,isLoaded:l,onLoad:this.handleLowResOnLoad,src:c,zIndex:1})}return null}},{key:"render",value:function(){var e=this.props,t=e.aspectRatio,n=e.disablePlaceholder,o=e.highResSize,a=e.lowResQuality,s=e.lowResSize,l=e.style,u=e.uri,c=e.onLayout,d=e.rounded,f=this.state.imageIsLoaded,p=Object(i.addMissingProtocol)(u),h=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},l);return d&&Object.assign(h,{borderRadius:"50%",overflow:"hidden"}),r.a.createElement(i.TcView,{onLayout:c,style:h,testID:"Image"},r.a.createElement("div",{style:{paddingBottom:"".concat(100/t,"%")}},this.highResImage({highResSize:o,lowResSize:s,url:p}),this.lowResImage({lowResQuality:a,lowResSize:s,url:p}),n||f?null:r.a.createElement(g,{borderRadius:d?"50%":0})))}}])&&L(t.prototype,n),o&&L(t,o),s}(o.Component);S.defaultProps=h;var E=S,x=E;n.d(t,"ModalImage",(function(){return x})),n.d(t,"Placeholder",(function(){return g}));t.default=E}]);
|