carbon-components-svelte/assets/SkeletonText.3cde24a8.js
2020-10-02 20:26:53 -07:00

1 line
2.9 KiB
JavaScript

import{S as t,i as e,s as n,D as s,q as i,Y as l,o as a,B as o,w as r,C as h,G as c,g as d,k as u,l as f,x as p,y as g,I as x,A as m,J as _,a3 as w,Z as $,a9 as k}from"./index.c2c9d961.js";function y(t,e,n){const s=t.slice();return s[2]=e[n].width,s[18]=n,s}function b(t){let e,n,s,l,o=[t[4],{style:n="width: "+t[2]+";"+t[4].style}],h={};for(let t=0;t<o.length;t+=1)h=r(h,o[t]);return{c(){e=d("p"),this.h()},l(t){e=u(t,"P",{style:!0}),f(e).forEach(a),this.h()},h(){p(e,h),g(e,"bx--skeleton__text",!0),g(e,"bx--skeleton__heading",t[0])},m(n,a){i(n,e,a),s||(l=[x(e,"click",t[10]),x(e,"mouseover",t[11]),x(e,"mouseenter",t[12]),x(e,"mouseleave",t[13])],s=!0)},p(t,s){p(e,h=m(o,[16&s&&t[4],20&s&&n!==(n="width: "+t[2]+";"+t[4].style)&&{style:n}])),g(e,"bx--skeleton__text",!0),g(e,"bx--skeleton__heading",t[0])},d(t){t&&a(e),s=!1,_(l)}}}function v(t){let e,n,s,l=[],o=new Map,h=t[3];const c=t=>t[2];for(let e=0;e<h.length;e+=1){let n=y(t,h,e),s=c(n);o.set(s,l[e]=E(s,n))}let g=[t[4]],w={};for(let t=0;t<g.length;t+=1)w=r(w,g[t]);return{c(){e=d("div");for(let t=0;t<l.length;t+=1)l[t].c();this.h()},l(t){e=u(t,"DIV",{});var n=f(e);for(let t=0;t<l.length;t+=1)l[t].l(n);n.forEach(a),this.h()},h(){p(e,w)},m(a,o){i(a,e,o);for(let t=0;t<l.length;t+=1)l[t].m(e,null);n||(s=[x(e,"click",t[6]),x(e,"mouseover",t[7]),x(e,"mouseenter",t[8]),x(e,"mouseleave",t[9])],n=!0)},p(t,n){if(9&n){const s=t[3];l=$(l,n,c,1,t,s,o,e,k,E,null,y)}p(e,w=m(g,[16&n&&t[4]]))},d(t){t&&a(e);for(let t=0;t<l.length;t+=1)l[t].d();n=!1,_(s)}}}function E(t,e){let n;return{key:t,first:null,c(){n=d("p"),this.h()},l(t){n=u(t,"P",{style:!0}),f(n).forEach(a),this.h()},h(){w(n,"width",e[2]),g(n,"bx--skeleton__text",!0),g(n,"bx--skeleton__heading",e[0]),this.first=n},m(t,e){i(t,n,e)},p(t,e){8&e&&w(n,"width",t[2]),1&e&&g(n,"bx--skeleton__heading",t[0])},d(t){t&&a(n)}}}function I(t){let e;function n(t,e){return t[1]?v:b}let o=n(t),r=o(t);return{c(){r.c(),e=s()},l(t){r.l(t),e=s()},m(t,n){r.m(t,n),i(t,e,n)},p(t,[s]){o===(o=n(t))&&r?r.p(t,s):(r.d(1),r=o(t),r&&(r.c(),r.m(e.parentNode,e)))},i:l,o:l,d(t){r.d(t),t&&a(e)}}}function D(t,e,n){const s=["lines","heading","paragraph","width"];let i=o(e,s),{lines:l=3}=e,{heading:a=!1}=e,{paragraph:d=!1}=e,{width:u="100%"}=e;const f=[.973,.153,.567];let p,g,x;return t.$$set=t=>{e=r(r({},e),h(t)),n(4,i=o(e,s)),"lines"in t&&n(5,l=t.lines),"heading"in t&&n(0,a=t.heading),"paragraph"in t&&n(1,d=t.paragraph),"width"in t&&n(2,u=t.width)},t.$$.update=()=>{if(4&t.$$.dirty&&n(14,g=parseInt(u,10)),4&t.$$.dirty&&n(15,x=u.includes("px")),49198&t.$$.dirty&&d)for(let t=0;t<l;t++){const e=x?g-75:0,s=x?g:75,i=Math.floor(f[t%3]*(s-e+1))+e+"px";n(3,p=[...p,{width:x?i:`calc(${u} - ${i})`}])}},n(3,p=[]),[a,d,u,p,i,l,function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)},function(e){c(t,e)}]}class M extends t{constructor(t){super(),e(this,t,D,I,n,{lines:5,heading:0,paragraph:1,width:2})}}export{M as S};