UNPKG

@hakit/components

Version:
17 lines (16 loc) 1.13 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=[1,2,3,4,5,6,7,8,9,10,11,12],l=["xxs","xs","sm","md","lg"],d=[...l,"xlg"],g=n=>{const t=l.filter(e=>n[e]!==void 0).map(e=>[e,n[e]]),r={};for(let e=0;e<t.length;e++){const[o,s]=t[e];if(e>0){const a=t[e-1][1];if(s<=a)throw new Error(`Breakpoint "${o}" must be greater than "${t[e-1][0]}". Got ${s} <= ${a}.`);r[o]=`(min-width: ${a+1}px) and (max-width: ${s}px)`}else r[o]=`(max-width: ${s}px)`}const i=t.length===0?-1:t[t.length-1][1];return r.xlg=`(min-width: ${i+1}px)`,r},m=(n,t)=>n.map(r=>` .bp-${r} & { ${t} } `).join(` `),p=n=>`calc( (100% - 11 * var(--gap, 0px)) * ${n} / 12 + (${n} - 1) * var(--gap, 0px) )`,c=n=>Object.entries(n).reduce((t,[r,i])=>{if(i===void 0)return t;const e=u.map(o=>` .bp-${r} { .${r}-${o} { width: ${p(o)}; } } `);return t+e.join(` `)},"");exports.allBreakpoints=d;exports.generateColumnBreakpoints=c;exports.getBreakpoints=g;exports.getColumnSizeCSS=p;exports.mq=m;exports.orderedBreakpoints=l; //# sourceMappingURL=breakpoints.js.map