@aofl/picture
Advanced tools
Comparing version 3.0.0-beta.8 to 3.0.0-beta.9
@@ -25,4 +25,3 @@ const path = require('path'); | ||
output: { | ||
library: 'aoflPicture', | ||
libraryTarget: 'umd' | ||
libraryTarget: 'commonjs2' | ||
}, | ||
@@ -29,0 +28,0 @@ optimization: { |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@aofl/component-utils"),require("@aofl/element")):"function"==typeof define&&define.amd?define(["@aofl/component-utils","@aofl/element"],e):"object"==typeof exports?exports.aoflPicture=e(require("@aofl/component-utils"),require("@aofl/element")):t.aoflPicture=e(t[void 0],t[void 0])}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s="QfWi")}({"7W2i":function(t,e,n){var r=n("SksO");t.exports=function(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&&r(t,e)}},Nsbk:function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},PJYZ:function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},QfWi:function(t,e,n){"use strict";n.r(e);var r=n("VkAN"),i=n.n(r),o=n("lwsE"),u=n.n(o),c=n("W8MJ"),s=n.n(c),a=n("a1gu"),l=n.n(a),f=n("Nsbk"),h=n.n(f),p=n("iWIM"),d=n.n(p),g=n("7W2i"),y=n.n(g),m=n("ymFR"),b=n("yKgC");function v(){var t=i()(['\n <canvas width="','" height="','"></canvas>\n <img alt="','" height="','" width="','" src="','" @load="','">\n ']);return v=function(){return t},t}var w="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A=function(t){function e(){var t;return u()(this,e),(t=l()(this,h()(e).call(this))).imgSrc=w,t.src=w,t.widthThreshold=1,t.heightThreshold=1,t}return y()(e,t),s()(e,[{key:"connectedCallback",value:function(){for(var t,n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(t=d()(h()(e.prototype),"connectedCallback",this)).call.apply(t,[this].concat(i)),setTimeout((function(){n.checkInViewport()})),this.loadImage(this.src);try{var u=Object(b.findParent)(this,"setImg");u.setImg(this)}catch(t){this.loadImage(this.src)}}},{key:"firstWithinViewport",value:function(){this.stopIsInViewportCheck(),this.loadImage(this.src)}},{key:"render",value:function(){return d()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(v(),t.width,t.height,t.alt,t.height,t.width,t.imgSrc,(function(e){return t.imageLoaded(e)}))}),["\n :host {\n display: inline-block;\n position: relative;\n line-height: 0;\n }\n\n :host canvas {\n width: 100%;\n height: 100%;\n }\n\n :host img {\n display: inline-block;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n }\n "])}},{key:"shouldUpdate",value:function(t){return t.has("src")&&"string"==typeof this.src&&this.loadImage(this.src),!0}},{key:"loadImage",value:function(t){!0===this.onceWithinViewport&&(this.imgSrc=t,this.requestUpdate())}},{key:"imageLoaded",value:function(t){void 0===this.width&&(this.width=t.target.width),void 0===this.height&&(this.height=t.target.height),this.dispatchEvent(new CustomEvent("load"))}}],[{key:"is",get:function(){return"aofl-img"}},{key:"properties",get:function(){return{src:{type:String},imgSrc:{type:String,attribute:!1},width:{type:String},height:{type:String},alt:{type:String}}}}]),e}(Object(b.isInViewportMixin)(m.AoflElement));void 0===window.customElements.get(A.is)&&window.customElements.define(A.is,A);var S=A;function k(){var t=i()([""]);return k=function(){return t},t}var x=function(t){function e(){return u()(this,e),l()(this,h()(e).apply(this,arguments))}return y()(e,t),s()(e,[{key:"connectedCallback",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=d()(h()(e.prototype),"connectedCallback",this)).call.apply(t,[this].concat(r));var o=Object(b.findParent)(this,"addSource");if(!o)throw new Error("aofl-source must be used inside of aofl-picture");o.addSource(this)}},{key:"render",value:function(){return d()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(k())}))}}],[{key:"is",get:function(){return"aofl-source"}},{key:"properties",get:function(){return{media:{type:String},srcset:{type:String}}}}]),e}(m.AoflElement);void 0===window.customElements.get(x.is)&&window.customElements.define(x.is,x);var O=x;function j(){var t=i()(["<slot></slot>"]);return j=function(){return t},t}var I=function(t){function e(){var t;return u()(this,e),(t=l()(this,h()(e).call(this))).img=null,t.defaultSrc=null,t.sources=[],t.updateImageSrc=function(){var n=e.findMatchingSource(t.sources);t.setMediaSrc(n)},t}return y()(e,t),s()(e,[{key:"render",value:function(){return d()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(j())}),["\n :host {\n display: inline-block;\n line-height: 0;\n }\n "])}},{key:"setImg",value:function(t){null===this.img&&(this.img=t,this.defaultSrc={src:this.img.src,height:this.img.height,width:this.img.width},this.updateImageSrc())}},{key:"addSource",value:function(t){if(void 0===this["disable-sources"]||"false"===this["disable-sources"]){var e=window.matchMedia(t.getAttribute("media")),n={src:t.getAttribute("srcset"),height:t.getAttribute("height"),width:t.getAttribute("width"),mediaQuery:e};this.sources.push(n),e.addListener(this.updateImageSrc),this.updateImageSrc()}}},{key:"setMediaSrc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultSrc;if(this.img){var e=this.img.src;e!==t.src&&(this.img.setAttribute("src",t.src),t.width&&this.img.setAttribute("width",t.width),t.height&&this.img.setAttribute("height",t.height))}}},{key:"disconnectedCallback",value:function(){for(var t=0;t<this.sources.length;t++)this.sources[t].mediaQuery.removeListener(this.updateImageSrc);d()(h()(e.prototype),"disconnectedCallback",this).call(this)}}],[{key:"findMatchingSource",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e<t.length;e++)if(!0===t[e].mediaQuery.matches)return t[e]}},{key:"is",get:function(){return"aofl-picture"}},{key:"properties",get:function(){return{"disable-sources":{type:String}}}}]),e}(m.AoflElement);void 0===window.customElements.get(I.is)&&window.customElements.define(I.is,I);var P=I;n.d(e,"AoflImg",(function(){return S})),n.d(e,"AoflSource",(function(){return O})),n.d(e,"AoflPicture",(function(){return P}))},SksO:function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},VkAN:function(t,e){t.exports=function(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}},W8MJ:function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},a1gu:function(t,e,n){var r=n("cDf5"),i=n("PJYZ");t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?i(t):e}},cDf5:function(t,e){function n(t){return(n="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})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},iWIM:function(t,e,n){var r=n("n3AX");function i(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,n){var i=r(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}},i(e,n,o||e)}t.exports=i},lwsE:function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},n3AX:function(t,e,n){var r=n("Nsbk");t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}},yKgC:function(e,n){e.exports=t},ymFR:function(t,n){t.exports=e}})})); | ||
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s="QfWi")}({"7W2i":function(t,e,n){var r=n("SksO");t.exports=function(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&&r(t,e)}},Nsbk:function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},PJYZ:function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},QfWi:function(t,e,n){"use strict";n.r(e);var r=n("VkAN"),i=n.n(r),o=n("lwsE"),u=n.n(o),c=n("W8MJ"),s=n.n(c),a=n("a1gu"),l=n.n(a),f=n("Nsbk"),h=n.n(f),d=n("iWIM"),p=n.n(d),g=n("7W2i"),y=n.n(g),m=n("ymFR"),b=n("yKgC");function v(){var t=i()(['\n <canvas width="','" height="','"></canvas>\n <img alt="','" height="','" width="','" src="','" @load="','">\n ']);return v=function(){return t},t}var w="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",A=function(t){function e(){var t;return u()(this,e),(t=l()(this,h()(e).call(this))).imgSrc=w,t.src=w,t.widthThreshold=1,t.heightThreshold=1,t}return y()(e,t),s()(e,[{key:"connectedCallback",value:function(){for(var t,n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(t=p()(h()(e.prototype),"connectedCallback",this)).call.apply(t,[this].concat(i)),setTimeout((function(){n.checkInViewport()})),this.loadImage(this.src);try{var u=Object(b.findParent)(this,"setImg");u.setImg(this)}catch(t){this.loadImage(this.src)}}},{key:"firstWithinViewport",value:function(){this.stopIsInViewportCheck(),this.loadImage(this.src)}},{key:"render",value:function(){return p()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(v(),t.width,t.height,t.alt,t.height,t.width,t.imgSrc,(function(e){return t.imageLoaded(e)}))}),["\n :host {\n display: inline-block;\n position: relative;\n line-height: 0;\n }\n\n :host canvas {\n width: 100%;\n height: 100%;\n }\n\n :host img {\n display: inline-block;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n }\n "])}},{key:"shouldUpdate",value:function(t){return t.has("src")&&"string"==typeof this.src&&this.loadImage(this.src),!0}},{key:"loadImage",value:function(t){!0===this.onceWithinViewport&&(this.imgSrc=t,this.requestUpdate())}},{key:"imageLoaded",value:function(t){void 0===this.width&&(this.width=t.target.width),void 0===this.height&&(this.height=t.target.height),this.dispatchEvent(new CustomEvent("load"))}}],[{key:"is",get:function(){return"aofl-img"}},{key:"properties",get:function(){return{src:{type:String},imgSrc:{type:String,attribute:!1},width:{type:String},height:{type:String},alt:{type:String}}}}]),e}(Object(b.isInViewportMixin)(m.AoflElement));void 0===window.customElements.get(A.is)&&window.customElements.define(A.is,A);var S=A;function k(){var t=i()([""]);return k=function(){return t},t}var O=function(t){function e(){return u()(this,e),l()(this,h()(e).apply(this,arguments))}return y()(e,t),s()(e,[{key:"connectedCallback",value:function(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];(t=p()(h()(e.prototype),"connectedCallback",this)).call.apply(t,[this].concat(r));var o=Object(b.findParent)(this,"addSource");if(!o)throw new Error("aofl-source must be used inside of aofl-picture");o.addSource(this)}},{key:"render",value:function(){return p()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(k())}))}}],[{key:"is",get:function(){return"aofl-source"}},{key:"properties",get:function(){return{media:{type:String},srcset:{type:String}}}}]),e}(m.AoflElement);void 0===window.customElements.get(O.is)&&window.customElements.define(O.is,O);var x=O;function j(){var t=i()(["<slot></slot>"]);return j=function(){return t},t}var I=function(t){function e(){var t;return u()(this,e),(t=l()(this,h()(e).call(this))).img=null,t.defaultSrc=null,t.sources=[],t.updateImageSrc=function(){var n=e.findMatchingSource(t.sources);t.setMediaSrc(n)},t}return y()(e,t),s()(e,[{key:"render",value:function(){return p()(h()(e.prototype),"render",this).call(this,(function(t,e){return e(j())}),["\n :host {\n display: inline-block;\n line-height: 0;\n }\n "])}},{key:"setImg",value:function(t){null===this.img&&(this.img=t,this.defaultSrc={src:this.img.src,height:this.img.height,width:this.img.width},this.updateImageSrc())}},{key:"addSource",value:function(t){if(void 0===this["disable-sources"]||"false"===this["disable-sources"]){var e=window.matchMedia(t.getAttribute("media")),n={src:t.getAttribute("srcset"),height:t.getAttribute("height"),width:t.getAttribute("width"),mediaQuery:e};this.sources.push(n),e.addListener(this.updateImageSrc),this.updateImageSrc()}}},{key:"setMediaSrc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultSrc;if(this.img){var e=this.img.src;e!==t.src&&(this.img.setAttribute("src",t.src),t.width&&this.img.setAttribute("width",t.width),t.height&&this.img.setAttribute("height",t.height))}}},{key:"disconnectedCallback",value:function(){for(var t=0;t<this.sources.length;t++)this.sources[t].mediaQuery.removeListener(this.updateImageSrc);p()(h()(e.prototype),"disconnectedCallback",this).call(this)}}],[{key:"findMatchingSource",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e<t.length;e++)if(!0===t[e].mediaQuery.matches)return t[e]}},{key:"is",get:function(){return"aofl-picture"}},{key:"properties",get:function(){return{"disable-sources":{type:String}}}}]),e}(m.AoflElement);void 0===window.customElements.get(I.is)&&window.customElements.define(I.is,I);var E=I;n.d(e,"AoflImg",(function(){return S})),n.d(e,"AoflSource",(function(){return x})),n.d(e,"AoflPicture",(function(){return E}))},SksO:function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,r)}t.exports=n},VkAN:function(t,e){t.exports=function(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}},W8MJ:function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},a1gu:function(t,e,n){var r=n("cDf5"),i=n("PJYZ");t.exports=function(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?i(t):e}},cDf5:function(t,e){function n(t){return(n="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})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},iWIM:function(t,e,n){var r=n("n3AX");function i(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,n){var i=r(t,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(n):o.value}},i(e,n,o||e)}t.exports=i},lwsE:function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},n3AX:function(t,e,n){var r=n("Nsbk");t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}},yKgC:function(t,e){t.exports=require("@aofl/component-utils")},ymFR:function(t,e){t.exports=require("@aofl/element")}}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@aofl/picture", | ||
"version": "3.0.0-beta.8", | ||
"version": "3.0.0-beta.9", | ||
"description": "`<aofl-picture>` serves as a container for zero or more `<aofl-source>` and one `<aofl-img>` elements to provide versions of an image for different display sizes. Display size specific sources are defined using the media attribute of the `aofl-source` element. `<aofl-img>` embeds an image into the document. It behaves similarly to `<img>` with the addition of lazy loading images as they scroll near the visible area of the screen. The current formula is 2x height or width. In addition to this `<aofl-img>` can be combined with `<aofl-picture>` and `<aofl-source>` to provide different images for different display sizes. AoflSource component must be used as a child of aofl-picture and specifies images for different media queries.", | ||
"main": "dist/index.js", | ||
"module": "index.js", | ||
"scripts": { | ||
@@ -40,7 +39,7 @@ "test": "echo \"Error: no test specified\" && exit 1", | ||
"@aofl/cli": "^3.0.0-beta.6", | ||
"@aofl/component-utils": "^3.0.0-beta.8", | ||
"@aofl/element": "^3.0.0-beta.8", | ||
"@aofl/component-utils": "^3.0.0-beta.9", | ||
"@aofl/element": "^3.0.0-beta.9", | ||
"cross-env": "^6.0.3" | ||
}, | ||
"gitHead": "31f766f3cf621147bfa1530b863757cb08e5fc10" | ||
"gitHead": "e9e6bf24a51611b9b997dc99e770d43466ba063d" | ||
} |
Sorry, the diff of this file is not supported yet
42369
599