UNPKG

@htmlbricks/paginationbootstrap-component

Version:

Svelte Boostrap Pagination WebComponent

3 lines (2 loc) 15.7 kB
var paginationbootstrap=function(){"use strict";function t(){}function e(t){return t()}function o(){return Object.create(null)}function n(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,o){t.insertBefore(e,o||null)}function c(t){t.parentNode.removeChild(t)}function l(t){return document.createElement(t)}function d(t){return document.createTextNode(t)}function p(){return d(" ")}function u(t,e,o,n){return t.addEventListener(e,o,n),()=>t.removeEventListener(e,o,n)}function b(t,e,o){null==o?t.removeAttribute(e):t.getAttribute(e)!==o&&t.setAttribute(e,o)}function g(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function f(t,e,o,n){t.style.setProperty(e,o,n?"important":"")}function m(t){const e={};for(const o of t)e[o.name]=o.value;return e}let h;function k(t){h=t}function $(){if(!h)throw new Error("Function called outside component initialization");return h}function y(){const t=$();return(e,o)=>{const n=t.$$.callbacks[e];if(n){const r=function(t,e,o=!1){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,o,!1,e),n}(e,o);n.slice().forEach((e=>{e.call(t,r)}))}}}const w=[],x=[],v=[],E=[],_=Promise.resolve();let N=!1;function C(t){v.push(t)}const M=new Set;let S=0;function L(){const t=h;do{for(;S<w.length;){const t=w[S];S++,k(t),z(t.$$)}for(k(null),w.length=0,S=0;x.length;)x.pop()();for(let t=0;t<v.length;t+=1){const e=v[t];M.has(e)||(M.add(e),e())}v.length=0}while(w.length);for(;E.length;)E.pop()();N=!1,M.clear(),k(t)}function z(t){if(null!==t.fragment){t.update(),n(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const A=new Set;function T(t,e){-1===t.$$.dirty[0]&&(w.push(t),N||(N=!0,_.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(i,a,s,l,d,p,u,b=[-1]){const g=h;k(i);const f=i.$$={fragment:null,ctx:null,props:p,update:t,not_equal:d,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(g?g.$$.context:[])),callbacks:o(),dirty:b,skip_bound:!1,root:a.target||g.$$.root};u&&u(f.root);let m=!1;if(f.ctx=s?s(i,a.props||{},((t,e,...o)=>{const n=o.length?o[0]:e;return f.ctx&&d(f.ctx[t],f.ctx[t]=n)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](n),m&&T(i,t)),e})):[],f.update(),m=!0,n(f.before_update),f.fragment=!!l&&l(f.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);f.fragment&&f.fragment.l(t),t.forEach(c)}else f.fragment&&f.fragment.c();a.intro&&(($=i.$$.fragment)&&$.i&&(A.delete($),$.i(y))),function(t,o,i,a){const{fragment:s,on_mount:c,on_destroy:l,after_update:d}=t.$$;s&&s.m(o,i),a||C((()=>{const o=c.map(e).filter(r);l?l.push(...o):n(o),t.$$.on_mount=[]})),d.forEach(C)}(i,a.target,a.anchor,a.customElement),L()}var $,y;k(g)}let H;function R(t){let e,o,n,r,i,u,m,h,k,$,y,w,x,v,E=t[0]+1+"";function _(t,e){return t[0]>0?O:I}let N=_(t),C=N(t),M=t[1]>5&&t[0]>t[1]-3&&U(t),S=t[1]>5&&t[0]>t[1]-2&&F(t),L=t[0]-2>-1&&P(t),z=t[0]-1>-1&&q(t),A=t[0]+1<t[1]&&B(t),T=t[0]+2<t[1]&&D(t),j=t[0]<2&&t[0]+3<t[1]&&G(t),H=0===t[0]&&t[0]+4<t[1]&&J(t);function R(t,e){return t[0]<t[1]-1?Q:K}let V=R(t),W=V(t);return{c(){C.c(),e=p(),M&&M.c(),o=p(),S&&S.c(),n=p(),L&&L.c(),r=p(),z&&z.c(),i=p(),u=l("li"),m=l("button"),h=d(E),k=p(),A&&A.c(),$=p(),T&&T.c(),y=p(),j&&j.c(),w=p(),H&&H.c(),x=p(),W.c(),v=d(""),f(m,"color",t[2]),b(m,"class","page-link "),b(u,"class","page-item active")},m(t,c){C.m(t,c),s(t,e,c),M&&M.m(t,c),s(t,o,c),S&&S.m(t,c),s(t,n,c),L&&L.m(t,c),s(t,r,c),z&&z.m(t,c),s(t,i,c),s(t,u,c),a(u,m),a(m,h),s(t,k,c),A&&A.m(t,c),s(t,$,c),T&&T.m(t,c),s(t,y,c),j&&j.m(t,c),s(t,w,c),H&&H.m(t,c),s(t,x,c),W.m(t,c),s(t,v,c)},p(t,a){N===(N=_(t))&&C?C.p(t,a):(C.d(1),C=N(t),C&&(C.c(),C.m(e.parentNode,e))),t[1]>5&&t[0]>t[1]-3?M?M.p(t,a):(M=U(t),M.c(),M.m(o.parentNode,o)):M&&(M.d(1),M=null),t[1]>5&&t[0]>t[1]-2?S?S.p(t,a):(S=F(t),S.c(),S.m(n.parentNode,n)):S&&(S.d(1),S=null),t[0]-2>-1?L?L.p(t,a):(L=P(t),L.c(),L.m(r.parentNode,r)):L&&(L.d(1),L=null),t[0]-1>-1?z?z.p(t,a):(z=q(t),z.c(),z.m(i.parentNode,i)):z&&(z.d(1),z=null),1&a&&E!==(E=t[0]+1+"")&&g(h,E),4&a&&f(m,"color",t[2]),t[0]+1<t[1]?A?A.p(t,a):(A=B(t),A.c(),A.m($.parentNode,$)):A&&(A.d(1),A=null),t[0]+2<t[1]?T?T.p(t,a):(T=D(t),T.c(),T.m(y.parentNode,y)):T&&(T.d(1),T=null),t[0]<2&&t[0]+3<t[1]?j?j.p(t,a):(j=G(t),j.c(),j.m(w.parentNode,w)):j&&(j.d(1),j=null),0===t[0]&&t[0]+4<t[1]?H?H.p(t,a):(H=J(t),H.c(),H.m(x.parentNode,x)):H&&(H.d(1),H=null),V===(V=R(t))&&W?W.p(t,a):(W.d(1),W=V(t),W&&(W.c(),W.m(v.parentNode,v)))},d(t){C.d(t),t&&c(e),M&&M.d(t),t&&c(o),S&&S.d(t),t&&c(n),L&&L.d(t),t&&c(r),z&&z.d(t),t&&c(i),t&&c(u),t&&c(k),A&&A.d(t),t&&c($),T&&T.d(t),t&&c(y),j&&j.d(t),t&&c(w),H&&H.d(t),t&&c(x),W.d(t),t&&c(v)}}}function I(e){let o,n,r;return{c(){o=l("li"),o.innerHTML='<button class="page-link" disabled="">«</button>',n=p(),r=l("li"),r.innerHTML='<button class="page-link" disabled="">&lt;</button>',b(o,"class","page-item disabled"),b(r,"class","page-item disabled")},m(t,e){s(t,o,e),s(t,n,e),s(t,r,e)},p:t,d(t){t&&c(o),t&&c(n),t&&c(r)}}}function O(t){let e,o,r,i,g,m,h,k,$;return{c(){e=l("li"),o=l("button"),r=d("«"),i=p(),g=l("li"),m=l("button"),h=d("<"),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item"),f(m,"color",t[2]),b(m,"class","page-link"),b(g,"class","page-item")},m(n,c){s(n,e,c),a(e,o),a(o,r),s(n,i,c),s(n,g,c),a(g,m),a(m,h),k||($=[u(o,"click",t[5]),u(m,"click",t[6])],k=!0)},p(t,e){4&e&&f(o,"color",t[2]),4&e&&f(m,"color",t[2])},d(t){t&&c(e),t&&c(i),t&&c(g),k=!1,n($)}}}function U(t){let e,o,n,r,i,p=t[0]-4+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[7]),r=!0)},p(t,e){1&e&&p!==(p=t[0]-4+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function F(t){let e,o,n,r,i,p=t[0]-3+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[8]),r=!0)},p(t,e){1&e&&p!==(p=t[0]-3+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function P(t){let e,o,n,r,i,p=t[0]-2+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[9]),r=!0)},p(t,e){1&e&&p!==(p=t[0]-2+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function q(t){let e,o,n,r,i,p=t[0]-1+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[10]),r=!0)},p(t,e){1&e&&p!==(p=t[0]-1+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function B(t){let e,o,n,r,i,p=t[0]+1+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[11]),r=!0)},p(t,e){1&e&&p!==(p=t[0]+1+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function D(t){let e,o,n,r,i,p=t[0]+2+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[12]),r=!0)},p(t,e){1&e&&p!==(p=t[0]+2+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function G(t){let e,o,n,r,i,p=t[0]+3+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[13]),r=!0)},p(t,e){1&e&&p!==(p=t[0]+3+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function J(t){let e,o,n,r,i,p=t[0]+4+1+"";return{c(){e=l("li"),o=l("button"),n=d(p),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item")},m(c,l){s(c,e,l),a(e,o),a(o,n),r||(i=u(o,"click",t[14]),r=!0)},p(t,e){1&e&&p!==(p=t[0]+4+1+"")&&g(n,p),4&e&&f(o,"color",t[2])},d(t){t&&c(e),r=!1,i()}}}function K(t){let e,o,n,r,i,u,g;return{c(){e=l("li"),o=l("button"),n=d(">"),r=p(),i=l("li"),u=l("button"),g=d("»"),f(o,"color",t[2]),b(o,"class","page-link"),o.disabled=!0,b(e,"class","page-item disabled"),f(u,"color",t[2]),b(u,"class","page-link"),u.disabled=!0,b(i,"class","page-item disabled")},m(t,c){s(t,e,c),a(e,o),a(o,n),s(t,r,c),s(t,i,c),a(i,u),a(u,g)},p(t,e){4&e&&f(o,"color",t[2]),4&e&&f(u,"color",t[2])},d(t){t&&c(e),t&&c(r),t&&c(i)}}}function Q(t){let e,o,r,i,g,m,h,k,$;return{c(){e=l("li"),o=l("button"),r=d(">"),i=p(),g=l("li"),m=l("button"),h=d("»"),f(o,"color",t[2]),b(o,"class","page-link"),b(e,"class","page-item"),f(m,"color",t[2]),b(m,"class","page-link"),b(g,"class","page-item")},m(n,c){s(n,e,c),a(e,o),a(o,r),s(n,i,c),s(n,g,c),a(g,m),a(m,h),k||($=[u(o,"click",t[15]),u(m,"click",t[16])],k=!0)},p(t,e){4&e&&f(o,"color",t[2]),4&e&&f(m,"color",t[2])},d(t){t&&c(e),t&&c(i),t&&c(g),k=!1,n($)}}}function V(e){let o,n=e[1]>0&&R(e);return{c(){o=l("ul"),n&&n.c(),this.c=t,b(o,"class","pagination")},m(t,e){s(t,o,e),n&&n.m(o,null)},p(t,[e]){t[1]>0?n?n.p(t,e):(n=R(t),n.c(),n.m(o,null)):n&&(n.d(1),n=null)},i:t,o:t,d(t){t&&c(o),n&&n.d()}}}function W(t,e,o){let{page:n}=e,{primarycolor:r}=e,{pages:i}=e,{id:a}=e;a||(a=null),r||(r=null);const s=$(),c=y();function l(t){var e,o;c(e="pagechange",o={page:t,pages:i}),s.dispatchEvent&&s.dispatchEvent(new CustomEvent(e,{detail:o}))}return t.$$set=t=>{"page"in t&&o(0,n=t.page),"primarycolor"in t&&o(2,r=t.primarycolor),"pages"in t&&o(1,i=t.pages),"id"in t&&o(4,a=t.id)},t.$$.update=()=>{3&t.$$.dirty&&(o(0,n=n?parseInt(n):0),o(1,i=i?parseInt(i):1))},[n,i,r,l,a,()=>l(0),()=>l(n-1),()=>l(n-4),()=>l(n-3),()=>l(n-2),()=>l(n-1),()=>l(n+1),()=>l(n+2),()=>l(n+3),()=>l(n+4),()=>l(n+1),()=>l(i-1)]}"function"==typeof HTMLElement&&(H=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,o){this[t]=o}disconnectedCallback(){n(this.$$.on_disconnect)}$destroy(){!function(t,e){const o=t.$$;null!==o.fragment&&(n(o.on_destroy),o.fragment&&o.fragment.d(e),o.on_destroy=o.fragment=null,o.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(e),()=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});class X extends H{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#07689f;--bs-secondary:#c9d6df;--bs-success:#11d3bc;--bs-info:#a2d5f2;--bs-warning:#ff7e67;--bs-danger:#f67280;--bs-light:#fafafa;--bs-dark:#4e4e4e;--bs-primary-rgb:7, 104, 159;--bs-secondary-rgb:201, 214, 223;--bs-success-rgb:17, 211, 188;--bs-info-rgb:162, 213, 242;--bs-warning-rgb:255, 126, 103;--bs-danger-rgb:246, 114, 128;--bs-light-rgb:250, 250, 250;--bs-dark-rgb:78, 78, 78;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:33, 37, 41;--bs-body-bg-rgb:255, 255, 255;--bs-font-sans-serif:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-bg:#fff}*,*::before,*::after{box-sizing:border-box}@media(prefers-reduced-motion: no-preference){:host{scroll-behavior:smooth}}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}ul{padding-left:2rem}ul{margin-top:0;margin-bottom:1rem}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button{text-transform:none}button{-webkit-appearance:button}button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}@media(min-width: 1200px){}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}.pagination{display:flex;padding-left:0;list-style:none}.page-link{position:relative;display:block;color:#07689f;text-decoration:none;background-color:#fff;border:1px solid #dee2e6;transition:color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out}@media(prefers-reduced-motion: reduce){.page-link{transition:none}}.page-link:hover{z-index:2;color:#06537f;background-color:#e9ecef;border-color:#dee2e6}.page-link:focus{z-index:3;color:#06537f;background-color:#e9ecef;outline:0;box-shadow:0 0 0 0.25rem rgba(7, 104, 159, 0.25)}.page-item:not(:first-child) .page-link{margin-left:-1px}.page-item.active .page-link{z-index:3;color:#fff;background-color:#07689f;border-color:#07689f}.page-item.disabled .page-link{color:#6c757d;pointer-events:none;background-color:#fff;border-color:#dee2e6}.page-link{padding:0.375rem 0.75rem}.page-item:first-child .page-link{border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.page-item:last-child .page-link{border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:0.3rem;border-bottom-left-radius:0.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:0.3rem;border-bottom-right-radius:0.3rem}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:0.2rem;border-bottom-left-radius:0.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:0.2rem;border-bottom-right-radius:0.2rem}.pagination{font-family:"Roboto", sans-serif}</style>',j(this,{target:this.shadowRoot,props:m(this.attributes),customElement:!0},W,V,i,{page:0,primarycolor:2,pages:1,id:4},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),L()))}static get observedAttributes(){return["page","primarycolor","pages","id"]}get page(){return this.$$.ctx[0]}set page(t){this.$$set({page:t}),L()}get primarycolor(){return this.$$.ctx[2]}set primarycolor(t){this.$$set({primarycolor:t}),L()}get pages(){return this.$$.ctx[1]}set pages(t){this.$$set({pages:t}),L()}get id(){return this.$$.ctx[4]}set id(t){this.$$set({id:t}),L()}}return customElements.define("paginationbootstrap-component",X),X}(); //# sourceMappingURL=paginationbootstrap.js.map