New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nextcss/nextcss

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextcss/nextcss - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

2

dist/node.js
#!/usr/bin/env node
import e from"fs";import o from"path";import{globbySync as t}from"globby";import{exit as r}from"process";const n=e=>e.match(/#?([0-9a-f]{1,2})([0-9a-f]{1,2})([0-9a-f]{1,2})/i).slice(1).map((e=>parseInt(e.padStart(2,e),16))),s=e=>Math.min(255,Math.max(0,Math.round(e))),i=[-90,-80,-60,-40,-20,0,15,30,45,60],a=e=>{const o={black:"#000000",white:"#ffffff"};return Object.keys(e).forEach((t=>{i.forEach(((r,i)=>{const a=e[t];o[`${t}-${100*i||50}`]=((e,o)=>{const t=n(e);return(o/=100)<0?(o=Math.abs(o),t.forEach(((e,t,r)=>r[t]=s(e+(255-e)*o)))):t.forEach(((e,t,r)=>r[t]=s(e-e*o))),"#"+t.map((e=>e.toString(16).padStart(2,"0"))).join("")})(a,r)}))})),o},l={material:a({red:"#f44336",pink:"#e91e63",purple:"#9c27b0","deep-purple":"#673ab7",indigo:"#3f51b5",blue:"#2196f3","light-blue":"#03a9f4",cyan:"#00bcd4",teal:"#009688",green:"#4caf50","light-green":"#8bc34a",lime:"#cddc39",yellow:"#ffeb3b",amber:"#ffc107",orange:"#ff9800","deep-orange":"#ff5722",brown:"#795548","light-grey":"#9e9e9e",grey:"#575757","blue-grey":"#607d8b"}),tailwind:a({slate:"#64748b",grey:"#6b7280",zinc:"#71717a",neutral:"#737373",stone:"#78716c",red:"#ef4444",orange:"#f97316",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",sky:"#0ea5e9",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e"})},c={merged:!1,debug:!1,useStyleNode:!1,skipResetStyles:!1,skipRemUnits:!1,palette:"material",breakpoints:{sm:390,md:768,lg:1024,xl:1400},conatiners:{xs:480,sm:640,md:768,lg:1024,xl:1280}},$={...c},f=()=>({...$}),d=e=>{if(!$.merged&&"object"==typeof e){for(let o in e)o in c&&(typeof $[o]==typeof e[o]?$[o]=e[o]:console.warn(`Config conflict: [${o}] should be ${typeof $[o]} type!`));const o=$.palette,t=$.debug;"object"==typeof e?.colors&&(t&&console.log("Merge color palette...",{palette:o,colors:e.colors}),((e,o)=>{const t=a(o);Object.keys(t).forEach((o=>{l[e][o]=t[o]}))})(o,e.colors)),$.merged=!0,t&&console.log("Config merged",$)}return $},p=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}).compare,h=e=>({w:"width",h:"height",p:"padding",m:"margin",b:"border",r:"border-radius",fg:"color",bg:"background-color"}[e]||""),g=e=>({t:"-top",r:"-right",b:"-bottom",l:"-left"}[e]||""),u=[],b={reverseBreakpoint:!1},m=(e,o,t=b)=>{try{e=new RegExp(e)}catch(e){console.error(e)}e&&"function"==typeof o&&t&&"object"==typeof t?u.push({pattern:e,fn:o,options:{...b,...t}}):console.error("Declared register is not correct!",{pattern:e,fn:o,options:t})};let y=({pattern:e,fn:o,options:t},r)=>{const n=r.match(e);return!!n&&o(n)};const x=()=>{const e=w.sort(((e,o)=>e.proc-o.proc||p(e.className,o.className))).filter((e=>e.count)).map((e=>e.style)).join("").match(/(.*?{+.*?}+)/gm)||[];return(e=>{const o=[],t=[];e.forEach(((r,n)=>{/:hover\{/.test(r)&&(o.push(r),delete e[n]),/:active\{/.test(r)&&(t.push(r),delete e[n])})),o.concat(t).forEach((o=>e.push(o)))})(e),(e=>{let o={},t=[];e.forEach(((t,r)=>{const n=t.match(/(@media.*?){(.*?})}/);if(n){const[,t,s]=n;o[t]||=[],o[t].push(s),delete e[r]}})),Object.entries(o).forEach((([e,o])=>t.push(`${e}{${o.join("")}}`))),t.sort(p).forEach((o=>e.push(o))),o=t=[]})(e),e.join("")},w=[],v=(e,o)=>{e&&o&&("object"==typeof e&&(e="baseVal"in e?e.baseVal:""),e.split(" ").forEach((e=>{if(!e)return;const t=w.find((o=>o.className===e));if(t)"SAVE"===o&&t.count++,"CLEAN"===o&&t.count--;else if("SAVE"===o){const{style:o,proc:t}=(e=>{let o="",t=null;return u.forEach(((r,n)=>{const s=y(r,e);if(s)return o=s.replace(/\s+/gm," ").replace(/\s*({|}|:|;|>)\s*/gm,"$1").replace(/\(\s(.*?)\s\)/gm,"($1)").replace(";}","}").replace(/([:\s])(-?0[\w]+)/gm,"$10").trim(),void(t=n)})),{style:o,proc:t}})(e);o&&w.push({className:e,style:o,proc:t,count:1})}})))};const k=["hover","active","focus"],j=[...k,"every","odd","even","first","last","dark"];var S;"function"==typeof(S=({pattern:e,fn:o,options:{reverseBreakpoint:t}},r)=>{const n=r.split(":"),s=n.pop().match(e);if(!s)return!1;const i=Object.keys(f().breakpoints);let a=t?"max-width":"min-width",l=!1,c=!1,$="",d="";if(n.forEach((e=>{if(!j.includes(e)&&!i.includes(e))return(e=>{v(e,"CLEAN")})(r),c=!0,!1;var o;l||(o=e,l=f().breakpoints?.[o]||!1),k.includes(e)&&(d+=":"+e)})),c)return!1;if($=o(s,n),!$)return!1;if(n.length){const e=n.join("\\:");$=$.replace(/(.*?)\s*(\{.*?\})/gms,`.${e}\\:$1$2`).replace(/:\s*\./gms,":")}if(n.forEach((e=>{"every"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > * $2")),"odd"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :nth-child(odd) $2")),"even"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :nth-child(even) $2")),"first"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :first-child $2")),"last"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :last-child $2"))})),n.includes("dark")&&($=`.dark ${$}`),d&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,`$1${d}$2`)),n.includes("hover")){const e=$.replace(/:hover\{/g,":active{");$=`@media (hover: hover) and (pointer: fine) { ${$} }`+e}return l&&(t&&l--,$=`@media screen and (${a}: ${l}px) { ${$} }`),$})&&(y=S);const E=(e,o=!1)=>{const{palette:t}=f(),r=l[t][e]||"";if(o&&7===r.length){const[e,t,s]=n(r);return`rgba(${e} ${t} ${s} / ${o}%)`}return r};m(/^(block|flex|inline|inline-block|inline-flex)$/,(([e,o])=>`.${e} { display: ${o} }`)),m(/^(static|relative|absolute|fixed|sticky)$/,(([e,o])=>`.${e} { position: ${o} }`)),m(/^(-)?(top|right|bottom|left)-(\d+)$/,(([e,o,t,r])=>`.${e} { ${t}: ${o?-r:r}px }`)),m(/^(box)-(border|content)$/,(([e,o,t])=>`.${e} { box-sizing: ${t}-${o} }`)),m(/^(float|clear)-(left|right|both|none)$/,(([e,o,t])=>("float"!==o||"both"!==t)&&`.${e} { ${o}: ${t} }`)),m(/^show$/,(([e])=>`.${e} { display: none !important }`),{reverseBreakpoint:!0}),m(/^hide$/,(([e])=>`.${e} { display: none !important }`)),m(/^fit$/,(([e])=>`.${e} { width: 100%; height: 100% }`)),m(/^fit-([wh])$/,(([e,o])=>`.${e} { ${h(o)}: 100% }`)),m(/^fit-(contain|cover|fill|scale-down|none)$/,(([e,o])=>`.${e} { object-fit: ${o} }`)),m(/^object-(center|top|right|bottom|left)$/,(([e,o])=>`.${e} { object-position: ${o} }`)),m(/^text-(left|center|right|justify)$/,(([e,o])=>`.${e} { text-align: ${o} }`)),m(/^(uppercase|lowercase|capitalize|no-transform)$/,(([e,o])=>`.${e} { text-transform: ${"no-transform"===o?"none":o} }`)),m(/^(underline|line-through|no-decoration)$/,(([e,o])=>`.${e} { text-decoration: ${"no-decoration"===o?"none":o} }`)),m(/^fs-(\d+)$/,(([e,o])=>`.${e} { font-size: ${o}px }`)),m(/^fw-([1-9]00|bold|bolder|ligher|normal)$/,(([e,o])=>`.${e} { font-weight: ${o} }`)),m(/^lh-([\d.]+)$/,(([e,o])=>`.${e.replace(/\./,"\\.")} { line-height: ${o} }`)),m(/^(-)?z-(\d+)$/,(([e,o,t])=>`.${e} { z-index: ${o?-t:t} }`)),m(/^pointer-(none|auto|all)$/,(([e,o])=>`.${e} { pointer-events: ${o} }`)),m(/^cursor-(pointer|default|auto)$/,(([e,o])=>`.${e} { cursor: ${o} }`)),m(/^of(-[xy])?-(auto|hidden|scroll)$/,(([e,o,t])=>`.${e} { overflow${o||""}: ${t} }`)),m(/^of(-[xy])?-(overlay)$/,(([e,o,t])=>{const r=o||"";return`.${e} { overflow${r}: auto; overflow${r}: ${t} }`})),m(/^([wh])-(auto|\d+)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}: ${isNaN(t)?t:t+"px"} }`)),m(/^([wh])-(\d+)\/(\d+)$/,(([e,o,t,r])=>{const n=h(o);return!(parseInt(r)>parseInt(t))&&`.${e.replace(/\//,"\\/")} { ${n}: calc( 100%/(${t}/${r}) )}`})),m(/^(p[trbl]?|r)-(\d+)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}: ${t}px }`)),m(/^(-)?(m[trbl]?)-(auto|\d+)$/,(([e,o,t,r])=>{const n=h(t[0]),s=g(t[1]),i=isNaN(r)?r:(o?-r:r)+"px";return(!o||!isNaN(r))&&`.${e} { ${n}${s}: ${i} }`})),m(/^(b[trbl]?)-(\d+)$/,(([e,o,t])=>{const r=h(o[0]),n=g(o[1]);return`.${e} { ${r}${n}-width: ${t}px; ${r}${n}-style: solid }`})),m(/^(b[trbl]?)-(solid|dashed|dotted|double|groove|inset|none|outset|ridge)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}-style: ${t} }`)),m(/^b-(collapse|separate)$/,(([e,o])=>`.${e} { border-collapse: ${o} }`)),m(/^(-)?([pm][xy])-(auto|\d+)$/,(([e,o,t,r])=>{const n=h(t[0]),s=isNaN(r)?r:(o?-r:r)+"px",i="y"===t[1]?"top":"left",a="y"===t[1]?"bottom":"right";return!(o&&"auto"===r||"auto"===r&&"margin"!==n)&&`.${e} { ${n}-${i}: ${s}; ${n}-${a}: ${s} }`})),m(/^flex-(wrap|wrap-reverse|nowrap)$/,(([e,o])=>`.${e} { flex-wrap: ${o} }`)),m(/^flex-(row|row-reverse|column|column-reverse)$/,(([e,o])=>`.${e} { flex-direction: ${o} }`)),m(/^flex-(auto|[01])$/,(([e,o])=>`.${e} { flex: ${"auto"===o?"1 1 auto":"0"===o?"0 0 auto":"1 1 0%"} }`)),m(/^flex-(grow|shrink)-([01])$/,(([e,o,t])=>`.${e} { flex-${o}: ${t} }`)),m(/^justify-(start|end)$/,(([e,o])=>`.${e} { justify-content: flex-${o} }`)),m(/^justify-(around|between|evenly)$/,(([e,o])=>`.${e} { justify-content: space-${o} }`)),m(/^justify-center$/,(([e])=>`.${e} { justify-content: center }`)),m(/^align-(start|end)$/,(([e,o])=>`.${e} { align-items: flex-${o} }`)),m(/^align-(center|stretch)$/,(([e,o])=>`.${e} { align-items: ${o} }`)),m(/^(-)?order-(\d+)$/,(([e,o,t])=>`.${e} { order: ${o?-t:t} }`)),m(/^container-(\w+)$/,(([e,o])=>{const t=(r=o,f().conatiners?.[r]);var r;return!!t&&`.${e} { width: 100%; max-width: ${t}px; margin: auto }`})),m(/^gap-(\d+)$/,(([e,o])=>{const t=o/2;return`.${e} { margin: -${t}px } .${e} > * { padding: ${t}px }`})),m(/^(-)?s([xy])-(\d+)(-reverse)?$/,(([e,o,t,r,n])=>`.${e} > :not(:first-child) { margin-${"x"===t?n?"right":"left":n?"bottom":"top"}: ${o?-r:r}px }`)),m(/^text-trim(-all)?$/,(([e,o])=>`.${e}, .${e} ${o?"":">"} * { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden }`)),m(/^([fb]g)-(black|white|([\w-]+\d+))(\/(\d+))?$/,(([e,o,t,,,r])=>{const n=h(o),s=E(t,r);return!(!n||!s)&&`.${e.replace(/\//,"\\/")} { ${n}: ${s} }`})),m(/^b-(black|white|([\w-]+\d+))(\/(\d+))?$/,(([e,o,,,t])=>{const r=E(o,t);return!!r&&`.${e.replace(/\//,"\\/")} { border-color: ${r} }`}));let N=[],z=[];const C=/@layer\snextcss;/,M=o.resolve("nextcss.config.js"),A=e.existsSync(M),R={content:"src/**/*.{js,jsx,ts,tsx}",css:"build/**/*.css",verbose:!1};console.verbose=(...e)=>R.verbose&&console.log(...e);if(console.log("Nextcss","0.2.6"),A){const{default:e}=await import("file://"+M),o=["merged","debug","useStyleNode"];Object.keys(e).forEach((t=>{t in{...R,...f()}&&!o.includes(t)?R[t]=e[t]:console.log("[!] Skip unknown param: "+t)})),d(R),console.verbose("[ ] Read","nextcss.config.js"),console.verbose("[ ] Config merged",{...R,...f()})}else console.log("[!]","nextcss.config.js","not found. Continue with default config.");const F={...R,...f()},I=t(F.css);I.length?console.verbose("[ ] Scanning css files",I):(console.log("[!] No css files found with config:",F.css),r(1)),I.forEach((o=>{const t=e.readFileSync(o,"utf8");C.test(t)&&z.push(o)})),z.length||(console.log('[!] No css files found with "@layer nextcss;"'),r(1));const O=t(F.content);O.length?console.verbose("[ ] Scanning content files",O):(console.log("[!] No content files found with config:",F.content),r(1)),O.forEach((o=>{[...e.readFileSync(o,"utf8").matchAll(/['"`](.*?)['"`]/gm)].map((([,e])=>{(e=e.trim())&&N.push(e)}))})),N.forEach((e=>v(e,"SAVE")));const U=F.skipResetStyles?x():":root{line-height:1.4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji';-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;}*,:before,:after{box-sizing:border-box;outline:none;-webkit-user-drag:none;touch-action:pan-x pan-y;}body{margin:0;max-width:100vw;overscroll-behavior:none;}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;}h1,h2,h3,h4,h5,h6,p{margin:0;font:inherit;}small{font-size:85%;}a{color:inherit;text-decoration:none;}button{font:inherit;line-height:1;cursor:pointer;background-color:inherit;border:0;color:inherit;padding:0;}img,svg{display:block;max-width:100%;height:auto;border:none;}input,textarea,select{font:inherit;font-size:16px;border:0;border-radius:0;background-clip:padding-box;color:inherit;background-color:transparent;}textarea{resize:none;}::placeholder{font-size:14px;}label{display:block;}fieldset{border:1px solid;}ul,ol{margin:0;padding:0;list-style-type:none;}hr{border:none;border-bottom:1px solid;}table{border-spacing:0;border-collapse:collapse;}th{font-weight:inherit;}iframe{border:0;}menu{margin:0;padding:0;}form,figure,pre,blockquote,dl,dd{margin:0;}address{font:inherit;}"+x(),V=F.skipRemUnits?U:U.replace(/(\d*\.?\d+)px/g,((e,o)=>{return t=o,Math.round(parseFloat(t)/16*1e3)/1e3+"rem";var t}));V?(z.forEach((o=>{const t=e.readFileSync(o,"utf8");e.writeFileSync(o,t.replace(C,V))})),console.log("[ ] CSS files updated:",z)):console.log("[!] No CSS style has been generated.");
import e from"fs";import o from"path";import{globbySync as t}from"globby";import{exit as r}from"process";const n=e=>e.match(/#?([0-9a-f]{1,2})([0-9a-f]{1,2})([0-9a-f]{1,2})/i).slice(1).map((e=>parseInt(e.padStart(2,e),16))),s=e=>Math.min(255,Math.max(0,Math.round(e))),i=[-90,-80,-60,-40,-20,0,15,30,45,60],a=e=>{const o={black:"#000000",white:"#ffffff"};return Object.keys(e).forEach((t=>{i.forEach(((r,i)=>{const a=e[t];o[`${t}-${100*i||50}`]=((e,o)=>{const t=n(e);return(o/=100)<0?(o=Math.abs(o),t.forEach(((e,t,r)=>r[t]=s(e+(255-e)*o)))):t.forEach(((e,t,r)=>r[t]=s(e-e*o))),"#"+t.map((e=>e.toString(16).padStart(2,"0"))).join("")})(a,r)}))})),o},l={material:a({red:"#f44336",pink:"#e91e63",purple:"#9c27b0","deep-purple":"#673ab7",indigo:"#3f51b5",blue:"#2196f3","light-blue":"#03a9f4",cyan:"#00bcd4",teal:"#009688",green:"#4caf50","light-green":"#8bc34a",lime:"#cddc39",yellow:"#ffeb3b",amber:"#ffc107",orange:"#ff9800","deep-orange":"#ff5722",brown:"#795548","light-grey":"#9e9e9e",grey:"#575757","blue-grey":"#607d8b"}),tailwind:a({slate:"#64748b",grey:"#6b7280",zinc:"#71717a",neutral:"#737373",stone:"#78716c",red:"#ef4444",orange:"#f97316",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",sky:"#0ea5e9",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e"})},c={merged:!1,debug:!1,useStyleNode:!1,skipResetStyles:!1,skipRemUnits:!1,palette:"material",breakpoints:{sm:390,md:768,lg:1024,xl:1400},conatiners:{xs:480,sm:640,md:768,lg:1024,xl:1280}},$={...c},f=()=>({...$}),d=e=>{if(!$.merged&&"object"==typeof e){for(let o in e)o in c&&(typeof $[o]==typeof e[o]?$[o]=e[o]:console.warn(`Config conflict: [${o}] should be ${typeof $[o]} type!`));const o=$.palette,t=$.debug;"object"==typeof e?.colors&&(t&&console.log("Merge color palette...",{palette:o,colors:e.colors}),((e,o)=>{const t=a(o);Object.keys(t).forEach((o=>{l[e][o]=t[o]}))})(o,e.colors)),$.merged=!0,t&&console.log("Config merged",$)}return $},p=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}).compare,h=e=>({w:"width",h:"height",p:"padding",m:"margin",b:"border",r:"border-radius",fg:"color",bg:"background-color"}[e]||""),g=e=>({t:"-top",r:"-right",b:"-bottom",l:"-left"}[e]||""),u=[],b={reverseBreakpoint:!1},m=(e,o,t=b)=>{try{e=new RegExp(e)}catch(e){console.error(e)}e&&"function"==typeof o&&t&&"object"==typeof t?u.push({pattern:e,fn:o,options:{...b,...t}}):console.error("Declared register is not correct!",{pattern:e,fn:o,options:t})};let y=({pattern:e,fn:o,options:t},r)=>{const n=r.match(e);return!!n&&o(n)};const x=()=>{const e=w.sort(((e,o)=>e.proc-o.proc||p(e.className,o.className))).filter((e=>e.count)).map((e=>e.style)).join("").match(/(.*?{+.*?}+)/gm)||[];return(e=>{const o=[],t=[];e.forEach(((r,n)=>{/:hover\{/.test(r)&&(o.push(r),delete e[n]),/:active\{/.test(r)&&(t.push(r),delete e[n])})),o.concat(t).forEach((o=>e.push(o)))})(e),(e=>{let o={},t=[];e.forEach(((t,r)=>{const n=t.match(/(@media.*?){(.*?})}/);if(n){const[,t,s]=n;o[t]||=[],o[t].push(s),delete e[r]}})),Object.entries(o).forEach((([e,o])=>t.push(`${e}{${o.join("")}}`))),t.sort(p).forEach((o=>e.push(o))),o=t=[]})(e),e.join("")},w=[],v=(e,o)=>{e&&o&&("object"==typeof e&&(e="baseVal"in e?e.baseVal:""),e.split(" ").forEach((e=>{if(!e)return;const t=w.find((o=>o.className===e));if(t)"SAVE"===o&&t.count++,"CLEAN"===o&&t.count--;else if("SAVE"===o){const{style:o,proc:t}=(e=>{let o="",t=null;return u.forEach(((r,n)=>{const s=y(r,e);if(s)return o=s.replace(/\s+/gm," ").replace(/\s*({|}|:|;|>)\s*/gm,"$1").replace(/\(\s(.*?)\s\)/gm,"($1)").replace(";}","}").replace(/([:\s])(-?0[\w]+)/gm,"$10").trim(),void(t=n)})),{style:o,proc:t}})(e);o&&w.push({className:e,style:o,proc:t,count:1})}})))};const k=["hover","active","focus"],j=[...k,"every","odd","even","first","last","dark"];var S;"function"==typeof(S=({pattern:e,fn:o,options:{reverseBreakpoint:t}},r)=>{const n=r.split(":"),s=n.pop().match(e);if(!s)return!1;const i=Object.keys(f().breakpoints);let a=t?"max-width":"min-width",l=!1,c=!1,$="",d="";if(n.forEach((e=>{if(!j.includes(e)&&!i.includes(e))return(e=>{v(e,"CLEAN")})(r),c=!0,!1;var o;l||(o=e,l=f().breakpoints?.[o]||!1),k.includes(e)&&(d+=":"+e)})),c)return!1;if($=o(s,n),!$)return!1;if(n.length){const e=n.join("\\:");$=$.replace(/(.*?)\s*(\{.*?\})/gms,`.${e}\\:$1$2`).replace(/:\s*\./gms,":")}if(n.forEach((e=>{"every"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > * $2")),"odd"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :nth-child(odd) $2")),"even"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :nth-child(even) $2")),"first"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :first-child $2")),"last"===e&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,"$1 > :last-child $2"))})),n.includes("dark")&&($=`.dark ${$}`),d&&($=$.replace(/(.*?)\s*(\{.*?\})/gms,`$1${d}$2`)),n.includes("hover")){const e=$.replace(/:hover\{/g,":active{");$=`@media (hover: hover) and (pointer: fine) { ${$} }`+e}return l&&(t&&l--,$=`@media screen and (${a}: ${l}px) { ${$} }`),$})&&(y=S);const E=(e,o=!1)=>{const{palette:t}=f(),r=l[t][e]||"";if(o&&7===r.length){const[e,t,s]=n(r);return`rgba(${e} ${t} ${s} / ${o}%)`}return r};m(/^(block|flex|inline|inline-block|inline-flex)$/,(([e,o])=>`.${e} { display: ${o} }`)),m(/^(static|relative|absolute|fixed|sticky)$/,(([e,o])=>`.${e} { position: ${o} }`)),m(/^(-)?(top|right|bottom|left)-(\d+)$/,(([e,o,t,r])=>`.${e} { ${t}: ${o?-r:r}px }`)),m(/^(box)-(border|content)$/,(([e,o,t])=>`.${e} { box-sizing: ${t}-${o} }`)),m(/^(float|clear)-(left|right|both|none)$/,(([e,o,t])=>("float"!==o||"both"!==t)&&`.${e} { ${o}: ${t} }`)),m(/^show$/,(([e])=>`.${e} { display: none !important }`),{reverseBreakpoint:!0}),m(/^hide$/,(([e])=>`.${e} { display: none !important }`)),m(/^fit$/,(([e])=>`.${e} { width: 100%; height: 100% }`)),m(/^fit-([wh])$/,(([e,o])=>`.${e} { ${h(o)}: 100% }`)),m(/^fit-(contain|cover|fill|scale-down|none)$/,(([e,o])=>`.${e} { object-fit: ${o} }`)),m(/^object-(center|top|right|bottom|left)$/,(([e,o])=>`.${e} { object-position: ${o} }`)),m(/^text-(left|center|right|justify)$/,(([e,o])=>`.${e} { text-align: ${o} }`)),m(/^(uppercase|lowercase|capitalize|no-transform)$/,(([e,o])=>`.${e} { text-transform: ${"no-transform"===o?"none":o} }`)),m(/^(underline|line-through|no-decoration)$/,(([e,o])=>`.${e} { text-decoration: ${"no-decoration"===o?"none":o} }`)),m(/^fs-(\d+)$/,(([e,o])=>`.${e} { font-size: ${o}px }`)),m(/^fw-([1-9]00|bold|bolder|ligher|normal)$/,(([e,o])=>`.${e} { font-weight: ${o} }`)),m(/^lh-([\d.]+)$/,(([e,o])=>`.${e.replace(/\./,"\\.")} { line-height: ${o} }`)),m(/^(-)?z-(\d+)$/,(([e,o,t])=>`.${e} { z-index: ${o?-t:t} }`)),m(/^pointer-(none|auto|all)$/,(([e,o])=>`.${e} { pointer-events: ${o} }`)),m(/^cursor-(pointer|default|auto)$/,(([e,o])=>`.${e} { cursor: ${o} }`)),m(/^of(-[xy])?-(auto|hidden|scroll)$/,(([e,o,t])=>`.${e} { overflow${o||""}: ${t} }`)),m(/^of(-[xy])?-(overlay)$/,(([e,o,t])=>{const r=o||"";return`.${e} { overflow${r}: auto; overflow${r}: ${t} }`})),m(/^([wh])-(auto|\d+)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}: ${isNaN(t)?t:t+"px"} }`)),m(/^([wh])-(\d+)\/(\d+)$/,(([e,o,t,r])=>{const n=h(o);return!(parseInt(r)>parseInt(t))&&`.${e.replace(/\//,"\\/")} { ${n}: calc( 100%/(${t}/${r}) )}`})),m(/^(p[trbl]?|r)-(\d+)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}: ${t}px }`)),m(/^(-)?(m[trbl]?)-(auto|\d+)$/,(([e,o,t,r])=>{const n=h(t[0]),s=g(t[1]),i=isNaN(r)?r:(o?-r:r)+"px";return(!o||!isNaN(r))&&`.${e} { ${n}${s}: ${i} }`})),m(/^(b[trbl]?)-(\d+)$/,(([e,o,t])=>{const r=h(o[0]),n=g(o[1]);return`.${e} { ${r}${n}-width: ${t}px; ${r}${n}-style: solid }`})),m(/^(b[trbl]?)-(solid|dashed|dotted|double|groove|inset|none|outset|ridge)$/,(([e,o,t])=>`.${e} { ${h(o[0])}${g(o[1])}-style: ${t} }`)),m(/^b-(collapse|separate)$/,(([e,o])=>`.${e} { border-collapse: ${o} }`)),m(/^(-)?([pm][xy])-(auto|\d+)$/,(([e,o,t,r])=>{const n=h(t[0]),s=isNaN(r)?r:(o?-r:r)+"px",i="y"===t[1]?"top":"left",a="y"===t[1]?"bottom":"right";return!(o&&"auto"===r||"auto"===r&&"margin"!==n)&&`.${e} { ${n}-${i}: ${s}; ${n}-${a}: ${s} }`})),m(/^flex-(wrap|wrap-reverse|nowrap)$/,(([e,o])=>`.${e} { flex-wrap: ${o} }`)),m(/^flex-(row|row-reverse|column|column-reverse)$/,(([e,o])=>`.${e} { flex-direction: ${o} }`)),m(/^flex-(auto|[01])$/,(([e,o])=>`.${e} { flex: ${"auto"===o?"1 1 auto":"0"===o?"0 0 auto":"1 1 0%"} }`)),m(/^flex-(grow|shrink)-([01])$/,(([e,o,t])=>`.${e} { flex-${o}: ${t} }`)),m(/^justify-(start|end)$/,(([e,o])=>`.${e} { justify-content: flex-${o} }`)),m(/^justify-(around|between|evenly)$/,(([e,o])=>`.${e} { justify-content: space-${o} }`)),m(/^justify-center$/,(([e])=>`.${e} { justify-content: center }`)),m(/^align-(start|end)$/,(([e,o])=>`.${e} { align-items: flex-${o} }`)),m(/^align-(center|stretch)$/,(([e,o])=>`.${e} { align-items: ${o} }`)),m(/^(-)?order-(\d+)$/,(([e,o,t])=>`.${e} { order: ${o?-t:t} }`)),m(/^container-(\w+)$/,(([e,o])=>{const t=(r=o,f().conatiners?.[r]);var r;return!!t&&`.${e} { width: 100%; max-width: ${t}px; margin: auto }`})),m(/^gap-(\d+)$/,(([e,o])=>{const t=o/2;return`.${e} { margin: -${t}px } .${e} > * { padding: ${t}px }`})),m(/^(-)?s([xy])-(\d+)(-reverse)?$/,(([e,o,t,r,n])=>`.${e} > :not(:first-child) { margin-${"x"===t?n?"right":"left":n?"bottom":"top"}: ${o?-r:r}px }`)),m(/^text-trim(-all)?$/,(([e,o])=>`.${e}, .${e} ${o?"":">"} * { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden }`)),m(/^([fb]g)-(black|white|([\w-]+\d+))(\/(\d+))?$/,(([e,o,t,,,r])=>{const n=h(o),s=E(t,r);return!(!n||!s)&&`.${e.replace(/\//,"\\/")} { ${n}: ${s} }`})),m(/^b-(black|white|([\w-]+\d+))(\/(\d+))?$/,(([e,o,,,t])=>{const r=E(o,t);return!!r&&`.${e.replace(/\//,"\\/")} { border-color: ${r} }`}));let N=[],z=[];const C=/@layer\snextcss;/,M=o.resolve("nextcss.config.js"),A=e.existsSync(M),R={content:"src/**/*.{js,jsx,ts,tsx}",css:"build/**/*.css",colors:{},verbose:!1};console.verbose=(...e)=>R.verbose&&console.log(...e);if(console.log("Nextcss","0.2.7"),A){const{default:e}=await import("file://"+M),o=["merged","debug","useStyleNode"];Object.keys(e).forEach((t=>{t in{...R,...f()}&&!o.includes(t)?e[t]&&(R[t]=e[t]):console.log("[!] Skip unknown param: "+t)})),d(R),console.verbose("[ ] Read","nextcss.config.js"),console.verbose("[ ] Config merged",{...R,...f()})}else console.log("[!]","nextcss.config.js","not found. Continue with default config.");const F={...R,...f()},I=t(F.css);I.length?console.verbose("[ ] Scanning css files",I):(console.log("[!] No css files found with config:",F.css),r(1)),I.forEach((o=>{const t=e.readFileSync(o,"utf8");C.test(t)&&z.push(o)})),z.length||(console.log('[!] No css files found with "@layer nextcss;"'),r(1));const O=t(F.content);O.length?console.verbose("[ ] Scanning content files",O):(console.log("[!] No content files found with config:",F.content),r(1)),O.forEach((o=>{[...e.readFileSync(o,"utf8").matchAll(/['"`](.*?)['"`]/gm)].map((([,e])=>{(e=e.trim())&&N.push(e)}))})),N.forEach((e=>v(e,"SAVE")));const U=F.skipResetStyles?x():":root{line-height:1.4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji';-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;}*,:before,:after{box-sizing:border-box;outline:none;-webkit-user-drag:none;touch-action:pan-x pan-y;}body{margin:0;max-width:100vw;overscroll-behavior:none;}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;}h1,h2,h3,h4,h5,h6,p{margin:0;font:inherit;}small{font-size:85%;}a{color:inherit;text-decoration:none;}button{font:inherit;line-height:1;cursor:pointer;background-color:inherit;border:0;color:inherit;padding:0;}img,svg{display:block;max-width:100%;height:auto;border:none;}input,textarea,select{font:inherit;font-size:16px;border:0;border-radius:0;background-clip:padding-box;color:inherit;background-color:transparent;}textarea{resize:none;}::placeholder{font-size:14px;}label{display:block;}fieldset{border:1px solid;}ul,ol{margin:0;padding:0;list-style-type:none;}hr{border:none;border-bottom:1px solid;}table{border-spacing:0;border-collapse:collapse;}th{font-weight:inherit;}iframe{border:0;}menu{margin:0;padding:0;}form,figure,pre,blockquote,dl,dd{margin:0;}address{font:inherit;}"+x(),V=F.skipRemUnits?U:U.replace(/(\d*\.?\d+)px/g,((e,o)=>{return t=o,Math.round(parseFloat(t)/16*1e3)/1e3+"rem";var t}));V?(z.forEach((o=>{const t=e.readFileSync(o,"utf8");e.writeFileSync(o,t.replace(C,V))})),console.log("[ ] CSS files updated:",z)):console.log("[!] No CSS style has been generated.");
{
"name": "@nextcss/nextcss",
"version": "0.2.6",
"version": "0.2.7",
"description": "Testing",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc