@coding-blocks/web-components
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).WebComponents=n()}(this,(function(){"use strict";function t(){}function n(t){return t()}function e(){return Object.create(null)}function o(t){t.forEach(n)}function r(t){return"function"==typeof t}function c(t,n){return t!=t?n==n:t!==n||t&&"object"==typeof t||"function"==typeof t}function i(t,n){t.appendChild(n)}function s(t,n,e){t.insertBefore(n,e||null)}function l(t){t.parentNode.removeChild(t)}function u(t){return document.createElement(t)}function a(t){return document.createTextNode(t)}function f(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}let d;function p(t){d=t}function h(t){(function(){if(!d)throw new Error("Function called outside component initialization");return d})().$$.on_mount.push(t)}const g=[],m=[],$=[],b=[],w=Promise.resolve();let y=!1;function x(t){$.push(t)}const _=new Set;function k(){do{for(;g.length;){const t=g.shift();p(t),v(t.$$)}for(;m.length;)m.pop()();for(let t=0;t<$.length;t+=1){const n=$[t];_.has(n)||(_.add(n),n())}$.length=0}while(g.length);for(;b.length;)b.pop()();y=!1,_.clear()}function v(t){if(null!==t.fragment){t.update(),o(t.before_update);const n=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,n),t.after_update.forEach(x)}}const T=new Set;function E(t,n){-1===t.$$.dirty[0]&&(g.push(t),y||(y=!0,w.then(k)),t.$$.dirty.fill(0)),t.$$.dirty[n/31|0]|=1<<n%31}function C(c,i,s,l,u,a,f=[-1]){const h=d;p(c);const g=i.props||{},m=c.$$={fragment:null,ctx:null,props:a,update:t,not_equal:u,bound:e(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:e(),dirty:f};let $=!1;var b,w;m.ctx=s?s(c,g,(t,n,...e)=>{const o=e.length?e[0]:n;return m.ctx&&u(m.ctx[t],m.ctx[t]=o)&&(m.bound[t]&&m.bound[t](o),$&&E(c,t)),n}):[],m.update(),$=!0,o(m.before_update),m.fragment=!!l&&l(m.ctx),i.target&&(i.hydrate?m.fragment&&m.fragment.l(function(t){return Array.from(t.childNodes)}(i.target)):m.fragment&&m.fragment.c(),i.intro&&((b=c.$$.fragment)&&b.i&&(T.delete(b),b.i(w))),function(t,e,c){const{fragment:i,on_mount:s,on_destroy:l,after_update:u}=t.$$;i&&i.m(e,c),x(()=>{const e=s.map(n).filter(r);l?l.push(...e):o(e),t.$$.on_mount=[]}),u.forEach(x)}(c,i.target,i.anchor),k()),p(h)}let A;function L(t){let n,e,o,r,c=t[0]&&j(t);return{c(){n=u("a"),c&&c.c(),e=a(" "),o=u("img"),o.src!==(r=t[1])&&f(o,"src",r),f(o,"alt",""),f(o,"class","w-100"),f(n,"class","d-block"),f(n,"target","_blank"),f(n,"href",t[2])},m(t,r){s(t,n,r),c&&c.m(n,null),i(n,e),i(n,o)},p(t,i){t[0]?c?c.p(t,i):(c=j(t),c.c(),c.m(n,e)):c&&(c.d(1),c=null),2&i&&o.src!==(r=t[1])&&f(o,"src",r),4&i&&f(n,"href",t[2])},d(t){t&&l(n),c&&c.d()}}}function j(n){let e,o,r;return{c(){e=u("img"),f(e,"class","close-icon"),e.src!==(o="https://minio.codingblocks.com/motley/wrong_g.png")&&f(e,"src","https://minio.codingblocks.com/motley/wrong_g.png"),f(e,"alt","close")},m(t,o){var c;s(t,e,o),r=function(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}(e,"click",function(t){return function(n){return n.stopPropagation(),t.call(this,n)}}((c=n[4],function(t){return t.preventDefault(),c.call(this,t)})),!0)},p:t,d(t){t&&l(e),r()}}}function M(n){let e,o=n[3]&&L(n);return{c(){o&&o.c(),e=a(""),this.c=t},m(t,n){o&&o.m(t,n),s(t,e,n)},p(t,[n]){t[3]?o?o.p(t,n):(o=L(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},i:t,o:t,d(t){o&&o.d(t),t&&l(e)}}}function N(t,n,e){let o="",r="",c=!0,{showToggle:i=!0}=n;h(async()=>{const t=await fetch("https://hack-api.codingblocks.com/api/v2/dashboard-banners"),{data:[n]}=await t.json(),c=n.attributes;e(1,o=c["image-url"]),e(2,r=c.link)});return t.$set=t=>{"showToggle"in t&&e(0,i=t.showToggle)},[i,o,r,c,()=>{e(3,c=!c)}]}"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,n,e){this[t]=e}$destroy(){!function(t,n){const e=t.$$;null!==e.fragment&&(o(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}(this,1),this.$destroy=t}$on(t,n){const e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(n),()=>{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(){}});class H extends A{constructor(t){super(),this.shadowRoot.innerHTML="<style>.d-block{display:block;position:relative}.w-100{width:100%}.close-icon{position:absolute;right:10px;cursor:pointer;top:10px;width:15px;transition:width 0.1s}.close-icon:hover{width:18px}</style>",C(this,{target:this.shadowRoot},N,M,c,{showToggle:0}),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),k()))}static get observedAttributes(){return["showToggle"]}get showToggle(){return this.$$.ctx[0]}set showToggle(t){this.$set({showToggle:t}),k()}}return customElements.define("promotion-banner",H),H})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).WebComponents=n()}(this,(function(){"use strict";function t(){}function n(t){return t()}function e(){return Object.create(null)}function o(t){t.forEach(n)}function r(t){return"function"==typeof t}function c(t,n){return t!=t?n==n:t!==n||t&&"object"==typeof t||"function"==typeof t}function i(t,n){t.appendChild(n)}function s(t,n,e){t.insertBefore(n,e||null)}function l(t){t.parentNode.removeChild(t)}function u(t){return document.createElement(t)}function a(t){return document.createTextNode(t)}function f(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}let d;function p(t){d=t}function h(t){(function(){if(!d)throw new Error("Function called outside component initialization");return d})().$$.on_mount.push(t)}const g=[],m=[],$=[],b=[],y=Promise.resolve();let w=!1;function x(t){$.push(t)}const _=new Set;function k(){do{for(;g.length;){const t=g.shift();p(t),v(t.$$)}for(;m.length;)m.pop()();for(let t=0;t<$.length;t+=1){const n=$[t];_.has(n)||(_.add(n),n())}$.length=0}while(g.length);for(;b.length;)b.pop()();w=!1,_.clear()}function v(t){if(null!==t.fragment){t.update(),o(t.before_update);const n=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,n),t.after_update.forEach(x)}}const T=new Set;function E(t,n){-1===t.$$.dirty[0]&&(g.push(t),w||(w=!0,y.then(k)),t.$$.dirty.fill(0)),t.$$.dirty[n/31|0]|=1<<n%31}function C(c,i,s,l,u,a,f=[-1]){const h=d;p(c);const g=i.props||{},m=c.$$={fragment:null,ctx:null,props:a,update:t,not_equal:u,bound:e(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:e(),dirty:f};let $=!1;var b,y;m.ctx=s?s(c,g,(t,n,...e)=>{const o=e.length?e[0]:n;return m.ctx&&u(m.ctx[t],m.ctx[t]=o)&&(m.bound[t]&&m.bound[t](o),$&&E(c,t)),n}):[],m.update(),$=!0,o(m.before_update),m.fragment=!!l&&l(m.ctx),i.target&&(i.hydrate?m.fragment&&m.fragment.l(function(t){return Array.from(t.childNodes)}(i.target)):m.fragment&&m.fragment.c(),i.intro&&((b=c.$$.fragment)&&b.i&&(T.delete(b),b.i(y))),function(t,e,c){const{fragment:i,on_mount:s,on_destroy:l,after_update:u}=t.$$;i&&i.m(e,c),x(()=>{const e=s.map(n).filter(r);l?l.push(...e):o(e),t.$$.on_mount=[]}),u.forEach(x)}(c,i.target,i.anchor),k()),p(h)}let A;function L(t){let n,e,o,r,c=t[0]&&j(t);return{c(){n=u("a"),c&&c.c(),e=a(" "),o=u("img"),o.src!==(r=t[1])&&f(o,"src",r),f(o,"alt",""),f(o,"width","100%"),f(n,"class","d-block"),f(n,"target","_blank"),f(n,"href",t[2])},m(t,r){s(t,n,r),c&&c.m(n,null),i(n,e),i(n,o)},p(t,i){t[0]?c?c.p(t,i):(c=j(t),c.c(),c.m(n,e)):c&&(c.d(1),c=null),2&i&&o.src!==(r=t[1])&&f(o,"src",r),4&i&&f(n,"href",t[2])},d(t){t&&l(n),c&&c.d()}}}function j(n){let e,o,r;return{c(){e=u("img"),f(e,"class","close-icon"),e.src!==(o="https://minio.codingblocks.com/motley/wrong_g.png")&&f(e,"src","https://minio.codingblocks.com/motley/wrong_g.png"),f(e,"alt","close")},m(t,o){var c;s(t,e,o),r=function(t,n,e,o){return t.addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}(e,"click",function(t){return function(n){return n.stopPropagation(),t.call(this,n)}}((c=n[4],function(t){return t.preventDefault(),c.call(this,t)})),!0)},p:t,d(t){t&&l(e),r()}}}function M(n){let e,o=n[3]&&L(n);return{c(){o&&o.c(),e=a(""),this.c=t},m(t,n){o&&o.m(t,n),s(t,e,n)},p(t,[n]){t[3]?o?o.p(t,n):(o=L(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},i:t,o:t,d(t){o&&o.d(t),t&&l(e)}}}function N(t,n,e){let o="",r="",c=!0,{showToggle:i=!0}=n;h(async()=>{const t=await fetch("https://hack-api.codingblocks.com/api/v2/dashboard-banners"),{data:[n]}=await t.json(),c=n.attributes;e(1,o=c["image-url"]),e(2,r=c.link)});return t.$set=t=>{"showToggle"in t&&e(0,i=t.showToggle)},[i,o,r,c,()=>{e(3,c=!c)}]}"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,n,e){this[t]=e}$destroy(){!function(t,n){const e=t.$$;null!==e.fragment&&(o(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}(this,1),this.$destroy=t}$on(t,n){const e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(n),()=>{const t=e.indexOf(n);-1!==t&&e.splice(t,1)}}$set(){}});class H extends A{constructor(t){super(),this.shadowRoot.innerHTML="<style>.d-block{display:block;position:relative}.close-icon{position:absolute;right:10px;cursor:pointer;top:10px;width:15px;transition:width 0.1s}.close-icon:hover{width:18px}</style>",C(this,{target:this.shadowRoot},N,M,c,{showToggle:0}),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),k()))}static get observedAttributes(){return["showToggle"]}get showToggle(){return this.$$.ctx[0]}set showToggle(t){this.$set({showToggle:t}),k()}}return customElements.define("promotion-banner",H),H})); |
@@ -5,3 +5,3 @@ { | ||
"module": "dist/index.mjs", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "dist/index.js", | ||
@@ -8,0 +8,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11806