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

@coding-blocks/web-components

Package Overview
Dependencies
Maintainers
5
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coding-blocks/web-components - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/banner.js

2

dist/index.js

@@ -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=[],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}));
this.index=this.index||{},this.index.js=function(t){"use strict";function e(){}function n(t){return t()}function o(){return Object.create(null)}function l(t){t.forEach(n)}function r(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function u(t){t.parentNode.removeChild(t)}function a(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function d(t){return document.createElement(t)}function h(t){return document.createTextNode(t)}function f(){return h(" ")}function p(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function g(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function m(t,e){e=""+e,t.data!==e&&(t.data=e)}function v(t,e){(null!=e||t.value)&&(t.value=e)}function _(t,e){for(let n=0;n<t.options.length;n+=1){const o=t.options[n];if(o.__value===e)return void(o.selected=!0)}}function b(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let y;function $(t){y=t}function w(){if(!y)throw new Error("Function called outside component initialization");return y}function x(t){w().$$.on_mount.push(t)}function k(){const t=w();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const l=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}(e,n);o.slice().forEach(e=>{e.call(t,l)})}}}const C=[],E=[],T=[],j=[],N=Promise.resolve();let A=!1;function I(t){T.push(t)}const L=new Set;function B(){do{for(;C.length;){const t=C.shift();$(t),H(t.$$)}for(;E.length;)E.pop()();for(let t=0;t<T.length;t+=1){const e=T[t];L.has(e)||(L.add(e),e())}T.length=0}while(C.length);for(;j.length;)j.pop()();A=!1,L.clear()}function H(t){if(null!==t.fragment){t.update(),l(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(I)}}const M=new Set;function P(t,e){-1===t.$$.dirty[0]&&(C.push(t),A||(A=!0,N.then(B)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function R(t,c,i,s,u,a,d=[-1]){const h=y;$(t);const f=c.props||{},p=t.$$={fragment:null,ctx:null,props:a,update:e,not_equal:u,bound:o(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:o(),dirty:d};let g=!1;var m,v;p.ctx=i?i(t,f,(e,n,...o)=>{const l=o.length?o[0]:n;return p.ctx&&u(p.ctx[e],p.ctx[e]=l)&&(p.bound[e]&&p.bound[e](l),g&&P(t,e)),n}):[],p.update(),g=!0,l(p.before_update),p.fragment=!!s&&s(p.ctx),c.target&&(c.hydrate?p.fragment&&p.fragment.l(function(t){return Array.from(t.childNodes)}(c.target)):p.fragment&&p.fragment.c(),c.intro&&((m=t.$$.fragment)&&m.i&&(M.delete(m),m.i(v))),function(t,e,o){const{fragment:c,on_mount:i,on_destroy:s,after_update:u}=t.$$;c&&c.m(e,o),I(()=>{const e=i.map(n).filter(r);s?s.push(...e):l(e),t.$$.on_mount=[]}),u.forEach(I)}(t,c.target,c.anchor),B()),$(h)}let S;function U(t){let e,n,o,l,r=t[0]&&O(t);return{c(){e=d("a"),r&&r.c(),n=f(),o=d("img"),o.src!==(l=t[1])&&g(o,"src",l),g(o,"alt",""),g(o,"width","100%"),g(e,"class","d-block"),g(e,"target","_blank"),g(e,"href",t[2])},m(t,l){s(t,e,l),r&&r.m(e,null),i(e,n),i(e,o)},p(t,c){t[0]?r?r.p(t,c):(r=O(t),r.c(),r.m(e,n)):r&&(r.d(1),r=null),2&c&&o.src!==(l=t[1])&&g(o,"src",l),4&c&&g(e,"href",t[2])},d(t){t&&u(e),r&&r.d()}}}function O(t){let n,o,l;return{c(){n=d("img"),g(n,"class","close-icon"),n.src!==(o="https://minio.codingblocks.com/motley/wrong_g.png")&&g(n,"src","https://minio.codingblocks.com/motley/wrong_g.png"),g(n,"alt","close")},m(e,o){var r;s(e,n,o),l=p(n,"click",function(t){return function(e){return e.stopPropagation(),t.call(this,e)}}((r=t[4],function(t){return t.preventDefault(),r.call(this,t)})),!0)},p:e,d(t){t&&u(n),l()}}}function Y(t){let n,o=t[3]&&U(t);return{c(){o&&o.c(),n=h(""),this.c=e},m(t,e){o&&o.m(t,e),s(t,n,e)},p(t,[e]){t[3]?o?o.p(t,e):(o=U(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},i:e,o:e,d(t){o&&o.d(t),t&&u(n)}}}function q(t,e,n){let o="",l="",r=!0,{showToggle:c=!0}=e;x(async()=>{const t=await fetch("https://hack-api.codingblocks.com/api/v2/dashboard-banners"),{data:[e]}=await t.json(),r=e.attributes;n(1,o=r["image-url"]),n(2,l=r.link)});return t.$set=t=>{"showToggle"in t&&n(0,c=t.showToggle)},[c,o,l,r,()=>{n(3,r=!r)}]}"function"==typeof HTMLElement&&(S=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(l(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}});class G extends S{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>",R(this,{target:this.shadowRoot},q,Y,c,{showToggle:0}),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),B()))}static get observedAttributes(){return["showToggle"]}get showToggle(){return this.$$.ctx[0]}set showToggle(t){this.$set({showToggle:t}),B()}}customElements.define("promotion-banner",G);var z=new class{constructor(t){this.url=t}fetchUser(){return fetch(this.url+"/users/me?include=demographic",{credentials:"include"}).then(t=>t.json())}fetchColleges(){return fetch(this.url+"/colleges").then(t=>t.json())}fetchBranches(){return fetch(this.url+"/branches").then(t=>t.json())}updateUser(t){return fetch(this.url+"/users/me/edit",{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>t.json())}}("https://account.codingblocks.com/api");function D(t,e,n){const o=t.slice();return o[15]=e[n],o}function F(t,e,n){const o=t.slice();return o[18]=e[n],o}function J(t,e,n){const o=t.slice();return o[21]=e[n],o}function K(t){let e,n,o,r,c,h,m,v,b,y,$,w,x,k,C,E,T,j,N=t[4],A=[];for(let e=0;e<N.length;e+=1)A[e]=Q(J(t,N,e));let L=1===t[0]&&V(t),B=t[8],H=[];for(let e=0;e<B.length;e+=1)H[e]=W(F(t,B,e));let M=t[5],P=[];for(let e=0;e<M.length;e+=1)P[e]=X(D(t,M,e));let R=t[7].error&&Z(t);return{c(){e=d("div"),n=d("div"),n.innerHTML='<div class="font-md bold">\n Get INR 1000 Credits\n </div> \n <div class="mt-4">\n Complete your Profile &amp; get INR 1000 credits in your wallet\n </div>',o=f(),r=d("div"),c=d("select"),h=d("option"),h.textContent="-- College --";for(let t=0;t<A.length;t+=1)A[t].c();m=f(),L&&L.c(),v=f(),b=d("select"),y=d("option"),y.textContent="-- Graduation Year --";for(let t=0;t<H.length;t+=1)H[t].c();$=f(),w=d("select"),x=d("option"),x.textContent="-- Branch --";for(let t=0;t<P.length;t+=1)P[t].c();k=f(),C=d("div"),E=d("button"),E.textContent="Update Profile",T=f(),R&&R.c(),g(n,"class","bg-gradient-pink white p-4"),h.disabled=!0,h.selected=!0,h.__value="",h.value=h.__value,g(c,"class","input-text br-50 my-2"),void 0===t[0]&&I(()=>t[11].call(c)),y.disabled=!0,y.selected=!0,y.__value="",y.value=y.__value,g(b,"class","input-text br-50 my-2"),void 0===t[2]&&I(()=>t[13].call(b)),x.disabled=!0,x.selected=!0,x.__value="",x.value=x.__value,g(w,"class","input-text br-50 my-2"),void 0===t[1]&&I(()=>t[14].call(w)),g(E,"id","updatedButton"),g(E,"class","button-solid button-orange"),g(C,"class","d-flex justify-content-center mt-5"),g(r,"class","py-4 px-5 t-align-center"),g(e,"class","border-card b-red p-0")},m(l,u){s(l,e,u),i(e,n),i(e,o),i(e,r),i(r,c),i(c,h);for(let t=0;t<A.length;t+=1)A[t].m(c,null);_(c,t[0]),i(r,m),L&&L.m(r,null),i(r,v),i(r,b),i(b,y);for(let t=0;t<H.length;t+=1)H[t].m(b,null);_(b,t[2]),i(r,$),i(r,w),i(w,x);for(let t=0;t<P.length;t+=1)P[t].m(w,null);_(w,t[1]),i(r,k),i(r,C),i(C,E),i(r,T),R&&R.m(r,null),j=[p(c,"change",t[11]),p(b,"change",t[13]),p(w,"change",t[14]),p(E,"click",t[9])]},p(t,e){if(17&e){let n;for(N=t[4],n=0;n<N.length;n+=1){const o=J(t,N,n);A[n]?A[n].p(o,e):(A[n]=Q(o),A[n].c(),A[n].m(c,null))}for(;n<A.length;n+=1)A[n].d(1);A.length=N.length}if(1&e&&_(c,t[0]),1===t[0]?L?L.p(t,e):(L=V(t),L.c(),L.m(r,v)):L&&(L.d(1),L=null),260&e){let n;for(B=t[8],n=0;n<B.length;n+=1){const o=F(t,B,n);H[n]?H[n].p(o,e):(H[n]=W(o),H[n].c(),H[n].m(b,null))}for(;n<H.length;n+=1)H[n].d(1);H.length=B.length}if(4&e&&_(b,t[2]),34&e){let n;for(M=t[5],n=0;n<M.length;n+=1){const o=D(t,M,n);P[n]?P[n].p(o,e):(P[n]=X(o),P[n].c(),P[n].m(w,null))}for(;n<P.length;n+=1)P[n].d(1);P.length=M.length}2&e&&_(w,t[1]),t[7].error?R?R.p(t,e):(R=Z(t),R.c(),R.m(r,null)):R&&(R.d(1),R=null)},d(t){t&&u(e),a(A,t),L&&L.d(),a(H,t),a(P,t),R&&R.d(),l(j)}}}function Q(t){let e,n,o,l,r,c=t[21].name+"";return{c(){e=d("option"),n=h(c),o=f(),e.__value=l=t[21].id,e.value=e.__value,e.selected=r=t[21].id===t[0]},m(t,l){s(t,e,l),i(e,n),i(e,o)},p(t,o){16&o&&c!==(c=t[21].name+"")&&m(n,c),16&o&&l!==(l=t[21].id)&&(e.__value=l),e.value=e.__value,17&o&&r!==(r=t[21].id===t[0])&&(e.selected=r)},d(t){t&&u(e)}}}function V(t){let e,n;return{c(){e=d("input"),g(e,"type","text"),g(e,"placeholder","Other College Name"),g(e,"class","input-text br-50 my-2")},m(o,l){s(o,e,l),v(e,t[3]),n=p(e,"input",t[12])},p(t,n){8&n&&e.value!==t[3]&&v(e,t[3])},d(t){t&&u(e),n()}}}function W(t){let e,n,o,l,r,c=t[18]+"";return{c(){e=d("option"),n=h(c),o=f(),e.__value=l=t[18],e.value=e.__value,e.selected=r=t[18]===t[2]},m(t,l){s(t,e,l),i(e,n),i(e,o)},p(t,n){4&n&&r!==(r=t[18]===t[2])&&(e.selected=r)},d(t){t&&u(e)}}}function X(t){let e,n,o,l,r,c=t[15].name+"";return{c(){e=d("option"),n=h(c),o=f(),e.__value=l=t[15].id,e.value=e.__value,e.selected=r=t[15].id===t[1]},m(t,l){s(t,e,l),i(e,n),i(e,o)},p(t,o){32&o&&c!==(c=t[15].name+"")&&m(n,c),32&o&&l!==(l=t[15].id)&&(e.__value=l),e.value=e.__value,34&o&&r!==(r=t[15].id===t[1])&&(e.selected=r)},d(t){t&&u(e)}}}function Z(t){let e,n,o,l=t[7].error+"";return{c(){e=d("div"),n=d("p"),o=h(l),g(n,"class","red"),g(e,"class","row justify-content-center")},m(t,l){s(t,e,l),i(e,n),i(n,o)},p(t,e){128&e&&l!==(l=t[7].error+"")&&m(o,l)},d(t){t&&u(e)}}}function tt(t){let n,o,l=t[6].id&&K(t);return{c(){l&&l.c(),n=f(),o=d("link"),this.c=e,g(o,"rel","stylesheet"),g(o,"href","https://unpkg.com/@coding-blocks/motley@0.7.4/dist/online-cb/app.min.css")},m(t,e){l&&l.m(t,e),s(t,n,e),s(t,o,e)},p(t,[e]){t[6].id?l?l.p(t,e):(l=K(t),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},i:e,o:e,d(t){l&&l.d(t),t&&u(n),t&&u(o)}}}function et(t,e,n){let o=null,l=null,r=null,c="",i=[],s=[],u=[2025,2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2e3],a={},d={success:null,error:null};const h=k();x(async()=>{n(6,a=await z.fetchUser()),a.id&&(n(4,i=await z.fetchColleges()),n(5,s=await z.fetchBranches()),n(2,r=a.graduationYear),n(0,o=a.demographic.collegeId),n(1,l=a.demographic.branchId),n(3,c=a.demographic.otherCollege))});return[o,l,r,c,i,s,a,d,u,async()=>{try{const t=await z.updateUser({gradYear:r,collegeId:o,branchId:l,otherCollege:c});h("updated",t),t.success=t.success}catch(t){n(7,d.error=t,d)}},h,function(){o=b(this),n(0,o),n(4,i)},function(){c=this.value,n(3,c)},function(){r=b(this),n(2,r),n(8,u)},function(){l=b(this),n(1,l),n(5,s)}]}class nt extends S{constructor(t){super(),R(this,{target:this.shadowRoot},et,tt,c,{}),t&&t.target&&s(t.target,this,t.anchor)}}return customElements.define("demographic-form",nt),t.banner=G,t.demographic_form=nt,t}({});
{
"name": "@coding-blocks/web-components",
"svelte": "src/index.js",
"module": "dist/index.mjs",
"version": "0.0.5",
"srcDir": "src/",
"outDir": "dist/",
"version": "0.0.6",
"main": "dist/index.js",

@@ -7,0 +7,0 @@ "scripts": {

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

export { default as default } from './Component.svelte';
export { default as banner } from './banner'
export { default as demographic_form } from './demographicForm'
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