tw-clamp-css
Version:
TailwindCSS v4.0 compatible CSS clamp()
2 lines (1 loc) • 2.12 kB
JavaScript
var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var h=(e,r)=>{for(var o in r)c(e,o,{get:r[o],enumerable:!0})},x=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of g(r))!b.call(e,s)&&s!==o&&c(e,s,{get:()=>r[s],enumerable:!(t=f(r,s))||t.enumerable});return e};var w=e=>x(c({},"__esModule",{value:!0}),e);var M={};h(M,{withClamp:()=>S});module.exports=w(M);var d=(e,{cacheSize:r,prefix:o,experimentalParseClassName:t,extend:s={},override:n={}})=>(a(e,"cacheSize",r),a(e,"prefix",o),a(e,"experimentalParseClassName",t),i(e.theme,n.theme),i(e.classGroups,n.classGroups),i(e.conflictingClassGroups,n.conflictingClassGroups),i(e.conflictingClassGroupModifiers,n.conflictingClassGroupModifiers),a(e,"orderSensitiveModifiers",n.orderSensitiveModifiers),l(e.theme,s.theme),l(e.classGroups,s.classGroups),l(e.conflictingClassGroups,s.conflictingClassGroups),l(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),m(e,s,"orderSensitiveModifiers"),e),a=(e,r,o)=>{o!==void 0&&(e[r]=o)},i=(e,r)=>{if(r)for(let o in r)a(e,o,r[o])},l=(e,r)=>{if(r)for(let o in r)m(e,r,o)},m=(e,r,o)=>{let t=r[o];t!==void 0&&(e[o]=e[o]?e[o].concat(t):t)};var y=["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"],k=["0","1","2","3","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96","112","128","144","160","176","192","px","0.5","1.5","2.5","3.5"],p=["2xs","xs","sm","md","lg","xl","2xl"];function u(e){return r=>{let o=r.split("-");return o.length<3||!e.includes(o[0])||!e.includes(o[1])||o[2]!=="clamp"?!1:!!(o.length===3||o.length===5&&p.includes(o[3])&&p.includes(o[4]))}}var v=u(y),z=u(k),A=["p","px","py","pt","pr","pb","pl","m","mx","my","mt","mr","mb","ml","gap","gap-x","gap-y","space-x","space-y","w","h","min-w","min-h","max-w","max-h","inset","inset-x","inset-y","top","right","bottom","left"];function S(e){let r=A.reduce((o,t)=>(o[t]=[{[t]:[z]}],o),{});return d(e,{extend:{classGroups:{"font-size":[{text:[v]}],...r}}})}