and-component-library
Version:
Distribution of AND Web Components
3 lines (2 loc) • 8.97 kB
JavaScript
function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t){return 0===Object.keys(t).length}function c(t,e,n,o){if(t){const r=u(t,e,n,o);return t[0](r)}}function u(t,e,n,o){return t[1]&&o?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](o(e))):n.ctx}function d(t,e,n,o,r,s,i){const c=function(t,e,n,o){if(t[2]&&o){const r=t[2](o(n));if(void 0===e.dirty)return r;if("object"==typeof r){const t=[],n=Math.max(e.dirty.length,r.length);for(let o=0;o<n;o+=1)t[o]=e.dirty[o]|r[o];return t}return e.dirty|r}return e.dirty}(e,o,r,s);if(c){const r=u(e,n,o,i);t.p(r,c)}}function a(t,e){t.appendChild(e)}function l(t,e,n){t.insertBefore(e,n||null)}function f(t){t.parentNode.removeChild(t)}function p(t){return document.createElement(t)}function $(t){return document.createTextNode(t)}function h(){return $(" ")}function m(){return $("")}function g(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}let x;function y(t){x=t}function w(t){(function(){if(!x)throw new Error("Function called outside component initialization");return x})().$$.on_mount.push(t)}const k=[],_=[],v=[],E=[],M=Promise.resolve();let N=!1;function q(t){v.push(t)}let z=!1;const C=new Set;function L(){if(!z){z=!0;do{for(let t=0;t<k.length;t+=1){const e=k[t];y(e),T(e.$$)}for(y(null),k.length=0;_.length;)_.pop()();for(let t=0;t<v.length;t+=1){const e=v[t];C.has(e)||(C.add(e),e())}v.length=0}while(k.length);for(;E.length;)E.pop()();N=!1,z=!1,C.clear()}}function T(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(q)}}const A=new Set;let F,j;function H(){F={r:0,c:[],p:F}}function O(){F.r||o(F.c),F=F.p}function P(t,e){t&&t.i&&(A.delete(t),t.i(e))}function S(t,e,n,o){if(t&&t.o){if(A.has(t))return;A.add(t),F.c.push(()=>{A.delete(t),o&&(n&&t.d(1),o())}),t.o(e)}}function R(t){t&&t.c()}function B(t,n,s){const{fragment:i,on_mount:c,on_destroy:u,after_update:d}=t.$$;i&&i.m(n,s),q(()=>{const n=c.map(e).filter(r);u?u.push(...n):o(n),t.$$.on_mount=[]}),d.forEach(q)}function D(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function G(t,e){-1===t.$$.dirty[0]&&(k.push(t),N||(N=!0,M.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function I(e,r,s,i,c,u,d=[-1]){const a=x;y(e);const l=r.props||{},p=e.$$={fragment:null,ctx:null,props:u,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:[]),callbacks:n(),dirty:d,skip_bound:!1};let $=!1;if(p.ctx=s?s(e,l,(t,n,...o)=>{const r=o.length?o[0]:n;return p.ctx&&c(p.ctx[t],p.ctx[t]=r)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](r),$&&G(e,t)),n}):[],p.update(),$=!0,o(p.before_update),p.fragment=!!i&&i(p.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);p.fragment&&p.fragment.l(t),t.forEach(f)}else p.fragment&&p.fragment.c();r.intro&&P(e.$$.fragment),B(e,r.target,r.anchor),L()}y(a)}"function"==typeof HTMLElement&&(j=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(){D(this,1),this.$destroy=t}$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(t){this.$$set&&!i(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class J{$destroy(){D(this,1),this.$destroy=t}$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(t){this.$$set&&!i(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const K=t=>({matches:1&t}),Q=t=>({matches:t[0]});function U(t){let e;const n=t[3].default,o=c(n,t,t[2],Q);return{c(){o&&o.c()},m(t,n){o&&o.m(t,n),e=!0},p(t,[e]){o&&o.p&&5&e&&d(o,n,t,t[2],e,K,Q)},i(t){e||(P(o,t),e=!0)},o(t){S(o,t),e=!1},d(t){o&&o.d(t)}}}function V(t,e,n){let o,r,{$$slots:s={},$$scope:i}=e,{query:c}=e,u=!1,d=!1;function a(){o&&r&&o.removeListener(r)}return w(()=>(n(6,u=!0),()=>{a()})),t.$$set=t=>{"query"in t&&n(1,c=t.query),"$$scope"in t&&n(2,i=t.$$scope)},t.$$.update=()=>{66&t.$$.dirty&&u&&(a(),function(t){o=window.matchMedia(t),r=t=>n(0,d=t.matches),o.addListener(r),n(0,d=o.matches)}(c))},[d,c,i,s]}class W extends J{constructor(t){super(),I(this,t,V,U,s,{query:1})}}function X(t){let e;const n=t[1].default,o=c(n,t,t[2],null);return{c(){o&&o.c()},m(t,n){o&&o.m(t,n),e=!0},p(t,e){o&&o.p&&4&e&&d(o,n,t,t[2],e,null,null)},i(t){e||(P(o,t),e=!0)},o(t){S(o,t),e=!1},d(t){o&&o.d(t)}}}function Y(t){let e,n,o=t[3]&&X(t);return{c(){o&&o.c(),e=m()},m(t,r){o&&o.m(t,r),l(t,e,r),n=!0},p(t,n){t[3]?o?(o.p(t,n),8&n&&P(o,1)):(o=X(t),o.c(),P(o,1),o.m(e.parentNode,e)):o&&(H(),S(o,1,1,()=>{o=null}),O())},i(t){n||(P(o),n=!0)},o(t){S(o),n=!1},d(t){o&&o.d(t),t&&f(e)}}}function Z(t){let e,n;return e=new W({props:{query:t[0],$$slots:{default:[Y,({matches:t})=>({3:t}),({matches:t})=>t?8:0]},$$scope:{ctx:t}}}),{c(){R(e.$$.fragment)},m(t,o){B(e,t,o),n=!0},p(t,[n]){const o={};12&n&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(P(e.$$.fragment,t),n=!0)},o(t){S(e.$$.fragment,t),n=!1},d(t){D(e,t)}}}function tt(t,e,n){let{$$slots:o={},$$scope:r}=e;return t.$$set=t=>{"$$scope"in t&&n(2,r=t.$$scope)},["(min-width: 992px)",o,r]}class et extends J{constructor(t){super(),I(this,t,tt,Z,s,{})}}function nt(t){let e,n,o,r,s,i;return s=new et({props:{$$slots:{default:[ot]},$$scope:{ctx:t}}}),{c(){e=p("div"),n=p("button"),o=$(t[0]),r=h(),R(s.$$.fragment),g(n,"class","sub-dropbtn"),g(e,"id",t[2]),g(e,"class","sub-dropdown")},m(t,c){l(t,e,c),a(e,n),a(n,o),a(e,r),B(s,e,null),i=!0},p(t,n){(!i||1&n)&&b(o,t[0]);const r={};16&n&&(r.$$scope={dirty:n,ctx:t}),s.$set(r),(!i||4&n)&&g(e,"id",t[2])},i(t){i||(P(s.$$.fragment,t),i=!0)},o(t){S(s.$$.fragment,t),i=!1},d(t){t&&f(e),D(s)}}}function ot(t){let e;return{c(){e=p("div"),e.innerHTML="<slot><b>No Sub menu</b></slot>",g(e,"class","sub-dropdown-content")},m(t,n){l(t,e,n)},d(t){t&&f(e)}}}function rt(t){let e,n;return{c(){e=p("a"),n=$(t[0]),g(e,"id",t[2]),g(e,"class","sub-menu"),g(e,"target",t[3]),g(e,"href",t[1])},m(t,o){l(t,e,o),a(e,n)},p(t,o){1&o&&b(n,t[0]),4&o&&g(e,"id",t[2]),8&o&&g(e,"target",t[3]),2&o&&g(e,"href",t[1])},d(t){t&&f(e)}}}function st(e){let n,o,r,s=""==e[1]&&nt(e),i=""!=e[1]&&rt(e);return{c(){s&&s.c(),n=h(),i&&i.c(),o=m(),this.c=t},m(t,e){s&&s.m(t,e),l(t,n,e),i&&i.m(t,e),l(t,o,e),r=!0},p(t,[e]){""==t[1]?s?(s.p(t,e),2&e&&P(s,1)):(s=nt(t),s.c(),P(s,1),s.m(n.parentNode,n)):s&&(H(),S(s,1,1,()=>{s=null}),O()),""!=t[1]?i?i.p(t,e):(i=rt(t),i.c(),i.m(o.parentNode,o)):i&&(i.d(1),i=null)},i(t){r||(P(s),r=!0)},o(t){S(s),r=!1},d(t){s&&s.d(t),t&&f(n),i&&i.d(t),t&&f(o)}}}function it(t,e,n){let{text:o=""}=e,{href:r=""}=e,{id:s="and-submenu"}=e,{target:i=""}=e;return t.$$set=t=>{"text"in t&&n(0,o=t.text),"href"in t&&n(1,r=t.href),"id"in t&&n(2,s=t.id),"target"in t&&n(3,i=t.target)},[o,r,s,i]}class ct extends j{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.sub-menu{float:none;font-size:14px;font-size:torem(14px);color:black;padding:0.75rem 1rem 0 1rem;text-decoration:none;display:block;color:#323232;font-family:"Poppins", sans-serif;text-align:left}@media(min-width: 992px){.sub-menu{padding:0.875rem 1rem}}.sub-dropdown .sub-dropbtn{font-size:14px;font-size:torem(14px);border:none;outline:none;color:#323232;padding:0.875rem 1rem;background-color:inherit;font-family:"Poppins", sans-serif;margin:0;text-align:left}.sub-dropdown:hover .sub-dropbtn{font-weight:bold}.sub-dropdown-content{display:none;position:absolute;color:#323232;min-width:10rem;box-shadow:0rem 0.5rem 1rem 0rem rgba(0, 0, 0, 0.2);background-color:white;z-index:1;left:100%;top:0}@media(min-width: 992px){.sub-menu:hover{background-color:#2897FF;font-weight:bold}.sub-dropdown:hover,.sub-dropbtn:hover{background-color:#2897FF}}.sub-dropdown:hover .sub-dropdown-content{display:block}.sub-dropdown{position:relative}</style>',I(this,{target:this.shadowRoot},it,st,s,{text:0,href:1,id:2,target:3}),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),L()))}static get observedAttributes(){return["text","href","id","target"]}get text(){return this.$$.ctx[0]}set text(t){this.$set({text:t}),L()}get href(){return this.$$.ctx[1]}set href(t){this.$set({href:t}),L()}get id(){return this.$$.ctx[2]}set id(t){this.$set({id:t}),L()}get target(){return this.$$.ctx[3]}set target(t){this.$set({target:t}),L()}}customElements.define("and-sub-menu",ct);export default ct;
//# sourceMappingURL=SubMenu.js.map