@stitches/core
Advanced tools
Comparing version 0.1.0-canary.0 to 0.1.0-canary.1
@@ -1,2 +0,2 @@ | ||
(()=>{var{from:t}=Array,n=Object,{assign:o,create:e}=Object,r=class extends Set{constructor(t){super().onChange=t}addCss(t){return!this.has(t)&&this.add(t).onChange&&String(t)&&this.onChange(this),this}toString(){return t(this).join("")}},i=class{constructor(t,n,o){this.value=t,this.token=n,this.scale=o}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+this.scale+"-"+this.token}toString(){return this.computedValue}},s=(t,n)=>t.reduce(((t,o)=>(t.push(...n.map((t=>/&/.test(t)?t.replace(/&/,o):t.replace(/^/,o+" ")))),t)),[]),l=t=>t!==n(t)||!(t.constructor===n||null==t.constructor),a=/^/.test.bind(/(Clamp|Column.*|Count|Duration|Flex.*|Group.*|Grow|Index|Opacity|Order|Outset|Row.*|Shrink|Slice|Span|Weight|columns|flex|lineHeight|opacity|order|orphans|tabSize|widows|zoom|(Image|stroke)Width)$/),d=Symbol(),c=/\s*,\s*(?![^()]*\))/,g=(t,n,o,e)=>r=>{let i="";const g=[];let h="";const u=({when:r,...f},p)=>{f=r?{...f,when:r}:f;for(let r in f){let m=f[r];if(r in t){let n=t[r](e)(m);if(n=l(n)?String(n):n,l(n))m=n;else{const t=JSON.stringify(n);h!==t&&(h=t,u(n,p),h="",m={})}}const S=64===r.charCodeAt(0);if(l(m)){for(const t of g)t[d]||(i+=t,i+="{",t[d]=!0);p.length&&!p[d]&&(i+=p.join(", "),i+="{",p[d]=!0),i+=(S?r:/^\$/.test(r)?"-"+r.replace(/\$/g,"-"):r.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())))+(S?" ":":")+("number"==typeof m&&!a(r)&&m?m+"px":String(m).replace(/\$[$-\w]+/g,(t=>"var(-"+(!/.\$/.test(t)&&r in n?"-"+n[r]:"")+t.replace(/\$/g,"-")+")")))+";"}else{const t=(t,n,o)=>{const e=t?g.push(Object(n)):g.length;if(p.length&&p[d]&&(i+="}",p[d]=!1),u(o,t?p:p.length?s(p,n.split(c)):n.split(c)),t&&e)for(const t of g.splice(e-1))i+="}",t[d]=!1};if("when"===r)for(const n in m)t(!0,n in o?o[n]:n,m[n]);else t(S,r,m)}}p.length&&p[d]&&(i+="}",p[d]=!1)};return u(r,[]),i},h="colors",u="sizes",f="space",p={gap:f,gridGap:f,columnGap:f,gridColumnGap:f,rowGap:f,gridRowGap:f,inset:f,insetBlock:f,insetBlockEnd:f,insetBlockStart:f,insetInline:f,insetInlineEnd:f,insetInlineStart:f,margin:f,marginTop:f,marginRight:f,marginBottom:f,marginLeft:f,marginBlock:f,marginBlockEnd:f,marginBlockStart:f,marginInline:f,marginInlineEnd:f,marginInlineStart:f,padding:f,paddingTop:f,paddingRight:f,paddingBottom:f,paddingLeft:f,paddingBlock:f,paddingBlockEnd:f,paddingBlockStart:f,paddingInline:f,paddingInlineEnd:f,paddingInlineStart:f,top:f,right:f,bottom:f,left:f,scrollMargin:f,scrollMarginTop:f,scrollMarginRight:f,scrollMarginBottom:f,scrollMarginLeft:f,scrollMarginX:f,scrollMarginY:f,scrollMarginBlock:f,scrollMarginBlockEnd:f,scrollMarginBlockStart:f,scrollMarginInline:f,scrollMarginInlineEnd:f,scrollMarginInlineStart:f,scrollPadding:f,scrollPaddingTop:f,scrollPaddingRight:f,scrollPaddingBottom:f,scrollPaddingLeft:f,scrollPaddingX:f,scrollPaddingY:f,scrollPaddingBlock:f,scrollPaddingBlockEnd:f,scrollPaddingBlockStart:f,scrollPaddingInline:f,scrollPaddingInlineEnd:f,scrollPaddingInlineStart:f,fontSize:"fontSizes",background:h,backgroundColor:h,backgroundImage:h,border:h,borderColor:h,borderTopColor:h,borderRightColor:h,borderBottomColor:h,borderLeftColor:h,caretColor:h,color:h,columnRuleColor:h,outlineColor:h,fill:h,stroke:h,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:u,minBlockSize:u,maxBlockSize:u,inlineSize:u,minInlineSize:u,maxInlineSize:u,width:u,minWidth:u,maxWidth:u,height:u,minHeight:u,maxHeight:u,flexBasis:u,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderLeftWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",zIndex:"zIndices",transition:"transitions"},m=t=>{const n={};for(const o in t)for(const e in t[o])n["$"+o+"-"+e]=String(t[o][e]).replace(/\$[$-\w]+/g,(t=>/[^]\$/.test(t)?t:"$"+o+t));return n},S=(t,n)=>{for(var o=JSON.stringify(n),e=o.length,r=9;e;)r=Math.imul(r^o.charCodeAt(--e),9**9);return t+(r^r>>>9).toString(36).slice(-5)},b=s=>{s=n(s);const l={conditions:o({initial:"@media all"},s.conditions),theme:n(s.theme),utils:n(s.utils)},a=s.prefix||"sx",d=s.classProp||"className",c=g(l.utils,n(s.themeMap||p),l.conditions,l),h=new r(s.onImport),u=new r(s.onGlobal),f=new r(s.onThemed),b=new r(s.onStyled),C=(t,r)=>{r=t===n(t)?t:n(r),t="string"==typeof t?t:"";const s=m(r),l=(t=t||S(a,s)).replace(/^\w/,".$&"),d=c({[l]:s}),g=o((()=>(f.addCss(d),g)),{toString:()=>g().className,className:t,selector:l});for(const t in r){g[t]=e(null);for(const n in r[t])g[t][n]=new i(r[t][n],n,t)}return g},k=(t,n="")=>{const e=[],r=[];for(const n in t){const o=c({[n]:t[n]});("@import"===n?e:r).push(o)}return o((()=>(e.forEach(h.addCss,h),r.forEach(u.addCss,u),n)),{displayName:n,toString(){return String(this())}})};o(C,C(":root",l.theme)());const w=()=>h+f+u+b;return{config:s,getCssString:w,global:k,keyframes:t=>{const n=S(a,t);return k({["@keyframes "+n]:t},n)},css:(i,s)=>{const{variants:g,compoundVariants:h,defaultVariants:u,...f}=n(s||i),p=n(s&&i),m=S(a,f),C="."+m,k=c({[C]:f}),w=b.onChange&&(()=>b.onChange(b)),B=new r(w),y=new r(w),I=new r(w),R=new r(w),x=o(e(null),p.variants);for(const t in g){x[t]=o(e(null),x[t]);for(const n in g[t]){const o=g[t][n],r=m+S("",o)+"--"+t+"-"+n,i=c({["."+r]:o}),s=e(null),l=x[t][n];x[t][n]=t=>{const n=(l?l(t):[]).concat(r);if(null!=t){if(!s[t]){const e=s[t]=r+"--"+S("",t),i=c({[t]:{["."+e]:o}});y.addCss(i),n.push(e)}}else y.addCss(i);return n}}}function M(){const t=(p.classNames?p.classNames():[]).concat(m);return B.addCss(k),t}return b.addCss(B).addCss(y).addCss(I).addCss(R),o((function(o){const{css:e,...r}=n(o);let i=new Set(M());for(const t in u)!(t in r)&&t in x&&(r[t]=u[t]);d in r&&(String(r[d]).split(/\s+/).forEach(i.add,i),delete r[d]);for(const t of[].concat(h||[])){const{css:o,...e}=n(t);let s=o;new Set;if(n.keys(e).every((t=>{if(t in r){const o=r[t],i=e[t];if(o==i)return!0;if(o===n(o)){for(const t in o){const n=o[t],e=l.conditions[t]||t;i==n&&(s={[e]:s})}return!0}}}))){const t=m+S("",s)+"--comp",n=c({["."+t]:s});I.addCss(n),i.add(t)}}for(const t in r)if(t in x){const n=r[t],o=x[t];if(delete r[t],n in o)o[n]().forEach(i.add,i);else for(const t in n){const e=n[t],r=l.conditions[t]||t;e in o&&o[e](r).forEach(i.add,i)}}if(e){const t=m+S("",e)+"--css",n=c({["."+t]:e});R.addCss(n),i.add(t)}return i=t(i),{toString(){return this.className},className:r[d]=i.join(" "),selector:"."+i.join("."),props:r}}),{toString(){return String(this())},className:m,classNames:M,cssText:k,selector:C,variants:x})},theme:C,reset(){return h.clear(),f.clear(),u.clear(),b.clear(),s.onResets&&s.onResets.call(this),C.toString(),this},toString:w}};globalThis.stitches=b;stitches.defaultThemeMap=p})() | ||
(()=>{var{from:t}=Array,n=Object,{assign:e,create:o,defineProperties:r,getOwnPropertyDescriptors:i}=Object,s=(t,n)=>r(t,i(n)),l=class extends Set{constructor(t){super().onChange=t}addCss(t){return!this.has(t)&&this.add(t).onChange&&String(t)&&this.onChange(this),this}toString(){return t(this).join("")}},a=class{constructor(t,n,e){this.value=t,this.token=n,this.scale=e}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+this.scale+"-"+this.token}toString(){return this.computedValue}},d=(t,n)=>t.reduce(((t,e)=>(t.push(...n.map((t=>/&/.test(t)?t.replace(/&/,e):t.replace(/^/,e+" ")))),t)),[]),c=t=>t!==n(t)||!(t.constructor===n||null==t.constructor),g=/^/.test.bind(/(Clamp|Column.*|Count|Duration|Flex.*|Group.*|Grow|Index|Opacity|Order|Outset|Row.*|Shrink|Slice|Span|Weight|columns|flex|lineHeight|opacity|order|orphans|tabSize|widows|zoom|(Image|stroke)Width)$/),h=Symbol(),p=/\s*,\s*(?![^()]*\))/,u=(t,n,e,o)=>r=>{let i="";const s=[];let l="";const a=({when:r,...u},f)=>{u=r?{...u,when:r}:u;for(let r in u){let m=u[r];if(r in t){let n=t[r](o)(m);if(n=c(n)?String(n):n,c(n))m=n;else{const t=JSON.stringify(n);l!==t&&(l=t,a(n,f),l="",m={})}}const S=64===r.charCodeAt(0);if(c(m)){for(const t of s)t[h]||(i+=t,i+="{",t[h]=!0);f.length&&!f[h]&&(i+=f.join(", "),i+="{",f[h]=!0),i+=(S?r:/^\$/.test(r)?"-"+r.replace(/\$/g,"-"):r.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())))+(S?" ":":")+("number"==typeof m&&!g(r)&&m?m+"px":String(m).replace(/\$[$-\w]+/g,(t=>"var(-"+(!/.\$/.test(t)&&r in n?"-"+n[r]:"")+t.replace(/\$/g,"-")+")")))+";"}else{const t=(t,n,e)=>{const o=t?s.push(Object(n)):s.length;if(f.length&&f[h]&&(i+="}",f[h]=!1),a(e,t?f:f.length?d(f,n.split(p)):n.split(p)),t&&o)for(const t of s.splice(o-1))i+="}",t[h]=!1};if("when"===r)for(const n in m)t(!0,n in e?e[n]:n,m[n]);else t(S,r,m)}}f.length&&f[h]&&(i+="}",f[h]=!1)};return a(r,[]),i},f="colors",m="sizes",S="space",b={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:f,backgroundColor:f,backgroundImage:f,border:f,borderColor:f,borderTopColor:f,borderRightColor:f,borderBottomColor:f,borderLeftColor:f,caretColor:f,color:f,columnRuleColor:f,outlineColor:f,fill:f,stroke:f,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:m,minBlockSize:m,maxBlockSize:m,inlineSize:m,minInlineSize:m,maxInlineSize:m,width:m,minWidth:m,maxWidth:m,height:m,minHeight:m,maxHeight:m,flexBasis:m,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderLeftWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",zIndex:"zIndices",transition:"transitions"},C=t=>{const n={};for(const e in t)for(const o in t[e])n["$"+e+"-"+o]=String(t[e][o]).replace(/\$[$-\w]+/g,(t=>/[^]\$/.test(t)?t:"$"+e+t));return n},w=(t,n)=>{for(var e=JSON.stringify(n),o=e.length,r=9;o;)r=Math.imul(r^e.charCodeAt(--o),9**9);return t+(r^r>>>9).toString(36).slice(-5)},k=r=>{r=n(r);const i={conditions:e({initial:"@media all"},r.conditions),theme:n(r.theme),utils:n(r.utils)},d=r.prefix||"sx",c=r.classProp||"className",g=u(i.utils,n(r.themeMap||b),i.conditions,i),h=new l(r.onImport),p=new l(r.onGlobal),f=new l(r.onThemed),m=new l(r.onStyled),S=(t,e)=>{e=t===n(t)?t:n(e),t="string"==typeof t?t:"";const r=C(e),i=(t=t||w(d,r)).replace(/^\w/,".$&"),l=g({[i]:r}),c=s((()=>(f.addCss(l),c)),{toString:()=>(c(),t),get className(){return c(),t},get selector(){return c(),i}});for(const t in e){c[t]=o(null);for(const n in e[t])c[t][n]=new a(e[t][n],n,t)}return c},k=(t,n="")=>{const o=[],r=[];for(const n in t){const e=g({[n]:t[n]});("@import"===n?o:r).push(e)}const i=()=>(o.forEach(h.addCss,h),r.forEach(p.addCss,p),n);return e(i,{displayName:n,toString:()=>String(i())})};e(S,S(":root",i.theme)).toString();const B=()=>h+f+p+m;return{config:r,getCssString:B,global:k,keyframes:t=>{const n=w(d,t);return k({["@keyframes "+n]:t},n)},css:(r,a)=>{const{variants:h,compoundVariants:p,defaultVariants:u,...f}=n(a||r),S=n(a&&r),b=w(d,f),C=g({["."+b]:f}),k=m.onChange&&(()=>m.onChange(m)),B=new l(k),y=new l(k),I=new l(k),R=new l(k),x=e(o(null),S.variants);for(const t in h){x[t]=e(o(null),x[t]);for(const n in h[t]){const e=h[t][n],r=b+w("",e)+"--"+t+"-"+n,i=g({["."+r]:e}),s=o(null),l=x[t][n];x[t][n]=t=>{const n=(l?l(t):[]).concat(r);if(null!=t){if(!s[t]){const o=s[t]=r+"--"+w("",t),i=g({[t]:{["."+o]:e}});y.addCss(i),n.push(o)}}else y.addCss(i);return n}}}function M(){const t=(S.classNames?S.classNames():[]).concat(b);return B.addCss(C),t}m.addCss(B).addCss(y).addCss(I).addCss(R);const P=function(e){const{css:o,...r}=n(e);let s=new Set(M());for(const t in u)!(t in r)&&t in x&&(r[t]=u[t]);c in r&&(String(r[c]).split(/\s+/).forEach(s.add,s),delete r[c]);for(const t of[].concat(p||[])){const{css:e,...o}=n(t);let l=e;new Set;if(n.keys(o).every((t=>{if(t in r){const e=r[t],s=o[t];if(e==s)return!0;if(e===n(e)){for(const t in e){const n=e[t],o=i.conditions[t]||t;s==n&&(l={[o]:l})}return!0}}}))){const t=b+w("",l)+"--comp",n=g({["."+t]:l});I.addCss(n),s.add(t)}}for(const t in r)if(t in x){const n=r[t],e=x[t];if(delete r[t],n in e)e[n]().forEach(s.add,s);else for(const t in n){const o=n[t],r=i.conditions[t]||t;o in e&&e[o](r).forEach(s.add,s)}}if(o){const t=b+w("",o)+"--css",n=g({["."+t]:o});R.addCss(n),s.add(t)}s=t(s);const l=r[c]=s.join(" ");return{toString:()=>l,className:l,selector:"."+s.join("."),props:r}};return s(P,{toString:()=>P().className,get className(){return P().className},get selector(){return P().selector},classNames:M,variants:x})},theme:S,reset(){return h.clear(),f.clear(),p.clear(),m.clear(),r.onResets&&r.onResets.call(this),S.toString(),this},toString:B}};globalThis.stitches=k;stitches.defaultThemeMap=b})() | ||
//# sourceMappingURL=stitches.core.map |
{ | ||
"name": "@stitches/core", | ||
"version": "0.1.0-canary.0", | ||
"version": "0.1.0-canary.1", | ||
"description": "The modern CSS-in-JS library", | ||
@@ -63,3 +63,3 @@ "type": "module", | ||
], | ||
"gitHead": "d2d04f083ceaa3eaabe690220799f407993b559c" | ||
"gitHead": "148ea49a8ae4573d0ed01df7102af7935629bf0e" | ||
} |
@@ -401,3 +401,3 @@ import { DeclarationListWithImportRule, Properties } from './css-types' | ||
} | ||
type MorphVariants<T> = T extends number ? `${T}` | T : T extends 'true' ? 'true' | true : T extends 'false' ? 'false' | false : T | ||
type MorphVariants<T> = T extends number ? `${T}` | T : T extends 'true' ? 'true' | boolean : T extends 'false' ? 'false' | boolean : T | ||
@@ -404,0 +404,0 @@ export type VariantsCall<Variants, Conditions> = { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
418326
8056