@stitches/react
Advanced tools
Comparing version 1.2.8 to 1.3.1-0
@@ -1,2 +0,2 @@ | ||
stitches=(()=>{var e,t="borderStyles",n="borderWidths",r="colors",i="radii",o="shadows",l="sizes",s="space",a={gap:s,gridGap:s,columnGap:s,gridColumnGap:s,rowGap:s,gridRowGap:s,inset:s,insetBlock:s,insetBlockEnd:s,insetBlockStart:s,insetInline:s,insetInlineEnd:s,insetInlineStart:s,margin:s,marginTop:s,marginRight:s,marginBottom:s,marginLeft:s,marginBlock:s,marginBlockEnd:s,marginBlockStart:s,marginInline:s,marginInlineEnd:s,marginInlineStart:s,padding:s,paddingTop:s,paddingRight:s,paddingBottom:s,paddingLeft:s,paddingBlock:s,paddingBlockEnd:s,paddingBlockStart:s,paddingInline:s,paddingInlineEnd:s,paddingInlineStart:s,top:s,right:s,bottom:s,left:s,scrollMargin:s,scrollMarginTop:s,scrollMarginRight:s,scrollMarginBottom:s,scrollMarginLeft:s,scrollMarginX:s,scrollMarginY:s,scrollMarginBlock:s,scrollMarginBlockEnd:s,scrollMarginBlockStart:s,scrollMarginInline:s,scrollMarginInlineEnd:s,scrollMarginInlineStart:s,scrollPadding:s,scrollPaddingTop:s,scrollPaddingRight:s,scrollPaddingBottom:s,scrollPaddingLeft:s,scrollPaddingX:s,scrollPaddingY:s,scrollPaddingBlock:s,scrollPaddingBlockEnd:s,scrollPaddingBlockStart:s,scrollPaddingInline:s,scrollPaddingInlineEnd:s,scrollPaddingInlineStart:s,fontSize:"fontSizes",background:r,backgroundColor:r,backgroundImage:r,borderImage:r,border:r,borderBlock:r,borderBlockEnd:r,borderBlockStart:r,borderBottom:r,borderBottomColor:r,borderColor:r,borderInline:r,borderInlineEnd:r,borderInlineStart:r,borderLeft:r,borderLeftColor:r,borderRight:r,borderRightColor:r,borderTop:r,borderTopColor:r,caretColor:r,color:r,columnRuleColor:r,fill:r,outline:r,outlineColor:r,stroke:r,textDecorationColor:r,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:l,minBlockSize:l,maxBlockSize:l,inlineSize:l,minInlineSize:l,maxInlineSize:l,width:l,minWidth:l,maxWidth:l,height:l,minHeight:l,maxHeight:l,flexBasis:l,gridTemplateColumns:l,gridTemplateRows:l,borderWidth:n,borderTopWidth:n,borderRightWidth:n,borderBottomWidth:n,borderLeftWidth:n,borderStyle:t,borderTopStyle:t,borderRightStyle:t,borderBottomStyle:t,borderLeftStyle:t,borderRadius:i,borderTopLeftRadius:i,borderTopRightRadius:i,borderBottomRightRadius:i,borderBottomLeftRadius:i,boxShadow:o,textShadow:o,transition:"transitions",zIndex:"zIndices"},c=(e,t)=>"function"==typeof t?{"()":Function.prototype.toString.call(t)}:t,d=()=>{const e=Object.create(null);return(t,n,...r)=>{const i=(e=>JSON.stringify(e,c))(t);return i in e?e[i]:e[i]=n(t,...r)}},g=Symbol.for("sxs.internal"),p=(e,t)=>Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),u=e=>{for(const t in e)return!0;return!1},{hasOwnProperty:h}=Object.prototype,f=e=>e.includes("-")?e:e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),m=/\s+(?![^()]*\))/,b=e=>t=>e(..."string"==typeof t?String(t).split(m):[t]),S={appearance:e=>({WebkitAppearance:e,appearance:e}),backfaceVisibility:e=>({WebkitBackfaceVisibility:e,backfaceVisibility:e}),backdropFilter:e=>({WebkitBackdropFilter:e,backdropFilter:e}),backgroundClip:e=>({WebkitBackgroundClip:e,backgroundClip:e}),boxDecorationBreak:e=>({WebkitBoxDecorationBreak:e,boxDecorationBreak:e}),clipPath:e=>({WebkitClipPath:e,clipPath:e}),content:e=>({content:e.includes('"')||e.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e)?e:`"${e}"`}),hyphens:e=>({WebkitHyphens:e,hyphens:e}),maskImage:e=>({WebkitMaskImage:e,maskImage:e}),maskSize:e=>({WebkitMaskSize:e,maskSize:e}),tabSize:e=>({MozTabSize:e,tabSize:e}),textSizeAdjust:e=>({WebkitTextSizeAdjust:e,textSizeAdjust:e}),userSelect:e=>({WebkitUserSelect:e,userSelect:e}),marginBlock:b(((e,t)=>({marginBlockStart:e,marginBlockEnd:t||e}))),marginInline:b(((e,t)=>({marginInlineStart:e,marginInlineEnd:t||e}))),maxSize:b(((e,t)=>({maxBlockSize:e,maxInlineSize:t||e}))),minSize:b(((e,t)=>({minBlockSize:e,minInlineSize:t||e}))),paddingBlock:b(((e,t)=>({paddingBlockStart:e,paddingBlockEnd:t||e}))),paddingInline:b(((e,t)=>({paddingInlineStart:e,paddingInlineEnd:t||e})))},k=/([\d.]+)([^]*)/,y=(e,t)=>e.length?e.reduce(((e,n)=>(e.push(...t.map((e=>e.includes("&")?e.replace(/&/g,/[ +>|~]/.test(n)&&/&.*&/.test(e)?`:is(${n})`:n):n+" "+e))),e)),[]):t,B=(e,t)=>e in $&&"string"==typeof t?t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((t,n,r,i)=>n+("stretch"===r?`-moz-available${i};${f(e)}:${n}-webkit-fill-available`:`-moz-fit-content${i};${f(e)}:${n}fit-content`)+i)):String(t),$={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},R=e=>e?e+"-":"",x=(e,t,n)=>e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((e,r,i,o,l)=>"$"==o==!!i?e:(r||"--"==o?"calc(":"")+"var(--"+("$"===o?R(t)+(l.includes("$")?"":R(n))+l.replace(/\$/g,"-"):l)+")"+(r||"--"==o?"*"+(r||"")+(i||"1")+")":""))),I=/\s*,\s*(?![^()]*\))/,z=Object.prototype.toString,j=(e,t,n,r,i)=>{let o,l,s;const a=(e,t,n)=>{let c,d;const g=e=>{for(c in e){const h=64===c.charCodeAt(0),m=h&&Array.isArray(e[c])?e[c]:[e[c]];for(d of m){const e=/[A-Z]/.test(u=c)?u:u.replace(/-[^]/g,(e=>e[1].toUpperCase())),m="object"==typeof d&&d&&d.toString===z&&(!r.utils[e]||!t.length);if(e in r.utils&&!m){const t=r.utils[e];if(t!==l){l=t,g(t(d)),l=null;continue}}else if(e in S){const t=S[e];if(t!==s){s=t,g(t(d)),s=null;continue}}if(h&&(p=c.slice(1)in r.media?"@media "+r.media[c.slice(1)]:c,c=p.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((e,t,n,r,i,o)=>{const l=k.test(t),s=.0625*(l?-1:1),[a,c]=l?[r,t]:[t,r];return"("+("="===n[0]?"":">"===n[0]===l?"max-":"min-")+a+":"+("="!==n[0]&&1===n.length?c.replace(k,((e,t,r)=>Number(t)+s*(">"===n?1:-1)+r)):c)+(i?") and ("+(">"===i[0]?"min-":"max-")+a+":"+(1===i.length?o.replace(k,((e,t,n)=>Number(t)+s*(">"===i?-1:1)+n)):o):"")+")"}))),m){const e=h?n.concat(c):[...n],r=h?[...t]:y(t,c.split(I));void 0!==o&&i(W(...o)),o=void 0,a(d,r,e)}else void 0===o&&(o=[[],t,n]),c=h||36!==c.charCodeAt(0)?c:`--${R(r.prefix)}${c.slice(1).replace(/\$/g,"-")}`,d=m?d:"number"==typeof d?d&&e in E?String(d)+"px":String(d):x(B(e,null==d?"":d),r.prefix,r.themeMap[e]),o[0].push(`${h?`${c} `:`${f(c)}:`}${d}`)}}var p,u};g(e),void 0!==o&&i(W(...o)),o=void 0};a(e,t,n)},W=(e,t,n)=>`${n.map((e=>`${e}{`)).join("")}${t.length?`${t.join(",")}{`:""}${e.join(";")}${t.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,E={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},T=e=>String.fromCharCode(e+(e>25?39:97)),M=e=>(e=>{let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=T(t%52)+n;return T(t%52)+n})(((e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e})(5381,JSON.stringify(e))>>>0),v=["themed","global","styled","onevar","resonevar","allvar","inline"],w=e=>{if(e.href&&!e.href.startsWith(location.origin))return!1;try{return!!e.cssRules}catch(e){return!1}},C=e=>{let t;const n=()=>{const{cssRules:e}=t.sheet;return[].map.call(e,((n,r)=>{const{cssText:i}=n;let o="";if(i.startsWith("--sxs"))return"";if(e[r-1]&&(o=e[r-1].cssText).startsWith("--sxs")){if(!n.cssRules.length)return"";for(const e in t.rules)if(t.rules[e].group===n)return`--sxs{--sxs:${[...t.rules[e].cache].join(" ")}}${i}`;return n.cssRules.length?`${o}${i}`:""}return i})).join("")},r=()=>{if(t){const{rules:e,sheet:n}=t;if(!n.deleteRule){for(;3===Object(Object(n.cssRules)[0]).type;)n.cssRules.splice(0,1);n.cssRules=[]}for(const t in e)delete e[t]}const i=Object(e).styleSheets||[];for(const e of i)if(w(e)){for(let i=0,o=e.cssRules;o[i];++i){const l=Object(o[i]);if(1!==l.type)continue;const s=Object(o[i+1]);if(4!==s.type)continue;++i;const{cssText:a}=l;if(!a.startsWith("--sxs"))continue;const c=a.slice(14,-3).trim().split(/\s+/),d=v[c[0]];d&&(t||(t={sheet:e,reset:r,rules:{},toString:n}),t.rules[d]={group:s,index:i,cache:new Set(c)})}if(t)break}if(!t){const i=(e,t)=>({type:t,cssRules:[],insertRule(e,t){this.cssRules.splice(t,0,i(e,{import:3,undefined:1}[(e.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return"@media{}"===e?`@media{${[].map.call(this.cssRules,(e=>e.cssText)).join("")}}`:e}});t={sheet:e?(e.head||e).appendChild(document.createElement("style")).sheet:i("","text/css"),rules:{},reset:r,toString:n}}const{sheet:o,rules:l}=t;for(let e=v.length-1;e>=0;--e){const t=v[e];if(!l[t]){const n=v[e+1],r=l[n]?l[n].index:o.cssRules.length;o.insertRule("@media{}",r),o.insertRule(`--sxs{--sxs:${e}}`,r),l[t]={group:o.cssRules[r+1],index:r,cache:new Set([e])}}P(l[t])}};return r(),t},P=e=>{const t=e.group;let n=t.cssRules.length;e.apply=e=>{try{t.insertRule(e,n),++n}catch(e){}}},L=Symbol(),O=d(),A=(e,t)=>O(e,(()=>(...n)=>{let r={type:null,composers:new Set};for(const t of n)if(null!=t)if(t[g]){null==r.type&&(r.type=t[g].type);for(const e of t[g].composers)r.composers.add(e)}else t.constructor!==Object||t.$$typeof?null==r.type&&(r.type=t):r.composers.add(N(t,e));return null==r.type&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),D(e,r,t)})),N=({variants:e,compoundVariants:t,defaultVariants:n,...r},i)=>{const o=`${R(i.prefix)}c-${M(r)}`,l=[],s=[],a=Object.create(null),c=[];for(const e in n)a[e]=String(n[e]);if("object"==typeof e&&e)for(const t in e){d=a,g=t,h.call(d,g)||(a[t]="undefined");const n=e[t];for(const e in n){const r={[t]:String(e)};"undefined"===String(e)&&c.push(t);const i=n[e],o=[r,i,!u(i)];l.push(o)}}var d,g;if("object"==typeof t&&t)for(const e of t){let{css:t,...n}=e;t="object"==typeof t&&t||{};for(const e in n)n[e]=String(n[e]);const r=[n,t,!u(t)];s.push(r)}return[o,r,l,s,a,c]},D=(e,t,n)=>{const[r,i,o,l]=H(t.composers),s="function"==typeof t.type||t.type.$$typeof?(e=>{function t(){for(let n=0;n<t[L].length;n++){const[r,i]=t[L][n];e.rules[r].apply(i)}return t[L]=[],null}return t[L]=[],t.rules={},v.forEach((e=>t.rules[e]={apply:n=>t[L].push([e,n])})),t})(n):null,a=(s||n).rules,c=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,d=d=>{d="object"==typeof d&&d||G;const{css:g,...p}=d,u={};for(const e in o)if(delete p[e],e in d){let t=d[e];"object"==typeof t&&t?u[e]={"@initial":o[e],...t}:(t=String(t),u[e]="undefined"!==t||l.has(e)?t:o[e])}else u[e]=o[e];const h=new Set([...i]);for(const[r,i,o,l]of t.composers){n.rules.styled.cache.has(r)||(n.rules.styled.cache.add(r),j(i,[`.${r}`],[],e,(e=>{a.styled.apply(e)})));const t=V(o,u,e.media),s=V(l,u,e.media,!0);for(const i of t)if(void 0!==i)for(const[t,o,l]of i){const i=`${r}-${M(o)}-${t}`;h.add(i);const s=(l?n.rules.resonevar:n.rules.onevar).cache,c=l?a.resonevar:a.onevar;s.has(i)||(s.add(i),j(o,[`.${i}`],[],e,(e=>{c.apply(e)})))}for(const t of s)if(void 0!==t)for(const[i,o]of t){const t=`${r}-${M(o)}-${i}`;h.add(t),n.rules.allvar.cache.has(t)||(n.rules.allvar.cache.add(t),j(o,[`.${t}`],[],e,(e=>{a.allvar.apply(e)})))}}if("object"==typeof g&&g){const t=`${r}-i${M(g)}-css`;h.add(t),n.rules.inline.cache.has(t)||(n.rules.inline.cache.add(t),j(g,[`.${t}`],[],e,(e=>{a.inline.apply(e)})))}for(const e of String(d.className||"").trim().split(/\s+/))e&&h.add(e);const f=p.className=[...h].join(" ");return{type:t.type,className:f,selector:c,props:p,toString:()=>f,deferredInjector:s}};return p(d,{className:r,selector:c,[g]:t,toString:()=>(n.rules.styled.cache.has(r)||d(),r)})},H=e=>{let t="";const n=[],r={},i=[];for(const[o,,,,l,s]of e){""===t&&(t=o),n.push(o),i.push(...s);for(const e in l){const t=l[e];(void 0===r[e]||"undefined"!==t||s.includes(t))&&(r[e]=t)}}return[t,n,r,new Set(i)]},V=(e,t,n,r)=>{const i=[];e:for(let[o,l,s]of e){if(s)continue;let e,a=0,c=!1;for(e in o){const r=o[e];let i=t[e];if(i!==r){if("object"!=typeof i||!i)continue e;{let e,t,o=0;for(const l in i){if(r===String(i[l])){if("@initial"!==l){const e=l.slice(1);(t=t||[]).push(e in n?n[e]:l.replace(/^@media ?/,"")),c=!0}a+=o,e=!0}++o}if(t&&t.length&&(l={["@media "+t.join(", ")]:l}),!e)continue e}}}(i[a]=i[a]||[]).push([r?"cv":`${e}-${o[e]}`,l,c])}return i},G={},F=d(),J=(e,t)=>F(e,(()=>(...n)=>{const r=()=>{for(let r of n){r="object"==typeof r&&r||{};let n=M(r);if(!t.rules.global.cache.has(n)){if(t.rules.global.cache.add(n),"@import"in r){let e=[].indexOf.call(t.sheet.cssRules,t.rules.themed.group)-1;for(let n of[].concat(r["@import"]))n=n.includes('"')||n.includes("'")?n:`"${n}"`,t.sheet.insertRule(`@import ${n};`,e++);delete r["@import"]}j(r,[],[],e,(e=>{t.rules.global.apply(e)}))}}return""};return p(r,{toString:r})})),U=d(),Z=(e,t)=>U(e,(()=>n=>{const r=`${R(e.prefix)}k-${M(n)}`,i=()=>{if(!t.rules.global.cache.has(r)){t.rules.global.cache.add(r);const i=[];j(n,[],[],e,(e=>i.push(e)));const o=`@keyframes ${r}{${i.join("")}}`;t.rules.global.apply(o)}return r};return p(i,{get name(){return i()},toString:i})})),X=class{constructor(e,t,n,r){this.token=null==e?"":String(e),this.value=null==t?"":String(t),this.scale=null==n?"":String(n),this.prefix=null==r?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+R(this.prefix)+R(this.scale)+this.token}toString(){return this.computedValue}},Y=d(),q=(e,t)=>Y(e,(()=>(n,r)=>{r="object"==typeof n&&n||Object(r);const i=`.${n=(n="string"==typeof n?n:"")||`${R(e.prefix)}t-${M(r)}`}`,o={},l=[];for(const t in r){o[t]={};for(const n in r[t]){const i=`--${R(e.prefix)}${t}-${n}`,s=x(String(r[t][n]),e.prefix,t);o[t][n]=new X(n,s,t,e.prefix),l.push(`${i}:${s}`)}}const s=()=>{if(l.length&&!t.rules.themed.cache.has(n)){t.rules.themed.cache.add(n);const i=`${r===e.theme?":root,":""}.${n}{${l.join(";")}}`;t.rules.themed.apply(i)}return n};return{...o,get className(){return s()},selector:i,toString:s}})),K=d(),Q=d(),_=e=>{const t=(e=>{let t=!1;const n=K(e,(e=>{t=!0;const n="prefix"in(e="object"==typeof e&&e||{})?String(e.prefix):"",r="object"==typeof e.media&&e.media||{},i="object"==typeof e.root?e.root||null:globalThis.document||null,o="object"==typeof e.theme&&e.theme||{},l={prefix:n,media:r,theme:o,themeMap:"object"==typeof e.themeMap&&e.themeMap||{...a},utils:"object"==typeof e.utils&&e.utils||{}},s=C(i),c={css:A(l,s),globalCss:J(l,s),keyframes:Z(l,s),createTheme:q(l,s),reset(){s.reset(),c.theme.toString()},theme:{},sheet:s,config:l,prefix:n,getCssText:s.toString,toString:s.toString};return String(c.theme=c.createTheme(o)),c}));return t||n.reset(),n})(e);return t.styled=(({config:e,sheet:t})=>Q(e,(()=>{const n=A(e,t);return(...e)=>{const t=n(...e),r=t[g].type,i=React.forwardRef(((e,n)=>{const i=e&&e.as||r,{props:o,deferredInjector:l}=t(e);return delete o.as,o.ref=n,l?React.createElement(React.Fragment,null,React.createElement(i,o),React.createElement(l,null)):React.createElement(i,o)}));return i.className=t.className,i.displayName=`Styled.${r.displayName||r.name||r}`,i.selector=t.selector,i.toString=()=>t.selector,i[g]=t[g],i}})))(t),t},ee=()=>e||(e=_());return{createStitches:_,createTheme:(...e)=>ee().createTheme(...e),css:(...e)=>ee().css(...e),defaultThemeMap:a,globalCss:(...e)=>ee().globalCss(...e),keyframes:(...e)=>ee().keyframes(...e),styled:(...e)=>ee().styled(...e)}})(); | ||
stitches=(()=>{var e,t="borderStyles",n="borderWidths",r="colors",o="radii",i="shadows",s="sizes",l="space",a={gap:l,gridGap:l,columnGap:l,gridColumnGap:l,rowGap:l,gridRowGap:l,inset:l,insetBlock:l,insetBlockEnd:l,insetBlockStart:l,insetInline:l,insetInlineEnd:l,insetInlineStart:l,margin:l,marginTop:l,marginRight:l,marginBottom:l,marginLeft:l,marginBlock:l,marginBlockEnd:l,marginBlockStart:l,marginInline:l,marginInlineEnd:l,marginInlineStart:l,padding:l,paddingTop:l,paddingRight:l,paddingBottom:l,paddingLeft:l,paddingBlock:l,paddingBlockEnd:l,paddingBlockStart:l,paddingInline:l,paddingInlineEnd:l,paddingInlineStart:l,top:l,right:l,bottom:l,left:l,scrollMargin:l,scrollMarginTop:l,scrollMarginRight:l,scrollMarginBottom:l,scrollMarginLeft:l,scrollMarginX:l,scrollMarginY:l,scrollMarginBlock:l,scrollMarginBlockEnd:l,scrollMarginBlockStart:l,scrollMarginInline:l,scrollMarginInlineEnd:l,scrollMarginInlineStart:l,scrollPadding:l,scrollPaddingTop:l,scrollPaddingRight:l,scrollPaddingBottom:l,scrollPaddingLeft:l,scrollPaddingX:l,scrollPaddingY:l,scrollPaddingBlock:l,scrollPaddingBlockEnd:l,scrollPaddingBlockStart:l,scrollPaddingInline:l,scrollPaddingInlineEnd:l,scrollPaddingInlineStart:l,fontSize:"fontSizes",background:r,backgroundColor:r,backgroundImage:r,borderImage:r,border:r,borderBlock:r,borderBlockEnd:r,borderBlockStart:r,borderBottom:r,borderBottomColor:r,borderColor:r,borderInline:r,borderInlineEnd:r,borderInlineStart:r,borderLeft:r,borderLeftColor:r,borderRight:r,borderRightColor:r,borderTop:r,borderTopColor:r,caretColor:r,color:r,columnRuleColor:r,fill:r,outline:r,outlineColor:r,stroke:r,textDecorationColor:r,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:s,minBlockSize:s,maxBlockSize:s,inlineSize:s,minInlineSize:s,maxInlineSize:s,width:s,minWidth:s,maxWidth:s,height:s,minHeight:s,maxHeight:s,flexBasis:s,gridTemplateColumns:s,gridTemplateRows:s,borderWidth:n,borderTopWidth:n,borderRightWidth:n,borderBottomWidth:n,borderLeftWidth:n,borderStyle:t,borderTopStyle:t,borderRightStyle:t,borderBottomStyle:t,borderLeftStyle:t,borderRadius:o,borderTopLeftRadius:o,borderTopRightRadius:o,borderBottomRightRadius:o,borderBottomLeftRadius:o,boxShadow:i,textShadow:i,transition:"transitions",zIndex:"zIndices"},c=(e,t)=>"function"==typeof t?{"()":Function.prototype.toString.call(t)}:t,d=()=>{const e=Object.create(null);return(t,n,...r)=>{const o=(e=>JSON.stringify(e,c))(t);return o in e?e[o]:e[o]=n(t,...r)}},p=Symbol.for("sxs.internal"),u=(e,t)=>Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),g=e=>{for(const t in e)return!0;return!1},{hasOwnProperty:f}=Object.prototype,h=e=>e.includes("-")?e:e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),m=/\s+(?![^()]*\))/,b=e=>t=>e(..."string"==typeof t?String(t).split(m):[t]),S={appearance:e=>({WebkitAppearance:e,appearance:e}),backfaceVisibility:e=>({WebkitBackfaceVisibility:e,backfaceVisibility:e}),backdropFilter:e=>({WebkitBackdropFilter:e,backdropFilter:e}),backgroundClip:e=>({WebkitBackgroundClip:e,backgroundClip:e}),boxDecorationBreak:e=>({WebkitBoxDecorationBreak:e,boxDecorationBreak:e}),clipPath:e=>({WebkitClipPath:e,clipPath:e}),content:e=>({content:e.includes('"')||e.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(e)?e:`"${e}"`}),hyphens:e=>({WebkitHyphens:e,hyphens:e}),maskImage:e=>({WebkitMaskImage:e,maskImage:e}),maskSize:e=>({WebkitMaskSize:e,maskSize:e}),textSizeAdjust:e=>({WebkitTextSizeAdjust:e,textSizeAdjust:e}),userSelect:e=>({WebkitUserSelect:e,userSelect:e}),marginBlock:b(((e,t)=>({marginBlockStart:e,marginBlockEnd:t||e}))),marginInline:b(((e,t)=>({marginInlineStart:e,marginInlineEnd:t||e}))),maxSize:b(((e,t)=>({maxBlockSize:e,maxInlineSize:t||e}))),minSize:b(((e,t)=>({minBlockSize:e,minInlineSize:t||e}))),paddingBlock:b(((e,t)=>({paddingBlockStart:e,paddingBlockEnd:t||e}))),paddingInline:b(((e,t)=>({paddingInlineStart:e,paddingInlineEnd:t||e})))},y=/([\d.]+)([^]*)/,k=(e,t)=>e.length?e.reduce(((e,n)=>(e.push(...t.map((e=>e.includes("&")?e.replace(/&/g,/[ +>|~]/.test(n)&&/&.*&/.test(e)?`:is(${n})`:n):n+" "+e))),e)),[]):t,$=(e,t)=>e in x&&"string"==typeof t?t.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((t,n,r,o)=>n+("stretch"===r?`-moz-available${o};${h(e)}:${n}-webkit-fill-available`:`-moz-fit-content${o};${h(e)}:${n}fit-content`)+o)):String(t),x={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},R=e=>e?e+"-":"",w=(e,t,n)=>e.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|(?<!url\(.*)--|--(?!.*\)))([$\w-]+)/g,((e,r,o,i,s)=>"$"==i==!!o?e:(r||"--"==i?"calc(":"")+"var(--"+("$"===i?R(t)+(s.includes("$")?"":R(n))+s.replace(/\$/g,"-"):s)+")"+(r||"--"==i?"*"+(r||"")+(o||"1")+")":""))),B=/\s*,\s*(?![^()]*\))/,j=Object.prototype.toString,I=(e,t,n,r,o)=>{let i,s,l;const a=(e,t,n)=>{let c,d;const p=e=>{for(c in e){const f=64===c.charCodeAt(0),m=f&&Array.isArray(e[c])?e[c]:[e[c]];for(d of m){const e=/[A-Z]/.test(g=c)?g:g.replace(/-[^]/g,(e=>e[1].toUpperCase())),m="object"==typeof d&&d&&d.toString===j&&(!r.utils[e]||!t.length);if(e in r.utils&&!m){const t=r.utils[e];if(t!==s){s=t,p(t(d)),s=null;continue}}else if(e in S){const t=S[e];if(t!==l){l=t,p(t(d)),l=null;continue}}if(f&&(u=c.slice(1)in r.media?"@media "+r.media[c.slice(1)]:c,c=u.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((e,t,n,r,o,i)=>{const s=y.test(t),l=.0625*(s?-1:1),[a,c]=s?[r,t]:[t,r];return"("+("="===n[0]?"":">"===n[0]===s?"max-":"min-")+a+":"+("="!==n[0]&&1===n.length?c.replace(y,((e,t,r)=>Number(t)+l*(">"===n?1:-1)+r)):c)+(o?") and ("+(">"===o[0]?"min-":"max-")+a+":"+(1===o.length?i.replace(y,((e,t,n)=>Number(t)+l*(">"===o?-1:1)+n)):i):"")+")"}))),m){const e=f?n.concat(c):[...n],r=f?[...t]:k(t,c.split(B));void 0!==i&&o(C(...i)),i=void 0,a(d,r,e)}else void 0===i&&(i=[[],t,n]),c=f||36!==c.charCodeAt(0)?c:`--${R(r.prefix)}${c.slice(1).replace(/\$/g,"-")}`,d=m?d:"number"==typeof d?d&&!(e in z)&&45!==c.charCodeAt(0)?String(d)+"px":String(d):w($(e,null==d?"":d),r.prefix,r.themeMap[e]),i[0].push(`${f?`${c} `:`${h(c)}:`}${d}`)}}var u,g};p(e),void 0!==i&&o(C(...i)),i=void 0};a(e,t,n)},C=(e,t,n)=>`${n.map((e=>`${e}{`)).join("")}${t.length?`${t.join(",")}{`:""}${e.join(";")}${t.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,z={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},v=e=>String.fromCharCode(e+(e>25?39:97)),W=e=>(e=>{let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=v(t%52)+n;return v(t%52)+n})(((e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e})(5381,JSON.stringify(e))>>>0),E=["themed","global","styled","onevar","resonevar","allvar","inline"],O=e=>{if(e.href&&!e.href.startsWith(location.origin))return!1;try{return!!e.cssRules}catch(e){return!1}},T=e=>{let t;const n=()=>{const{cssRules:e}=t.sheet;return[].map.call(e,((n,r)=>{const{cssText:o}=n;let i="";if(o.startsWith("--sxs"))return"";if(e[r-1]&&(i=e[r-1].cssText).startsWith("--sxs")){if(!n.cssRules.length)return"";for(const e in t.rules)if(t.rules[e].group===n)return`--sxs{--sxs:${[...t.rules[e].cache].join(" ")}}${o}`;return n.cssRules.length?`${i}${o}`:""}return o})).join("")},r=()=>{if(t){const{rules:e,sheet:n}=t;if(!n.deleteRule){for(;3===Object(Object(n.cssRules)[0]).type;)n.cssRules.splice(0,1);n.cssRules=[]}for(const t in e)delete e[t]}const o=Object(e).styleSheets||[];for(const e of o)if(O(e)){for(let o=0,i=e.cssRules;i[o];++o){const s=Object(i[o]);if(1!==s.type)continue;const l=Object(i[o+1]);if(4!==l.type)continue;++o;const{cssText:a}=s;if(!a.startsWith("--sxs"))continue;const c=a.slice(14,-3).trim().split(/\s+/),d=E[c[0]];d&&(t||(t={sheet:e,reset:r,rules:{},toString:n}),t.rules[d]={group:l,index:o,cache:new Set(c)})}if(t)break}if(!t){const o=(e,t)=>({type:t,cssRules:[],insertRule(e,t){this.cssRules.splice(t,0,o(e,{import:3,undefined:1}[(e.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return"@media{}"===e?`@media{${[].map.call(this.cssRules,(e=>e.cssText)).join("")}}`:e}});t={sheet:(()=>{if(!e)return o("","text/css");const t=document.createElement("style"),n=void 0!==window.__webpack_nonce__?window.__webpack_nonce__:void 0!==window.nonce?window.nonce:null;return n&&t.setAttribute("nonce",n),(e.head||e).appendChild(t).sheet})(),rules:{},reset:r,toString:n}}const{sheet:i,rules:s}=t;for(let e=E.length-1;e>=0;--e){const t=E[e];if(!s[t]){const n=E[e+1],r=s[n]?s[n].index:i.cssRules.length;i.insertRule("@media{}",r),i.insertRule(`--sxs{--sxs:${e}}`,r),s[t]={group:i.cssRules[r+1],index:r,cache:new Set([e])}}P(s[t])}};return r(),t},P=e=>{const t=e.group;let n=t.cssRules.length;e.apply=e=>{try{t.insertRule(e,n),++n}catch(e){}}},M=Symbol(),N=d(),A=(e,t)=>N(e,(()=>{const n=(n,r={})=>{let o={type:null,composers:new Set};for(const t of n)if(null!=t)if(t[p]){null==o.type&&(o.type=t[p].type);for(const e of t[p].composers)o.composers.add(e)}else t.constructor!==Object||t.$$typeof?null==o.type&&(o.type=t):o.composers.add(L(t,e,r));return null==o.type&&(o.type="span"),o.composers.size||o.composers.add(["PJLV",{},[],[],{},[]]),G(e,o,t,r)},r=(...e)=>n(e);return r.withConfig=e=>(...t)=>n(t,e),r})),L=({variants:e,compoundVariants:t,defaultVariants:n,...r},o,{componentId:i,displayName:s})=>{const l=i||W(r),a=s?"c-"+s:"c",c=`${R(o.prefix)}${a}-${l}`,d=[],p=[],u=Object.create(null),h=[];for(const e in n)u[e]=String(n[e]);if("object"==typeof e&&e)for(const t in e){m=u,b=t,f.call(m,b)||(u[t]="undefined");const n=e[t];for(const e in n){const r={[t]:String(e)};"undefined"===String(e)&&h.push(t);const o=n[e],i=[r,o,!g(o)];d.push(i)}}var m,b;if("object"==typeof t&&t)for(const e of t){let{css:t,...n}=e;t="object"==typeof t&&t||{};for(const e in n)n[e]=String(n[e]);const r=[n,t,!g(t)];p.push(r)}return[c,r,d,p,u,h]},G=(e,t,n,{shouldForwardStitchesProp:r})=>{const[o,i,s,l]=F(t.composers),a="function"==typeof t.type||t.type.$$typeof?(e=>{function t(){for(let n=0;n<t[M].length;n++){const[r,o]=t[M][n];e.rules[r].apply(o)}return t[M]=[],null}return t[M]=[],t.rules={},E.forEach((e=>t.rules[e]={apply:n=>t[M].push([e,n])})),t})(n):null,c=(a||n).rules,d=`.${o}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,g=p=>{p="object"==typeof p&&p||H;const{...u}=p,g={};for(const e in s)if(e in p){r?.(e)||delete u[e];let t=p[e];"object"==typeof t&&t?g[e]={"@initial":s[e],...t}:(t=String(t),g[e]="undefined"!==t||l.has(e)?t:s[e])}else g[e]=s[e];const f=new Set([...i]);for(const[r,o,i,s]of t.composers){n.rules.styled.cache.has(r)||(n.rules.styled.cache.add(r),I(o,[`.${r}`],[],e,(e=>{c.styled.apply(e)})));const t=_(i,g,e.media),l=_(s,g,e.media,!0);for(const o of t)if(void 0!==o)for(const[t,i,s]of o){const o=`${r}-${W(i)}-${t}`;f.add(o);const l=(s?n.rules.resonevar:n.rules.onevar).cache,a=s?c.resonevar:c.onevar;l.has(o)||(l.add(o),I(i,[`.${o}`],[],e,(e=>{a.apply(e)})))}for(const t of l)if(void 0!==t)for(const[o,i]of t){const t=`${r}-${W(i)}-${o}`;f.add(t),n.rules.allvar.cache.has(t)||(n.rules.allvar.cache.add(t),I(i,[`.${t}`],[],e,(e=>{c.allvar.apply(e)})))}}const h=u.css;if("object"==typeof h&&h){r?.("css")||delete u.css;const t=`${o}-i${W(h)}-css`;f.add(t),n.rules.inline.cache.has(t)||(n.rules.inline.cache.add(t),I(h,[`.${t}`],[],e,(e=>{c.inline.apply(e)})))}for(const e of String(p.className||"").trim().split(/\s+/))e&&f.add(e);const m=u.className=[...f].join(" ");return{type:t.type,className:m,selector:d,props:u,toString:()=>m,deferredInjector:a}};return u(g,{className:o,selector:d,[p]:t,toString:()=>(n.rules.styled.cache.has(o)||g(),o)})},F=e=>{let t="";const n=[],r={},o=[];for(const[i,,,,s,l]of e){""===t&&(t=i),n.push(i),o.push(...l);for(const e in s){const t=s[e];(void 0===r[e]||"undefined"!==t||l.includes(t))&&(r[e]=t)}}return[t,n,r,new Set(o)]},_=(e,t,n,r)=>{const o=[];e:for(let[i,s,l]of e){if(l)continue;let e,a=0,c=!1;for(e in i){const r=i[e];let o=t[e];if(o!==r){if("object"!=typeof o||!o)continue e;{let e,t,i=0;for(const s in o){if(r===String(o[s])){if("@initial"!==s){const e=s.slice(1);(t=t||[]).push(e in n?n[e]:s.replace(/^@media ?/,"")),c=!0}a+=i,e=!0}++i}if(t&&t.length&&(s={["@media "+t.join(", ")]:s}),!e)continue e}}}(o[a]=o[a]||[]).push([r?"cv":`${e}-${i[e]}`,s,c])}return o},H={},V=d(),D=(e,t)=>V(e,(()=>(...n)=>{const r=()=>{for(let r of n){r="object"==typeof r&&r||{};let n=W(r);if(!t.rules.global.cache.has(n)){if(t.rules.global.cache.add(n),"@import"in r){let e=[].indexOf.call(t.sheet.cssRules,t.rules.themed.group)-1;for(let n of[].concat(r["@import"]))n=n.includes('"')||n.includes("'")?n:`"${n}"`,t.sheet.insertRule(`@import ${n};`,e++);delete r["@import"]}I(r,[],[],e,(e=>{t.rules.global.apply(e)}))}}return""};return u(r,{toString:r})})),J=d(),Z=(e,t)=>J(e,(()=>n=>{const r=`${R(e.prefix)}k-${W(n)}`,o=()=>{if(!t.rules.global.cache.has(r)){t.rules.global.cache.add(r);const o=[];I(n,[],[],e,(e=>o.push(e)));const i=`@keyframes ${r}{${o.join("")}}`;t.rules.global.apply(i)}return r};return u(o,{get name(){return o()},toString:o})})),U=class{constructor(e,t,n,r){this.token=null==e?"":String(e),this.value=null==t?"":String(t),this.scale=null==n?"":String(n),this.prefix=null==r?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+R(this.prefix)+R(this.scale)+this.token}toString(){return this.computedValue}},X=d(),Y=(e,t)=>X(e,(()=>(n,r)=>{r="object"==typeof n&&n||Object(r);const o=`.${n=(n="string"==typeof n?n:"")||`${R(e.prefix)}t-${W(r)}`}`,i={},s=[];for(const t in r){i[t]={};for(const n in r[t]){const o=`--${R(e.prefix)}${t}-${n}`,l=w(String(r[t][n]),e.prefix,t);i[t][n]=new U(n,l,t,e.prefix),s.push(`${o}:${l}`)}}const l=()=>{if(s.length&&!t.rules.themed.cache.has(n)){t.rules.themed.cache.add(n);const o=`${r===e.theme?":root,":""}.${n}{${s.join(";")}}`;t.rules.themed.apply(o)}return n};return{...i,get className(){return l()},selector:o,toString:l}})),q=d(),K=d(),Q=e=>{const t=(e=>{let t=!1;const n=q(e,(e=>{t=!0;const n="prefix"in(e="object"==typeof e&&e||{})?String(e.prefix):"",r="object"==typeof e.media&&e.media||{},o="object"==typeof e.root?e.root||null:globalThis.document||null,i="object"==typeof e.theme&&e.theme||{},s={prefix:n,media:r,theme:i,themeMap:"object"==typeof e.themeMap&&e.themeMap||{...a},utils:"object"==typeof e.utils&&e.utils||{}},l=T(o),c={css:A(s,l),globalCss:D(s,l),keyframes:Z(s,l),createTheme:Y(s,l),reset(){l.reset(),c.theme.toString()},theme:{},sheet:l,config:s,prefix:n,getCssText:l.toString,toString:l.toString};return String(c.theme=c.createTheme(i)),c}));return t||n.reset(),n})(e);return t.styled=(({config:e,sheet:t})=>K(e,(()=>{const n=A(e,t),r=(e,t=n,{displayName:r,shouldForwardStitchesProp:o}={})=>{const i=t(...e),s=i[p].type,l=o?.("as"),a=React.forwardRef(((e,t)=>{const n=e?.as&&!l?e?.as:s,{props:r,deferredInjector:o}=i(e);return l||delete r.as,r.ref=t,o?React.createElement(React.Fragment,null,React.createElement(n,r),React.createElement(o,null)):React.createElement(n,r)}));return a.className=i.className,a.displayName=r||`Styled.${s.displayName||s.name||s}`,a.selector=i.selector,a.toString=()=>i.selector,a[p]=i[p],a},o=(...e)=>r(e);return o.withConfig=e=>(...t)=>{const o=n.withConfig(e);return r(t,o,e)},o})))(t),t},ee=()=>e||(e=Q());return{createStitches:Q,createTheme:(...e)=>ee().createTheme(...e),css:(...e)=>ee().css(...e),defaultThemeMap:a,globalCss:(...e)=>ee().globalCss(...e),keyframes:(...e)=>ee().keyframes(...e),styled:(...e)=>ee().styled(...e)}})(); | ||
//# sourceMappingUrl=index.map |
{ | ||
"name": "@stitches/react", | ||
"version": "1.2.8", | ||
"version": "1.3.1-0", | ||
"description": "The modern CSS-in-JS library", | ||
@@ -12,3 +12,3 @@ "type": "module", | ||
"*": [ | ||
"types/index.d.ts" | ||
"types/*" | ||
] | ||
@@ -36,9 +36,9 @@ } | ||
"license": "MIT", | ||
"repository": "modulz/stitches", | ||
"repository": "stitchesjs/stitches", | ||
"homepage": "https://stitches.dev/", | ||
"bugs": "https://github.com/modulz/stitches/issues", | ||
"bugs": "https://github.com/stitchesjs/stitches/issues", | ||
"contributors": [ | ||
"Pedro Duarte <pedro@modulz.app>", | ||
"Abdulhadi Alhallak <abdulhadi@modulz.app>", | ||
"Jonathan Neal <jonathan@modulz.app>" | ||
"Pedro Duarte", | ||
"Abdulhadi Alhallak <abdul@workos.com>", | ||
"Jonathan Neal" | ||
], | ||
@@ -45,0 +45,0 @@ "devDependencies": { |
@@ -52,14 +52,14 @@ # @stitches/react | ||
Please follow our [contributing guidelines](https://github.com/modulz/stitches/blob/canary/CONTRIBUTING.md). | ||
Please follow our [contributing guidelines](https://github.com/stitchesjs/stitches/blob/canary/CONTRIBUTING.md). | ||
## Authors | ||
- Pedro Duarte ([@peduarte](https://twitter.com/peduarte)) - [Modulz](https://modulz.app) | ||
- Jonathan Neal ([@jon_neal](https://twitter.com/jon_neal)) - [Modulz](https://modulz.app) | ||
- Abdulhadi Alhallak ([@hadi_hlk](https://twitter.com/hadi_hlk)) - [Modulz](https://modulz.app) | ||
- Pedro Duarte ([@peduarte](https://twitter.com/peduarte)) | ||
- Jonathan Neal ([@jon_neal](https://twitter.com/jon_neal)) | ||
- Abdulhadi Alhallak ([@hadi_hlk](https://twitter.com/hadi_hlk)) - [WorkOS](https://workos.com) | ||
## License | ||
Licensed under the MIT License, Copyright © 2021-present Modulz. | ||
Licensed under the MIT License, Copyright © 2022-present WorkOS. | ||
See [LICENSE](./LICENSE.md) for more information. |
@@ -1,3 +0,3 @@ | ||
import type * as CSSUtil from './css-util' | ||
import type Stitches from './stitches' | ||
import type * as CSSUtil from './css-util.js' | ||
import type Stitches from './stitches.js' | ||
@@ -4,0 +4,0 @@ /** Configuration Interface */ |
@@ -1,5 +0,5 @@ | ||
import type * as Native from './css' | ||
import type * as Config from './config' | ||
import type * as ThemeUtil from './theme' | ||
import type * as Util from './util' | ||
import type * as Native from './css.js' | ||
import type * as Config from './config.js' | ||
import type * as ThemeUtil from './theme.js' | ||
import type * as Util from './util.js' | ||
@@ -30,3 +30,3 @@ export { Native } | ||
& { | ||
[K in keyof CSSProperties]?: ( | ||
[K in keyof CSSProperties as K extends keyof Utils ? never : K]?: ( | ||
| ValueByPropertyName<K> | ||
@@ -42,3 +42,3 @@ | TokenByPropertyName<K, Theme, ThemeMap> | ||
& { | ||
[K in keyof Utils as K extends keyof CSSProperties ? never : K]?: Utils[K] extends (arg: infer P) => any | ||
[K in keyof Utils]?: Utils[K] extends (arg: infer P) => any | ||
? ( | ||
@@ -122,1 +122,9 @@ | ( | ||
export type $$ThemeValue = typeof $$ThemeValue | ||
// https://github.com/microsoft/TypeScript/issues/37888#issuecomment-846638356 | ||
export type WithPropertyValue<T> = { | ||
readonly [K in $$PropertyValue]: T | ||
} | ||
export type WithScaleValue<T> = { | ||
readonly [K in $$ScaleValue]: T; | ||
} |
@@ -1,11 +0,12 @@ | ||
import type Stitches from './stitches' | ||
import type Stitches from './stitches.js' | ||
import type * as Config from './config' | ||
import type * as CSSUtil from './css-util' | ||
import type * as StyledComponent from './styled-component' | ||
import type * as Config from './config.js' | ||
import type * as CSSUtil from './css-util.js' | ||
import type * as StyledComponent from './styled-component.js' | ||
export { $$PropertyValue, $$ScaleValue, $$ThemeValue } from './css-util' | ||
export { $$PropertyValue, $$ScaleValue, $$ThemeValue } from './css-util.js' | ||
export type CreateStitches = Config.CreateStitches | ||
export type CSSProperties = CSSUtil.CSSProperties | ||
export type DefaultThemeMap = Config.DefaultThemeMap | ||
export type FontFace = CSSUtil.Native.AtRule.FontFace | ||
@@ -38,3 +39,3 @@ /** Returns a Style interface from a configuration, leveraging the given media and style map. */ | ||
Config extends null | ||
? { readonly [K in CSSUtil.$$PropertyValue]: Property } | ||
? CSSUtil.WithPropertyValue<Property> | ||
: Config extends { [K: string]: any } | ||
@@ -53,3 +54,3 @@ ? CSSUtil.CSS< | ||
Config extends null | ||
? { readonly [K in CSSUtil.$$ScaleValue]: Scale } | ||
? CSSUtil.WithScaleValue<Scale> | ||
: Config extends { [K: string]: any } | ||
@@ -56,0 +57,0 @@ ? Scale extends keyof Config['theme'] |
@@ -1,4 +0,4 @@ | ||
import type * as CSSUtil from './css-util' | ||
import type * as StyledComponent from './styled-component' | ||
import type * as ThemeUtil from './theme' | ||
import type * as CSSUtil from './css-util.js' | ||
import type * as StyledComponent from './styled-component.js' | ||
import type * as ThemeUtil from './theme.js' | ||
import type * as Util from './util' | ||
@@ -9,2 +9,78 @@ | ||
export interface CssFunctionType<Media extends {} = {}, Theme extends {} = {}, ThemeMap extends {} = {}, Utils extends {} = {}> { | ||
<Composers extends (string | Util.Function | { | ||
[name: string]: unknown | ||
})[], CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils>>(...composers: { | ||
[K in keyof Composers]: ( | ||
// Strings and Functions can be skipped over | ||
string extends Composers[K] ? Composers[K] : Composers[K] extends string | Util.Function ? Composers[K] : RemoveIndex<CSS> & { | ||
/** The **variants** property lets you set a subclass of styles based on a key-value pair. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants) | ||
*/ | ||
variants?: { | ||
[Name in string]: { | ||
[Pair in number | string]: CSS | ||
} | ||
} | ||
/** The **compoundVariants** property lets you to set a subclass of styles based on a combination of active variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants) | ||
*/ | ||
compoundVariants?: (('variants' extends keyof Composers[K] ? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} : Util.WideObject) & { | ||
css: CSS | ||
})[] | ||
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#default-variants) | ||
*/ | ||
defaultVariants?: ('variants' extends keyof Composers[K] ? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} : Util.WideObject) | ||
} & CSS & { | ||
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants' ? unknown : K2 extends keyof CSS ? CSS[K2] : unknown | ||
}) | ||
}): StyledComponent.CssComponent<StyledComponent.StyledComponentType<Composers>, StyledComponent.StyledComponentProps<Composers>, Media, CSS> | ||
} | ||
export interface StyledFunctionType<Media extends {} = {}, Theme extends {} = {}, ThemeMap extends {} = {}, Utils extends {} = {}> { | ||
<Type extends keyof JSX.IntrinsicElements | React.ComponentType<any> | Util.Function, Composers extends (string | React.ComponentType<any> | Util.Function | { | ||
[name: string]: unknown | ||
})[], CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils>>(type: Type, ...composers: { | ||
[K in keyof Composers]: ( | ||
// Strings, React Components, and Functions can be skipped over | ||
string extends Composers[K] ? Composers[K] : Composers[K] extends string | React.ComponentType<any> | Util.Function ? Composers[K] : RemoveIndex<CSS> & { | ||
/** The **variants** property lets you set a subclass of styles based on a key-value pair. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants) | ||
*/ | ||
variants?: { | ||
[Name in string]: { | ||
[Pair in number | string]: CSS | ||
} | ||
} | ||
/** The **compoundVariants** property lets you to set a subclass of styles based on a combination of active variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants) | ||
*/ | ||
compoundVariants?: (('variants' extends keyof Composers[K] ? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} : Util.WideObject) & { | ||
css: CSS | ||
})[] | ||
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#default-variants) | ||
*/ | ||
defaultVariants?: ('variants' extends keyof Composers[K] ? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} : Util.WideObject) | ||
} & CSS & { | ||
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants' ? unknown : K2 extends keyof CSS ? CSS[K2] : unknown | ||
}) | ||
}): StyledComponent.StyledComponent<Type, StyledComponent.StyledComponentProps<Composers>, Media, CSSUtil.CSS<Media, Theme, ThemeMap, Utils>> | ||
} | ||
/** Stitches interface. */ | ||
@@ -135,145 +211,16 @@ export default interface Stitches< | ||
} | ||
css: { | ||
< | ||
Composers extends ( | ||
| string | ||
| React.ExoticComponent<any> | ||
| React.JSXElementConstructor<any> | ||
| Util.Function | ||
| { [name: string]: unknown } | ||
)[], | ||
CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils> | ||
>( | ||
...composers: { | ||
[K in keyof Composers]: ( | ||
// Strings, React Components, and Functions can be skipped over | ||
string extends Composers[K] | ||
? Composers[K] | ||
: Composers[K] extends string | React.ExoticComponent<any> | React.JSXElementConstructor<any> | Util.Function | ||
? Composers[K] | ||
: RemoveIndex<CSS> & { | ||
/** The **variants** property lets you set a subclass of styles based on a key-value pair. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants) | ||
*/ | ||
variants?: { | ||
[Name in string]: { | ||
[Pair in number | string]: CSS | ||
} | ||
} | ||
/** The **compoundVariants** property lets you to set a subclass of styles based on a combination of active variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants) | ||
*/ | ||
compoundVariants?: ( | ||
& ( | ||
'variants' extends keyof Composers[K] | ||
? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} | ||
: Util.WideObject | ||
) | ||
& { | ||
css: CSS | ||
} | ||
)[] | ||
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#default-variants) | ||
*/ | ||
defaultVariants?: ( | ||
'variants' extends keyof Composers[K] | ||
? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} | ||
: Util.WideObject | ||
) | ||
} & CSS & { | ||
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants' | ||
? unknown | ||
: K2 extends keyof CSS | ||
? CSS[K2] | ||
: unknown | ||
} | ||
) | ||
} | ||
): StyledComponent.CssComponent< | ||
StyledComponent.StyledComponentType<Composers>, | ||
StyledComponent.StyledComponentProps<Composers>, | ||
Media, | ||
CSS | ||
> | ||
} | ||
css: { | ||
withConfig: (config: { | ||
componentId?: string | ||
displayName?: string | ||
shouldForwardStitchesProp?: (prop: 'css' | (string & {})) => boolean | void | ||
}) => CssFunctionType<Media, Theme, ThemeMap, Utils> | ||
} & CssFunctionType<Media, Theme, ThemeMap, Utils> | ||
styled: { | ||
< | ||
Type extends keyof JSX.IntrinsicElements | React.ComponentType<any> | Util.Function, | ||
Composers extends ( | ||
| string | ||
| React.ComponentType<any> | ||
| Util.Function | ||
| { [name: string]: unknown } | ||
)[], | ||
CSS = CSSUtil.CSS<Media, Theme, ThemeMap, Utils> | ||
>( | ||
type: Type, | ||
...composers: { | ||
[K in keyof Composers]: ( | ||
// Strings, React Components, and Functions can be skipped over | ||
string extends Composers[K] | ||
? Composers[K] | ||
: Composers[K] extends string | React.ComponentType<any> | Util.Function | ||
? Composers[K] | ||
: RemoveIndex<CSS> & { | ||
/** The **variants** property lets you set a subclass of styles based on a key-value pair. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants) | ||
*/ | ||
variants?: { | ||
[Name in string]: { | ||
[Pair in number | string]: CSS | ||
} | ||
} | ||
/** The **compoundVariants** property lets you to set a subclass of styles based on a combination of active variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#compound-variants) | ||
*/ | ||
compoundVariants?: ( | ||
& ( | ||
'variants' extends keyof Composers[K] | ||
? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} | ||
: Util.WideObject | ||
) | ||
& { | ||
css: CSS | ||
} | ||
)[] | ||
/** The **defaultVariants** property allows you to predefine the active key-value pairs of variants. | ||
* | ||
* [Read Documentation](https://stitches.dev/docs/variants#default-variants) | ||
*/ | ||
defaultVariants?: ( | ||
'variants' extends keyof Composers[K] | ||
? { | ||
[Name in keyof Composers[K]['variants']]?: Util.Widen<keyof Composers[K]['variants'][Name]> | Util.String | ||
} | ||
: Util.WideObject | ||
) | ||
} & CSS & { | ||
[K2 in keyof Composers[K]]: K2 extends 'compoundVariants' | 'defaultVariants' | 'variants' | ||
? unknown | ||
: K2 extends keyof CSS | ||
? CSS[K2] | ||
: unknown | ||
} | ||
) | ||
} | ||
): StyledComponent.StyledComponent< | ||
Type, | ||
StyledComponent.StyledComponentProps<Composers>, | ||
Media, | ||
CSSUtil.CSS<Media, Theme, ThemeMap, Utils> | ||
> | ||
} | ||
withConfig: (config: { | ||
componentId?: string | ||
displayName?: string | ||
shouldForwardStitchesProp?: (prop: 'css' | (string & {})) => boolean | void | ||
}) => StyledFunctionType<Media, Theme, ThemeMap, Utils> | ||
} & StyledFunctionType<Media, Theme, ThemeMap, Utils> | ||
} | ||
@@ -280,0 +227,0 @@ |
import type * as React from 'react' | ||
import type * as Util from './util' | ||
import type * as Util from './util.js' | ||
@@ -15,3 +15,3 @@ | ||
Util.Assign< | ||
Type extends IntrinsicElementsKeys | React.ComponentType<any> | ||
Type extends IntrinsicElementsKeys | React.ComponentType<any> | ||
? React.ComponentPropsWithRef<Type> | ||
@@ -41,3 +41,3 @@ : never, | ||
React.ComponentPropsWithRef<As extends IntrinsicElementsKeys | React.ComponentType<any> ? As : never>, | ||
TransformProps<Util.Assign<InnerProps, Props>, Media> & { | ||
TransformProps<Util.Assign<InnerProps, Props>, Media> & { | ||
as?: As, | ||
@@ -44,0 +44,0 @@ css?: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
514827
10291
2