🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@yummacss/nitro

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yummacss/nitro - npm Package Compare versions

Comparing version
3.27.0
to
3.28.1
+116
dist/generator-C23GRPv6.mjs
import{coreUtils as e,createColors as t,defaultMediaQueries as n}from"@yummacss/core";function r(e){let t=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g],r=[/`([^`]+)`/g,/"([^"]+)"/g,/'([^']+)'/g],i=[/cva\s*\(\s*["'`]([^"'`]+)["'`]/g,/:\s*["'`]([^"'`]+)["'`]/g],a=[/\bcn\s*\(\s*["'`]([^"'`]+)["'`]/g,/\bcn\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g],o=[/clsx\s*\(\s*["'`]([^"'`]+)["'`]/g,/classnames\s*\(\s*["'`]([^"'`]+)["'`]/g,/clsx\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g,/classnames\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g],s=[...n,...r,...i,...a,...o];for(let n of s){let r;for(r=n.exec(e);r!==null;){let i=r[1];i&&i.split(/\s+/).filter(e=>{let t=e.replace(/^@+/,``);return t&&/^[a-z]/.test(t)&&t.includes(`-`)}).forEach(e=>{t.add(e)}),r=n.exec(e)}}return Array.from(t)}const i=`*, :before, :after {
box-sizing: border-box;
border: 0 solid;
}
* {
margin: 0;
padding: 0;
}
html {
font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Noto Sans, Liberation Sans, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}
body {
-webkit-font-smoothing: antialiased;
font-family: inherit;
line-height: 1.5;
}
canvas, img, picture, svg, video {
max-width: 100%;
display: block;
}
button, input, optgroup, select, textarea {
background-color: transparent;
padding: .5rem;
font-family: inherit;
}
button:not([class]), input:not([class]), optgroup:not([class]), select:not([class]), textarea:not([class]) {
border: 1px solid #bfc2c7;
}
:is(a, button, input, select, summary, textarea):focus {
outline: 2px solid transparent;
}
textarea:not([rows]) {
min-height: 10em;
}
button {
cursor: pointer;
}
button:disabled, input:disabled, select:disabled, textarea:disabled {
cursor: not-allowed;
opacity: .5;
}
h1, h2, h3, h4, h5, h6, p {
overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6 {
text-wrap: balance;
font-size: 1rem;
font-weight: 600;
}
p {
text-wrap: pretty;
}
b, strong {
font-weight: 700;
}
small {
font-size: 80%;
line-height: 1.4;
}
pre, code, kbd, samp {
font-family: monospace;
font-size: 1em;
}
a {
color: inherit;
text-decoration: none;
}
ol, ul {
padding: 0;
list-style: none;
}
th {
font-size: 1rem;
font-weight: 600;
}
hr {
border-top: 1px solid #bfc2c7;
height: 0;
margin: 1em 0;
}
details {
display: block;
}
summary {
display: list-item;
}
`;function a(e,t){let n=[];if(t.safelist)for(let n of t.safelist){let r=t.prefix&&!n.startsWith(t.prefix)?t.prefix+n:n;e.add(r)}(t.normalize??!0)&&n.push(i);let r=p(e,t);return r&&n.push(r),n.join(`
`)}function o(r){let i={...e()},a=null;if(r.theme?.colors){let{percentage:e,...n}=r.theme.colors;a=t(n,e?.light,e?.dark)}let o=[...n];if(r.theme?.screens){let e=Object.entries(r.theme.screens).map(([e,t])=>({prefix:e,value:`@media (min-width: ${t})`}));for(let t of e){let e=o.findIndex(e=>e.prefix===t.prefix);e===-1?o.push(t):o[e]=t}}for(let[e,t]of Object.entries(i)){let n=!1,s={...t};a&&`black`in s.values&&`white`in s.values&&(s.values={...s.values,...a},n=!0),r.theme?.screens&&s.variants&&(s.variants={...s.variants,mediaQueries:o},n=!0),n&&(i[e]=s)}return i}function s(e,t){let n=o(t),r=new Set;for(let e of t.safelist??[])r.add(e),t.prefix&&!e.startsWith(t.prefix)&&r.add(t.prefix+e);let i=[],a=[];for(let o of e){if(r.has(o)){i.push(o);continue}let e=o;if(t.prefix){if(!e.startsWith(t.prefix)){a.push(o);continue}e=e.slice(t.prefix.length)}g(e,n,o)?i.push(o):a.push(o)}return{valid:i,invalid:a}}function c(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=r[0]??0,o=i;r[0]=i;for(let n=1;n<=t.length;n++){let s=r[n]??0,c=Math.min(s+1,(r[n-1]??0)+1,a+(e[i-1]===t[n-1]?0:1));r[n]=c,a=s,c<o&&(o=c)}if(o>n)return n+1}return r[t.length]??0}function l(e,t){let n=0;for(let r of t)if(r===e[n]&&n++,n===e.length)return!0;return e.length===0}function u(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function d(e,t){for(let n=0;n<e.length;n++){let r=(e[n]??0)-(t[n]??0);if(r!==0)return r}return 0}function f(e,t={}){let n=o(t),r=[];for(let e of Object.values(n))for(let t of Object.keys(e.values))r.push(t===`base`?e.prefix:`${e.prefix}-${t}`);let i=new Set(r),a=new Map;for(let n of e){let e=n,o=``,s=``,f=e.lastIndexOf(`:`);f!==-1&&(o=e.slice(0,f+1),e=e.slice(f+1));let p=e.match(/\/\d+$/);p&&(s=p[0],e=e.slice(0,-s.length));let m=``;if(t.prefix){if(m=t.prefix,e.startsWith(m))e=e.slice(m.length);else if(i.has(e)){a.set(n,[o+m+e+s,o+m+e]);continue}}if(!e)continue;let h=e.length<=4?1:2,g,_=[h+1,1,1,0];for(let t of r){let n=c(e,t,h);if(n===0||n>h)continue;let r=[n,l(t,e)||l(e,t)?0:1,t[0]===e[0]?0:1,-u(t,e)],i=d(r,_);(i<0||i===0&&g!==void 0&&t<g)&&(_=r,g=t)}g!==void 0&&a.set(n,[o+m+g+s,o+m+g])}let{valid:f}=s(Array.from(a.values()).flat(),t),p=new Set(f),m=new Map;for(let[e,t]of a){let n=t.find(e=>p.has(e));n&&m.set(e,n)}return m}function p(e,t){let n=o(t),r=[],i=new Map,a=new Set,s=Array.from(e).sort();for(let e of s){let o=e;if(t.prefix&&o.startsWith(t.prefix))o=o.slice(t.prefix.length);else if(t.prefix)continue;if(a.has(e))continue;let s=g(o,n,e);if(s){if(s.mediaQuery){let e=i.get(s.mediaQuery)||[];e.push(s.rule),i.set(s.mediaQuery,e)}else r.push(s.rule);a.add(e)}}let c=Array.from(i.entries()).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of c){let n=t.map(e=>e.replace(/^/gm,` `)).join(`
`);r.push(`${e} {\n${n}\n}`)}return r.join(`
`)}function m(e,t,n){let{properties:r,variants:i,prefix:a,values:o}=t,s=e,c,l=``,u=``,d=``,f=!0;for(;f;){if(f=!1,i?.mediaQueries){for(let e of i.mediaQueries)if(s.startsWith(`@${e.prefix}:`)){c=e.value,s=s.slice(e.prefix.length+2),f=!0;break}}if(!f){if(i?.pseudoElements){for(let e of i.pseudoElements)if(s.startsWith(`${e.prefix}::`)){u+=e.value,s=s.slice(e.prefix.length+2),f=!0;break}}if(!f&&i?.pseudoClasses){for(let e of i.pseudoClasses)if(s.startsWith(`${e.prefix}:`)&&!s.startsWith(`${e.prefix}::`)){l+=e.value,s=s.slice(e.prefix.length+1),f=!0;break}}}}if(i?.opacity){for(let e of i.opacity)if(s.endsWith(`/${e.prefix}`)){d=e.value,s=s.slice(0,-(e.prefix.length+1));break}}if(!s.startsWith(`${a}-`)&&s!==a)return null;let p=s===a?``:s.slice(a.length+1),m=!1,g=p;p.startsWith(`-`)&&(m=!0,g=p.slice(1));let _=o[g===``?`base`:g]||o[g];if(!_)return null;let v=_;m&&/^-?[\d.]/.test(_)&&(v=_.startsWith(`-`)?_.slice(1):`-${_}`);let y=d&&v.startsWith(`#`)&&v.length===7?`${v}${d}`:v,b=r.map(e=>`${e}: ${y};`).join(`
`);return{rule:`.${h(n)}${l}${u} {\n ${b}\n}`,mediaQuery:c}}function h(e){return e.replace(/:/g,`\\:`).replace(/\//g,`\\/`).replace(/@/g,`\\@`).replace(/%/g,`\\%`)}function g(e,t,n){for(let[r,i]of Object.entries(t)){let t=m(e,i,n);if(t)return t}return null}export{r as a,i,f as n,s as r,a as t};
import { z } from "zod";
//#region src/config/schema.d.ts
declare const configName = "yumma.config.mjs";
/**
* Configure Yumma CSS.
*/
interface Config {
/**
* Files to scan for Yumma CSS classes.
*
* @example ["./src/**\/*.{ts,tsx}"]
* @default [""]
*/
source?: string[];
/**
* Path to output the generated CSS file.
*
* @example "./dist/output.css"
* @default ""
*/
output?: string;
/**
* Prefix to namespace all generated classes.
*
* @example "ui-"
*/
prefix?: string;
/**
* Reset default browser styles. Provide false to skip generating base resets.
*
* @default true
*/
normalize?: boolean;
/**
* Classes that are always generated, regardless of whether they exist in source files.
*
* @example ["bg-red-5", "c-white"]
*/
safelist?: string[];
/**
* Customize the default design system.
*/
theme?: {
/**
* Add custom colors to the palette.
* Provide base colors and Yumma CSS generates the full shade scale automatically.
*
* @example { purple: "#9333EA" }
*/
colors?: Record<string, string> & {
/**
* Control shade generation aggressiveness.
*/
percentage?: {
/**
* Adjust the percentage of white mixed into lighter shades per step.
* @default 14
*/
light?: number;
/**
* Adjust the percentage of black mixed into darker shades per step.
* @default 14
*/
dark?: number;
};
};
/**
* Override or extend the default breakpoints.
*
* @example { sm: "40rem", md: "48rem", lg: "64rem", xl: "80rem", xxl: "96rem" }
*/
screens?: Record<string, string>;
};
}
declare const ConfigSchema: z.ZodObject<{
source: z.ZodDefault<z.ZodArray<z.ZodString>>;
output: z.ZodDefault<z.ZodString>;
prefix: z.ZodOptional<z.ZodString>;
normalize: z.ZodDefault<z.ZodBoolean>;
safelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
theme: z.ZodOptional<z.ZodObject<{
colors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
screens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, z.core.$strip>>;
}, z.core.$strip>;
/**
* Define your Yumma CSS configuration.
*
* @param config - The configuration options to customize Yumma CSS.
* @returns The resolved configuration object.
*/
declare function defineConfig(config: Config): Config;
//#endregion
//#region src/generator.d.ts
declare function generator(usedClasses: Set<string>, config: Config): string;
interface ValidationResult {
valid: string[];
invalid: string[];
}
/**
* Check class names against the same matching rules the generator uses,
* so a class is valid exactly when it produces CSS. Safelist entries
* always count as valid.
*/
declare function validateClasses(classNames: Iterable<string>, config: Config): ValidationResult;
/**
* Suggest the closest valid class for each unknown class name, e.g.
* "gap-4" suggests "g-4". Variant prefixes (`@sm:`, `h:`), opacity
* suffixes (`/50`), and the configured prefix are preserved around the
* suggested base class. Classes with no close match are omitted from
* the result.
*/
declare function suggestClasses(classNames: Iterable<string>, config?: Config): Map<string, string>;
//#endregion
//#region src/normalize.d.ts
declare const normalizeCSS = "*, :before, :after {\n box-sizing: border-box;\n border: 0 solid;\n}\n\n* {\n margin: 0;\n padding: 0;\n}\n\nhtml {\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Noto Sans, Liberation Sans, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n\nbody {\n -webkit-font-smoothing: antialiased;\n font-family: inherit;\n line-height: 1.5;\n}\n\ncanvas, img, picture, svg, video {\n max-width: 100%;\n display: block;\n}\n\nbutton, input, optgroup, select, textarea {\n background-color: transparent;\n padding: .5rem;\n font-family: inherit;\n}\n\nbutton:not([class]), input:not([class]), optgroup:not([class]), select:not([class]), textarea:not([class]) {\n border: 1px solid #bfc2c7;\n}\n\n:is(a, button, input, select, summary, textarea):focus {\n outline: 2px solid transparent;\n}\n\ntextarea:not([rows]) {\n min-height: 10em;\n}\n\nbutton {\n cursor: pointer;\n}\n\nbutton:disabled, input:disabled, select:disabled, textarea:disabled {\n cursor: not-allowed;\n opacity: .5;\n}\n\nh1, h2, h3, h4, h5, h6, p {\n overflow-wrap: break-word;\n}\n\nh1, h2, h3, h4, h5, h6 {\n text-wrap: balance;\n font-size: 1rem;\n font-weight: 600;\n}\n\np {\n text-wrap: pretty;\n}\n\nb, strong {\n font-weight: 700;\n}\n\nsmall {\n font-size: 80%;\n line-height: 1.4;\n}\n\npre, code, kbd, samp {\n font-family: monospace;\n font-size: 1em;\n}\n\na {\n color: inherit;\n text-decoration: none;\n}\n\nol, ul {\n padding: 0;\n list-style: none;\n}\n\nth {\n font-size: 1rem;\n font-weight: 600;\n}\n\nhr {\n border-top: 1px solid #bfc2c7;\n height: 0;\n margin: 1em 0;\n}\n\ndetails {\n display: block;\n}\n\nsummary {\n display: list-item;\n}\n";
//#endregion
export { validateClasses as a, configName as c, suggestClasses as i, defineConfig as l, ValidationResult as n, Config as o, generator as r, ConfigSchema as s, normalizeCSS as t };
+1
-1

@@ -1,2 +0,2 @@

import { r as generator, t as normalizeCSS } from "./normalize--Zn97zQz.mjs";
import { r as generator, t as normalizeCSS } from "./normalize-IaCg6ioj.mjs";

@@ -3,0 +3,0 @@ //#region src/tokenizer.d.ts

@@ -1,1 +0,1 @@

import{i as e,r as t,t as n}from"./generator-xYIili8Z.mjs";export{n as generator,t as normalizeCSS,e as tokenizer};
import{a as e,i as t,t as n}from"./generator-C23GRPv6.mjs";export{n as generator,t as normalizeCSS,e as tokenizer};

@@ -1,2 +0,2 @@

import { a as Config, c as defineConfig, i as validateClasses, n as ValidationResult, o as ConfigSchema, r as generator, s as configName, t as normalizeCSS } from "./normalize--Zn97zQz.mjs";
import { a as validateClasses, c as configName, i as suggestClasses, l as defineConfig, n as ValidationResult, o as Config, r as generator, s as ConfigSchema, t as normalizeCSS } from "./normalize-IaCg6ioj.mjs";

@@ -54,2 +54,2 @@ //#region src/config/load.d.ts

//#endregion
export { type Config, ConfigSchema, type LoadConfigOptions, type LoadedConfig, type ScanOptions, type ScanResult, type ValidationResult, configName, defineConfig, extractor, generator, loadConfig, normalizeCSS, scan, validateClasses };
export { type Config, ConfigSchema, type LoadConfigOptions, type LoadedConfig, type ScanOptions, type ScanResult, type ValidationResult, configName, defineConfig, extractor, generator, loadConfig, normalizeCSS, scan, suggestClasses, validateClasses };

@@ -1,1 +0,1 @@

import{i as e,n as t,r as n,t as r}from"./generator-xYIili8Z.mjs";import{readFileSync as i,statSync as a}from"node:fs";import{isAbsolute as o,join as s,resolve as c}from"node:path";import{pathToFileURL as l}from"node:url";import{z as u}from"zod";import{glob as d}from"tinyglobby";const f=`yumma.config.mjs`,p=u.object({source:u.array(u.string()).default([``]),output:u.string().default(``),prefix:u.string().optional(),normalize:u.boolean().default(!0),safelist:u.array(u.string()).optional(),theme:u.object({colors:u.record(u.string(),u.any()).optional(),screens:u.record(u.string(),u.string()).optional()}).optional()});function m(e){return e}async function h(e={}){if(e.config)return{config:p.parse(e.config),path:null};let t=e.cwd??process.cwd(),n=e.path?o(e.path)?e.path:s(t,e.path):s(t,f),r=a(n).mtimeMs,{default:i}=await import(`${l(n).href}?t=${r}`);return{config:p.parse(i),path:n}}async function g(t,n={}){let r=(await d(t,{cwd:n.cwd,absolute:!0})).map(e=>c(e)),a=new Set;for(let t of r)try{e(i(t,`utf-8`)).forEach(e=>{a.add(e)})}catch{}return{classes:a,files:r}}async function _(e){let{classes:t}=await g(e);return t}export{p as ConfigSchema,f as configName,m as defineConfig,_ as extractor,r as generator,h as loadConfig,n as normalizeCSS,g as scan,t as validateClasses};
import{a as e,i as t,n,r,t as i}from"./generator-C23GRPv6.mjs";import{readFileSync as a,statSync as o}from"node:fs";import{isAbsolute as s,join as c,resolve as l}from"node:path";import{pathToFileURL as u}from"node:url";import{z as d}from"zod";import{glob as f}from"tinyglobby";const p=`yumma.config.mjs`,m=d.object({source:d.array(d.string()).default([``]),output:d.string().default(``),prefix:d.string().optional(),normalize:d.boolean().default(!0),safelist:d.array(d.string()).optional(),theme:d.object({colors:d.record(d.string(),d.any()).optional(),screens:d.record(d.string(),d.string()).optional()}).optional()});function h(e){return e}async function g(e={}){if(e.config)return{config:m.parse(e.config),path:null};let t=e.cwd??process.cwd(),n=e.path?s(e.path)?e.path:c(t,e.path):c(t,p),r=o(n).mtimeMs,{default:i}=await import(`${u(n).href}?t=${r}`);return{config:m.parse(i),path:n}}async function _(t,n={}){let r=(await f(t,{cwd:n.cwd,absolute:!0})).map(e=>l(e)),i=new Set;for(let t of r)try{e(a(t,`utf-8`)).forEach(e=>{i.add(e)})}catch{}return{classes:i,files:r}}async function v(e){let{classes:t}=await _(e);return t}export{m as ConfigSchema,p as configName,h as defineConfig,v as extractor,i as generator,g as loadConfig,t as normalizeCSS,_ as scan,n as suggestClasses,r as validateClasses};
{
"name": "@yummacss/nitro",
"version": "3.27.0",
"version": "3.28.1",
"description": "Fast CSS generation for Yumma CSS",

@@ -37,3 +37,3 @@ "keywords": [

"zod": "^4.3.4",
"@yummacss/core": "3.27.0"
"@yummacss/core": "3.28.1"
},

@@ -40,0 +40,0 @@ "publishConfig": {

import{coreUtils as e,createColors as t,defaultMediaQueries as n}from"@yummacss/core";function r(e){let t=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g],r=[/`([^`]+)`/g,/"([^"]+)"/g,/'([^']+)'/g],i=[/cva\s*\(\s*["'`]([^"'`]+)["'`]/g,/:\s*["'`]([^"'`]+)["'`]/g],a=[/\bcn\s*\(\s*["'`]([^"'`]+)["'`]/g,/\bcn\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g],o=[/clsx\s*\(\s*["'`]([^"'`]+)["'`]/g,/classnames\s*\(\s*["'`]([^"'`]+)["'`]/g,/clsx\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g,/classnames\s*\(\s*\{\s*["'`]([^"'`]+)["'`]\s*:/g],s=[...n,...r,...i,...a,...o];for(let n of s){let r;for(r=n.exec(e);r!==null;){let i=r[1];i&&i.split(/\s+/).filter(e=>{let t=e.replace(/^@+/,``);return t&&/^[a-z]/.test(t)&&t.includes(`-`)}).forEach(e=>{t.add(e)}),r=n.exec(e)}}return Array.from(t)}const i=`*, :before, :after {
box-sizing: border-box;
border: 0 solid;
}
* {
margin: 0;
padding: 0;
}
html {
font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Noto Sans, Liberation Sans, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}
body {
-webkit-font-smoothing: antialiased;
font-family: inherit;
line-height: 1.5;
}
canvas, img, picture, svg, video {
max-width: 100%;
display: block;
}
button, input, optgroup, select, textarea {
background-color: transparent;
padding: .5rem;
font-family: inherit;
}
button:not([class]), input:not([class]), optgroup:not([class]), select:not([class]), textarea:not([class]) {
border: 1px solid #bfc2c7;
}
:is(a, button, input, select, summary, textarea):focus {
outline: 2px solid transparent;
}
textarea:not([rows]) {
min-height: 10em;
}
button {
cursor: pointer;
}
button:disabled, input:disabled, select:disabled, textarea:disabled {
cursor: not-allowed;
opacity: .5;
}
h1, h2, h3, h4, h5, h6, p {
overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6 {
text-wrap: balance;
font-size: 1rem;
font-weight: 600;
}
p {
text-wrap: pretty;
}
b, strong {
font-weight: 700;
}
small {
font-size: 80%;
line-height: 1.4;
}
pre, code, kbd, samp {
font-family: monospace;
font-size: 1em;
}
a {
color: inherit;
text-decoration: none;
}
ol, ul {
padding: 0;
list-style: none;
}
th {
font-size: 1rem;
font-weight: 600;
}
hr {
border-top: 1px solid #bfc2c7;
height: 0;
margin: 1em 0;
}
details {
display: block;
}
summary {
display: list-item;
}
`;function a(e,t){let n=[];if(t.safelist)for(let n of t.safelist){let r=t.prefix&&!n.startsWith(t.prefix)?t.prefix+n:n;e.add(r)}(t.normalize??!0)&&n.push(i);let r=c(e,t);return r&&n.push(r),n.join(`
`)}function o(r){let i={...e()},a=null;if(r.theme?.colors){let{percentage:e,...n}=r.theme.colors;a=t(n,e?.light,e?.dark)}let o=[...n];if(r.theme?.screens){let e=Object.entries(r.theme.screens).map(([e,t])=>({prefix:e,value:`@media (min-width: ${t})`}));for(let t of e){let e=o.findIndex(e=>e.prefix===t.prefix);e===-1?o.push(t):o[e]=t}}for(let[e,t]of Object.entries(i)){let n=!1,s={...t};a&&`black`in s.values&&`white`in s.values&&(s.values={...s.values,...a},n=!0),r.theme?.screens&&s.variants&&(s.variants={...s.variants,mediaQueries:o},n=!0),n&&(i[e]=s)}return i}function s(e,t){let n=o(t),r=new Set;for(let e of t.safelist??[])r.add(e),t.prefix&&!e.startsWith(t.prefix)&&r.add(t.prefix+e);let i=[],a=[];for(let o of e){if(r.has(o)){i.push(o);continue}let e=o;if(t.prefix){if(!e.startsWith(t.prefix)){a.push(o);continue}e=e.slice(t.prefix.length)}d(e,n,o)?i.push(o):a.push(o)}return{valid:i,invalid:a}}function c(e,t){let n=o(t),r=[],i=new Map,a=new Set,s=Array.from(e).sort();for(let e of s){let o=e;if(t.prefix&&o.startsWith(t.prefix))o=o.slice(t.prefix.length);else if(t.prefix)continue;if(a.has(e))continue;let s=d(o,n,e);if(s){if(s.mediaQuery){let e=i.get(s.mediaQuery)||[];e.push(s.rule),i.set(s.mediaQuery,e)}else r.push(s.rule);a.add(e)}}let c=Array.from(i.entries()).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of c){let n=t.map(e=>e.replace(/^/gm,` `)).join(`
`);r.push(`${e} {\n${n}\n}`)}return r.join(`
`)}function l(e,t,n){let{properties:r,variants:i,prefix:a,values:o}=t,s=e,c,l=``,d=``,f=``,p=!0;for(;p;){if(p=!1,i?.mediaQueries){for(let e of i.mediaQueries)if(s.startsWith(`@${e.prefix}:`)){c=e.value,s=s.slice(e.prefix.length+2),p=!0;break}}if(!p){if(i?.pseudoElements){for(let e of i.pseudoElements)if(s.startsWith(`${e.prefix}::`)){d+=e.value,s=s.slice(e.prefix.length+2),p=!0;break}}if(!p&&i?.pseudoClasses){for(let e of i.pseudoClasses)if(s.startsWith(`${e.prefix}:`)&&!s.startsWith(`${e.prefix}::`)){l+=e.value,s=s.slice(e.prefix.length+1),p=!0;break}}}}if(i?.opacity){for(let e of i.opacity)if(s.endsWith(`/${e.prefix}`)){f=e.value,s=s.slice(0,-(e.prefix.length+1));break}}if(!s.startsWith(`${a}-`)&&s!==a)return null;let m=s===a?``:s.slice(a.length+1),h=!1,g=m;m.startsWith(`-`)&&(h=!0,g=m.slice(1));let _=o[g===``?`base`:g]||o[g];if(!_)return null;let v=_;h&&/^-?[\d.]/.test(_)&&(v=_.startsWith(`-`)?_.slice(1):`-${_}`);let y=f&&v.startsWith(`#`)&&v.length===7?`${v}${f}`:v,b=r.map(e=>`${e}: ${y};`).join(`
`);return{rule:`.${u(n)}${l}${d} {\n ${b}\n}`,mediaQuery:c}}function u(e){return e.replace(/:/g,`\\:`).replace(/\//g,`\\/`).replace(/@/g,`\\@`).replace(/%/g,`\\%`)}function d(e,t,n){for(let[r,i]of Object.entries(t)){let t=l(e,i,n);if(t)return t}return null}export{r as i,s as n,i as r,a as t};
import { z } from "zod";
//#region src/config/schema.d.ts
declare const configName = "yumma.config.mjs";
/**
* Configure Yumma CSS.
*/
interface Config {
/**
* Files to scan for Yumma CSS classes.
*
* @example ["./src/**\/*.{ts,tsx}"]
* @default [""]
*/
source?: string[];
/**
* Path to output the generated CSS file.
*
* @example "./dist/output.css"
* @default ""
*/
output?: string;
/**
* Prefix to namespace all generated classes.
*
* @example "ui-"
*/
prefix?: string;
/**
* Reset default browser styles. Provide false to skip generating base resets.
*
* @default true
*/
normalize?: boolean;
/**
* Classes that are always generated, regardless of whether they exist in source files.
*
* @example ["bg-red-5", "c-white"]
*/
safelist?: string[];
/**
* Customize the default design system.
*/
theme?: {
/**
* Add custom colors to the palette.
* Provide base colors and Yumma CSS generates the full shade scale automatically.
*
* @example { purple: "#9333EA" }
*/
colors?: Record<string, string> & {
/**
* Control shade generation aggressiveness.
*/
percentage?: {
/**
* Adjust the percentage of white mixed into lighter shades per step.
* @default 14
*/
light?: number;
/**
* Adjust the percentage of black mixed into darker shades per step.
* @default 14
*/
dark?: number;
};
};
/**
* Override or extend the default breakpoints.
*
* @example { sm: "40rem", md: "48rem", lg: "64rem", xl: "80rem", xxl: "96rem" }
*/
screens?: Record<string, string>;
};
}
declare const ConfigSchema: z.ZodObject<{
source: z.ZodDefault<z.ZodArray<z.ZodString>>;
output: z.ZodDefault<z.ZodString>;
prefix: z.ZodOptional<z.ZodString>;
normalize: z.ZodDefault<z.ZodBoolean>;
safelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
theme: z.ZodOptional<z.ZodObject<{
colors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
screens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, z.core.$strip>>;
}, z.core.$strip>;
/**
* Define your Yumma CSS configuration.
*
* @param config - The configuration options to customize Yumma CSS.
* @returns The resolved configuration object.
*/
declare function defineConfig(config: Config): Config;
//#endregion
//#region src/generator.d.ts
declare function generator(usedClasses: Set<string>, config: Config): string;
interface ValidationResult {
valid: string[];
invalid: string[];
}
/**
* Check class names against the same matching rules the generator uses,
* so a class is valid exactly when it produces CSS. Safelist entries
* always count as valid.
*/
declare function validateClasses(classNames: Iterable<string>, config: Config): ValidationResult;
//#endregion
//#region src/normalize.d.ts
declare const normalizeCSS = "*, :before, :after {\n box-sizing: border-box;\n border: 0 solid;\n}\n\n* {\n margin: 0;\n padding: 0;\n}\n\nhtml {\n font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Noto Sans, Liberation Sans, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n\nbody {\n -webkit-font-smoothing: antialiased;\n font-family: inherit;\n line-height: 1.5;\n}\n\ncanvas, img, picture, svg, video {\n max-width: 100%;\n display: block;\n}\n\nbutton, input, optgroup, select, textarea {\n background-color: transparent;\n padding: .5rem;\n font-family: inherit;\n}\n\nbutton:not([class]), input:not([class]), optgroup:not([class]), select:not([class]), textarea:not([class]) {\n border: 1px solid #bfc2c7;\n}\n\n:is(a, button, input, select, summary, textarea):focus {\n outline: 2px solid transparent;\n}\n\ntextarea:not([rows]) {\n min-height: 10em;\n}\n\nbutton {\n cursor: pointer;\n}\n\nbutton:disabled, input:disabled, select:disabled, textarea:disabled {\n cursor: not-allowed;\n opacity: .5;\n}\n\nh1, h2, h3, h4, h5, h6, p {\n overflow-wrap: break-word;\n}\n\nh1, h2, h3, h4, h5, h6 {\n text-wrap: balance;\n font-size: 1rem;\n font-weight: 600;\n}\n\np {\n text-wrap: pretty;\n}\n\nb, strong {\n font-weight: 700;\n}\n\nsmall {\n font-size: 80%;\n line-height: 1.4;\n}\n\npre, code, kbd, samp {\n font-family: monospace;\n font-size: 1em;\n}\n\na {\n color: inherit;\n text-decoration: none;\n}\n\nol, ul {\n padding: 0;\n list-style: none;\n}\n\nth {\n font-size: 1rem;\n font-weight: 600;\n}\n\nhr {\n border-top: 1px solid #bfc2c7;\n height: 0;\n margin: 1em 0;\n}\n\ndetails {\n display: block;\n}\n\nsummary {\n display: list-item;\n}\n";
//#endregion
export { Config as a, defineConfig as c, validateClasses as i, ValidationResult as n, ConfigSchema as o, generator as r, configName as s, normalizeCSS as t };