@soybeanjs/shadcn-theme 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{colord as e}from"@soybeanjs/colord";import{generatePalette as t,simplePalette as n,tailwindPalette as r}from"@soybeanjs/colord/palette";function i(e){return Object.keys(e)}function a(e){return!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`)}function o(e){return e.replace(/hsl\(/g,``).replace(/\)/g,``)}const s=e=>[`inherit`,`currentColor`,`transparent`].includes(e);function c(t,i){let o=t;if(s(t))return o;if(t===`black`)return n.black[i];if(t===`white`)return n.white[i];if(a(t)){let[e,n]=t.split(`.`);o=r[e][n][i]}else i===`hsl`&&t.startsWith(`oklch(`)&&(o=e(t).toHslString()),i===`oklch`&&t.startsWith(`hsl(`)&&(o=e(t).toOklchString());return o}function l(e){let{base:t,primary:n,feedback:r,sidebar:i}=e;return`base:${t};primary:${n};feedback:${r};sidebar:${i}`}const u={background:`--background`,foreground:`--foreground`,card:`--card`,cardForeground:`--card-foreground`,popover:`--popover`,popoverForeground:`--popover-foreground`,primary:`--primary`,primaryForeground:`--primary-foreground`,secondary:`--secondary`,secondaryForeground:`--secondary-foreground`,muted:`--muted`,mutedForeground:`--muted-foreground`,accent:`--accent`,accentForeground:`--accent-foreground`,destructive:`--destructive`,destructiveForeground:`--destructive-foreground`,border:`--border`,input:`--input`,ring:`--ring`,success:`--success`,successForeground:`--success-foreground`,warning:`--warning`,warningForeground:`--warning-foreground`,info:`--info`,infoForeground:`--info-foreground`,carbon:`--carbon`,carbonForeground:`--carbon-foreground`,sidebar:`--sidebar`,sidebarForeground:`--sidebar-foreground`,sidebarPrimary:`--sidebar-primary`,sidebarPrimaryForeground:`--sidebar-primary-foreground`,sidebarAccent:`--sidebar-accent`,sidebarAccentForeground:`--sidebar-accent-foreground`,sidebarBorder:`--sidebar-border`,sidebarRing:`--sidebar-ring`,chart1:`--chart-1`,chart2:`--chart-2`,chart3:`--chart-3`,chart4:`--chart-4`,chart5:`--chart-5`},d={borderAlpha:`--border-alpha`,inputAlpha:`--input-alpha`,sidebarBorderAlpha:`--sidebar-border-alpha`},f={base:`neutral`,primary:`indigo`,feedback:`classic`},p={class:`.dark`,media:`@media (prefers-color-scheme: dark)`},m=`oklch(100% 0 0 / 0.1)`,h=`oklch(100% 0 0 / 0.15)`,g={stone:{light:{background:`white`,foreground:`stone.950`,card:`white`,cardForeground:`stone.950`,popover:`white`,popoverForeground:`stone.950`,primaryForeground:`stone.50`,secondary:`stone.100`,secondaryForeground:`stone.900`,muted:`stone.100`,mutedForeground:`stone.500`,accent:`stone.100`,accentForeground:`stone.900`,destructiveForeground:`stone.50`,successForeground:`stone.50`,warningForeground:`stone.50`,infoForeground:`stone.50`,carbon:`stone.800`,carbonForeground:`stone.50`,border:`stone.200`,input:`stone.200`},dark:{background:`stone.950`,foreground:`stone.50`,card:`stone.900`,cardForeground:`stone.50`,popover:`stone.900`,popoverForeground:`stone.50`,primaryForeground:`stone.900`,secondary:`stone.800`,secondaryForeground:`stone.50`,muted:`stone.800`,mutedForeground:`stone.400`,accent:`stone.800`,accentForeground:`stone.50`,destructiveForeground:`stone.900`,successForeground:`stone.900`,warningForeground:`stone.900`,infoForeground:`stone.900`,carbon:`stone.100`,carbonForeground:`stone.900`,border:m,input:h}},zinc:{light:{background:`white`,foreground:`zinc.950`,card:`white`,cardForeground:`zinc.950`,popover:`white`,popoverForeground:`zinc.950`,primaryForeground:`zinc.50`,secondary:`zinc.100`,secondaryForeground:`zinc.900`,muted:`zinc.100`,mutedForeground:`zinc.500`,accent:`zinc.100`,accentForeground:`zinc.900`,destructiveForeground:`zinc.50`,successForeground:`zinc.50`,warningForeground:`zinc.50`,infoForeground:`zinc.50`,carbon:`zinc.800`,carbonForeground:`zinc.50`,border:`zinc.200`,input:`zinc.200`},dark:{background:`zinc.950`,foreground:`zinc.50`,card:`zinc.900`,cardForeground:`zinc.50`,popover:`zinc.900`,popoverForeground:`zinc.50`,primaryForeground:`zinc.900`,secondary:`zinc.800`,secondaryForeground:`zinc.50`,muted:`zinc.800`,mutedForeground:`zinc.400`,accent:`zinc.800`,accentForeground:`zinc.50`,destructiveForeground:`zinc.900`,successForeground:`zinc.900`,warningForeground:`zinc.900`,infoForeground:`zinc.900`,carbon:`zinc.100`,carbonForeground:`zinc.900`,border:m,input:h}},neutral:{light:{background:`white`,foreground:`neutral.950`,card:`white`,cardForeground:`neutral.950`,popover:`white`,popoverForeground:`neutral.950`,primaryForeground:`neutral.50`,secondary:`neutral.100`,secondaryForeground:`neutral.900`,muted:`neutral.100`,mutedForeground:`neutral.500`,accent:`neutral.100`,accentForeground:`neutral.900`,destructiveForeground:`neutral.50`,successForeground:`neutral.50`,warningForeground:`neutral.50`,infoForeground:`neutral.50`,carbon:`neutral.800`,carbonForeground:`neutral.50`,border:`neutral.200`,input:`neutral.200`},dark:{background:`neutral.950`,foreground:`neutral.50`,card:`neutral.900`,cardForeground:`neutral.50`,popover:`neutral.900`,popoverForeground:`neutral.50`,primaryForeground:`neutral.900`,secondary:`neutral.800`,secondaryForeground:`neutral.50`,muted:`neutral.800`,mutedForeground:`neutral.400`,accent:`neutral.800`,accentForeground:`neutral.50`,destructiveForeground:`neutral.900`,successForeground:`neutral.900`,warningForeground:`neutral.900`,infoForeground:`neutral.900`,carbon:`neutral.100`,carbonForeground:`neutral.900`,border:m,input:h}},gray:{light:{background:`white`,foreground:`gray.950`,card:`white`,cardForeground:`gray.950`,popover:`white`,popoverForeground:`gray.950`,primaryForeground:`gray.50`,secondary:`gray.100`,secondaryForeground:`gray.900`,muted:`gray.100`,mutedForeground:`gray.500`,accent:`gray.100`,accentForeground:`gray.900`,carbon:`gray.800`,destructiveForeground:`gray.50`,successForeground:`gray.50`,warningForeground:`gray.50`,infoForeground:`gray.50`,carbonForeground:`gray.50`,border:`gray.200`,input:`gray.200`},dark:{background:`gray.950`,foreground:`gray.50`,card:`gray.900`,cardForeground:`gray.50`,popover:`gray.900`,popoverForeground:`gray.50`,primaryForeground:`gray.900`,secondary:`gray.800`,secondaryForeground:`gray.50`,muted:`gray.800`,mutedForeground:`gray.400`,accent:`gray.800`,accentForeground:`gray.50`,carbon:`gray.100`,destructiveForeground:`gray.900`,successForeground:`gray.900`,warningForeground:`gray.900`,infoForeground:`gray.900`,carbonForeground:`gray.900`,border:m,input:h}},slate:{light:{background:`white`,foreground:`slate.950`,card:`white`,cardForeground:`slate.950`,popover:`white`,popoverForeground:`slate.950`,primaryForeground:`slate.50`,secondary:`slate.100`,secondaryForeground:`slate.900`,muted:`slate.100`,mutedForeground:`slate.500`,accent:`slate.100`,accentForeground:`slate.900`,destructiveForeground:`slate.50`,successForeground:`slate.50`,warningForeground:`slate.50`,infoForeground:`slate.50`,carbon:`slate.800`,carbonForeground:`slate.50`,border:`slate.200`,input:`slate.200`},dark:{background:`slate.950`,foreground:`slate.50`,card:`slate.900`,cardForeground:`slate.50`,popover:`slate.900`,popoverForeground:`slate.50`,primaryForeground:`slate.900`,secondary:`slate.800`,secondaryForeground:`slate.50`,muted:`slate.800`,mutedForeground:`slate.400`,accent:`slate.800`,accentForeground:`slate.50`,carbon:`slate.100`,destructiveForeground:`slate.900`,successForeground:`slate.900`,warningForeground:`slate.900`,infoForeground:`slate.900`,carbonForeground:`slate.900`,border:m,input:h}}},_={stone:{light:{primary:`stone.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`stone.200`,ring:`stone.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},zinc:{light:{primary:`zinc.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`zinc.200`,ring:`zinc.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},neutral:{light:{primary:`neutral.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`neutral.200`,ring:`neutral.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},gray:{light:{primary:`gray.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`gray.200`,ring:`gray.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},slate:{light:{primary:`slate.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`slate.200`,ring:`slate.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},red:{light:{primary:`red.500`,ring:`red.400`,chart1:`red.300`,chart2:`red.500`,chart3:`red.600`,chart4:`red.700`,chart5:`red.800`},dark:{primary:`red.500`,ring:`red.900`,chart1:`red.300`,chart2:`red.500`,chart3:`red.600`,chart4:`red.700`,chart5:`red.800`}},orange:{light:{primary:`orange.500`,ring:`orange.400`,chart1:`orange.300`,chart2:`orange.500`,chart3:`orange.600`,chart4:`orange.700`,chart5:`orange.800`},dark:{primary:`orange.500`,ring:`orange.900`,chart1:`orange.300`,chart2:`orange.500`,chart3:`orange.600`,chart4:`orange.700`,chart5:`orange.800`}},amber:{light:{primary:`amber.500`,ring:`amber.400`,chart1:`amber.300`,chart2:`amber.500`,chart3:`amber.600`,chart4:`amber.700`,chart5:`amber.800`},dark:{primary:`amber.500`,ring:`amber.900`,chart1:`amber.300`,chart2:`amber.500`,chart3:`amber.600`,chart4:`amber.700`,chart5:`amber.800`}},yellow:{light:{primary:`yellow.500`,ring:`yellow.400`,chart1:`yellow.300`,chart2:`yellow.500`,chart3:`yellow.600`,chart4:`yellow.700`,chart5:`yellow.800`},dark:{primary:`yellow.500`,ring:`yellow.900`,chart1:`yellow.300`,chart2:`yellow.500`,chart3:`yellow.600`,chart4:`yellow.700`,chart5:`yellow.800`}},lime:{light:{primary:`lime.500`,ring:`lime.400`,chart1:`lime.300`,chart2:`lime.500`,chart3:`lime.600`,chart4:`lime.700`,chart5:`lime.800`},dark:{primary:`lime.600`,ring:`lime.900`,chart1:`lime.300`,chart2:`lime.500`,chart3:`lime.600`,chart4:`lime.700`,chart5:`lime.800`}},green:{light:{primary:`green.500`,ring:`green.400`,chart1:`green.300`,chart2:`green.500`,chart3:`green.600`,chart4:`green.700`,chart5:`green.800`},dark:{primary:`green.600`,ring:`green.900`,chart1:`green.300`,chart2:`green.500`,chart3:`green.600`,chart4:`green.700`,chart5:`green.800`}},emerald:{light:{primary:`emerald.500`,ring:`emerald.400`,chart1:`emerald.300`,chart2:`emerald.500`,chart3:`emerald.600`,chart4:`emerald.700`,chart5:`emerald.800`},dark:{primary:`emerald.600`,ring:`emerald.900`,chart1:`emerald.300`,chart2:`emerald.500`,chart3:`emerald.600`,chart4:`emerald.700`,chart5:`emerald.800`}},teal:{light:{primary:`teal.500`,ring:`teal.400`,chart1:`teal.300`,chart2:`teal.500`,chart3:`teal.600`,chart4:`teal.700`,chart5:`teal.800`},dark:{primary:`teal.500`,ring:`teal.900`,chart1:`teal.300`,chart2:`teal.500`,chart3:`teal.600`,chart4:`teal.700`,chart5:`teal.800`}},cyan:{light:{primary:`cyan.500`,ring:`cyan.400`,chart1:`cyan.300`,chart2:`cyan.500`,chart3:`cyan.600`,chart4:`cyan.700`,chart5:`cyan.800`},dark:{primary:`cyan.500`,ring:`cyan.900`,chart1:`cyan.300`,chart2:`cyan.500`,chart3:`cyan.600`,chart4:`cyan.700`,chart5:`cyan.800`}},sky:{light:{primary:`sky.500`,ring:`sky.400`,chart1:`sky.300`,chart2:`sky.500`,chart3:`sky.600`,chart4:`sky.700`,chart5:`sky.800`},dark:{primary:`sky.500`,ring:`sky.900`,chart1:`sky.300`,chart2:`sky.500`,chart3:`sky.600`,chart4:`sky.700`,chart5:`sky.800`}},blue:{light:{primary:`blue.500`,ring:`blue.400`,chart1:`blue.300`,chart2:`blue.500`,chart3:`blue.600`,chart4:`blue.700`,chart5:`blue.800`},dark:{primary:`blue.500`,ring:`blue.900`,chart1:`blue.300`,chart2:`blue.500`,chart3:`blue.600`,chart4:`blue.700`,chart5:`blue.800`}},indigo:{light:{primary:`indigo.500`,ring:`indigo.400`,chart1:`indigo.300`,chart2:`indigo.500`,chart3:`indigo.600`,chart4:`indigo.700`,chart5:`indigo.800`},dark:{primary:`indigo.500`,ring:`indigo.900`,chart1:`indigo.300`,chart2:`indigo.500`,chart3:`indigo.600`,chart4:`indigo.700`,chart5:`indigo.800`}},violet:{light:{primary:`violet.500`,ring:`violet.400`,chart1:`violet.300`,chart2:`violet.500`,chart3:`violet.600`,chart4:`violet.700`,chart5:`violet.800`},dark:{primary:`violet.500`,ring:`violet.900`,chart1:`violet.300`,chart2:`violet.500`,chart3:`violet.600`,chart4:`violet.700`,chart5:`violet.800`}},purple:{light:{primary:`purple.500`,ring:`purple.400`,chart1:`purple.300`,chart2:`purple.500`,chart3:`purple.600`,chart4:`purple.700`,chart5:`purple.800`},dark:{primary:`purple.500`,ring:`purple.900`,chart1:`purple.300`,chart2:`purple.500`,chart3:`purple.600`,chart4:`purple.700`,chart5:`purple.800`}},fuchsia:{light:{primary:`fuchsia.500`,ring:`fuchsia.400`,chart1:`fuchsia.300`,chart2:`fuchsia.500`,chart3:`fuchsia.600`,chart4:`fuchsia.700`,chart5:`fuchsia.800`},dark:{primary:`fuchsia.500`,ring:`fuchsia.900`,chart1:`fuchsia.300`,chart2:`fuchsia.500`,chart3:`fuchsia.600`,chart4:`fuchsia.700`,chart5:`fuchsia.800`}},pink:{light:{primary:`pink.500`,ring:`pink.400`,chart1:`pink.300`,chart2:`pink.500`,chart3:`pink.600`,chart4:`pink.700`,chart5:`pink.800`},dark:{primary:`pink.500`,ring:`pink.900`,chart1:`pink.300`,chart2:`pink.500`,chart3:`pink.600`,chart4:`pink.700`,chart5:`pink.800`}},rose:{light:{primary:`rose.500`,ring:`rose.400`,chart1:`rose.300`,chart2:`rose.500`,chart3:`rose.600`,chart4:`rose.700`,chart5:`rose.800`},dark:{primary:`rose.500`,ring:`rose.900`,chart1:`rose.300`,chart2:`rose.500`,chart3:`rose.600`,chart4:`rose.700`,chart5:`rose.800`}}},v={classic:{light:{destructive:`red.500`,success:`green.500`,warning:`yellow.500`,info:`blue.500`},dark:{destructive:`red.400`,success:`green.400`,warning:`yellow.400`,info:`blue.400`}},vivid:{light:{destructive:`red.500`,success:`emerald.500`,warning:`amber.500`,info:`sky.500`},dark:{destructive:`red.400`,success:`emerald.400`,warning:`amber.400`,info:`sky.400`}},subtle:{light:{destructive:`rose.500`,success:`emerald.600`,warning:`amber.600`,info:`indigo.600`},dark:{destructive:`rose.300`,success:`emerald.300`,warning:`amber.300`,info:`indigo.300`}},warm:{light:{destructive:`red.600`,success:`lime.600`,warning:`orange.600`,info:`amber.700`},dark:{destructive:`red.400`,success:`lime.400`,warning:`orange.400`,info:`amber.400`}},cool:{light:{destructive:`rose.600`,success:`teal.600`,warning:`cyan.700`,info:`blue.600`},dark:{destructive:`rose.400`,success:`teal.400`,warning:`cyan.400`,info:`blue.400`}},nature:{light:{destructive:`red.700`,success:`green.700`,warning:`lime.700`,info:`teal.700`},dark:{destructive:`red.300`,success:`green.300`,warning:`lime.300`,info:`teal.300`}},modern:{light:{destructive:`rose.600`,success:`emerald.600`,warning:`orange.600`,info:`sky.600`},dark:{destructive:`rose.400`,success:`emerald.400`,warning:`orange.400`,info:`sky.400`}},vibrant:{light:{destructive:`pink.600`,success:`lime.600`,warning:`amber.600`,info:`cyan.600`},dark:{destructive:`pink.400`,success:`lime.400`,warning:`amber.400`,info:`cyan.400`}},professional:{light:{destructive:`red.700`,success:`green.700`,warning:`amber.700`,info:`blue.700`},dark:{destructive:`red.300`,success:`green.300`,warning:`amber.300`,info:`blue.300`}},soft:{light:{destructive:`rose.500`,success:`teal.500`,warning:`yellow.500`,info:`violet.500`},dark:{destructive:`rose.300`,success:`teal.300`,warning:`yellow.300`,info:`violet.300`}},bold:{light:{destructive:`red.700`,success:`emerald.700`,warning:`orange.700`,info:`blue.700`},dark:{destructive:`red.300`,success:`emerald.300`,warning:`orange.300`,info:`blue.300`}},calm:{light:{destructive:`rose.600`,success:`teal.600`,warning:`amber.600`,info:`slate.600`},dark:{destructive:`rose.400`,success:`teal.400`,warning:`amber.400`,info:`slate.400`}},candy:{light:{destructive:`pink.500`,success:`emerald.500`,warning:`yellow.500`,info:`sky.500`},dark:{destructive:`pink.300`,success:`emerald.300`,warning:`yellow.300`,info:`sky.300`}},deep:{light:{destructive:`red.800`,success:`green.800`,warning:`amber.800`,info:`blue.800`},dark:{destructive:`red.200`,success:`green.200`,warning:`amber.200`,info:`blue.200`}},light:{light:{destructive:`red.500`,success:`emerald.500`,warning:`amber.500`,info:`sky.500`},dark:{destructive:`red.400`,success:`emerald.400`,warning:`amber.400`,info:`sky.400`}}},y=i(g),b=i(_),x=i(v);function S(e,t){let n,r,i,a;if(t){let e=w(t);n=e.base,r=e.primary,i=e.feedback,a=e.sidebar}else{let{base:t,primary:o,feedback:s}=e;n=g[t],r=_[o],i=v[s],a=C(n,r)}return{light:{...n.light,...r.light,...i.light,...a.light},dark:{...n.dark,...r.dark,...i.dark,...a.dark}}}function C(e,t){return{light:{sidebar:e.light.background,sidebarForeground:e.light.foreground,sidebarPrimary:t.light.primary,sidebarPrimaryForeground:e.light.primaryForeground,sidebarAccent:e.light.accent,sidebarAccentForeground:e.light.accentForeground,sidebarBorder:e.light.border,sidebarRing:t.light.ring},dark:{sidebar:e.dark.card,sidebarForeground:e.dark.foreground,sidebarPrimary:t.dark.primary,sidebarPrimaryForeground:e.dark.primaryForeground,sidebarAccent:e.dark.accent,sidebarAccentForeground:e.dark.accentForeground,sidebarBorder:e.dark.border,sidebarRing:t.dark.ring}}}function w(e){let{light:t,dark:n}=e;return{base:{light:{background:t.background,foreground:t.background,card:t.background,cardForeground:t.background,popover:t.background,popoverForeground:t.background,primaryForeground:t.background,secondary:t.background,secondaryForeground:t.background,muted:t.background,mutedForeground:t.background,accent:t.background,accentForeground:t.background,destructiveForeground:t.background,successForeground:t.background,warningForeground:t.background,infoForeground:t.background,carbon:t.background,carbonForeground:t.background,border:t.background,input:t.background},dark:{background:n.background,foreground:n.background,card:n.background,cardForeground:n.background,popover:n.background,popoverForeground:n.background,primaryForeground:n.background,secondary:n.background,secondaryForeground:n.background,muted:n.background,mutedForeground:n.background,accent:n.background,accentForeground:n.background,destructiveForeground:n.background,successForeground:n.background,warningForeground:n.background,infoForeground:n.background,carbon:n.background,carbonForeground:n.background,border:n.background,input:n.background}},primary:{light:{primary:t.primary,ring:t.ring,chart1:t.chart1,chart2:t.chart2,chart3:t.chart3,chart4:t.chart4,chart5:t.chart5},dark:{primary:n.primary,ring:n.ring,chart1:n.chart1,chart2:n.chart2,chart3:n.chart3,chart4:n.chart4,chart5:n.chart5}},feedback:{light:{destructive:t.destructive,success:t.success,warning:t.warning,info:t.info},dark:{destructive:n.destructive,success:n.success,warning:n.warning,info:n.info}},sidebar:{light:{sidebar:t.sidebar,sidebarForeground:t.sidebarForeground,sidebarPrimary:t.sidebarPrimary,sidebarPrimaryForeground:t.sidebarPrimaryForeground,sidebarAccent:t.sidebarAccent,sidebarAccentForeground:t.sidebarAccentForeground,sidebarBorder:t.sidebarBorder,sidebarRing:t.sidebarRing},dark:{sidebar:n.sidebar,sidebarForeground:n.sidebarForeground,sidebarPrimary:n.sidebarPrimary,sidebarPrimaryForeground:n.sidebarPrimaryForeground,sidebarAccent:n.sidebarAccent,sidebarAccentForeground:n.sidebarAccentForeground,sidebarBorder:n.sidebarBorder,sidebarRing:n.sidebarRing}}}}function T(e,t){let{light:n,dark:r}=e,{format:a,styleTarget:o}=t,s=``,c=``;i(u).forEach(e=>{s+=D(e,a,n),c+=D(e,a,r)});let l=k(n,a),d=`${o} {\n${s}\n${l}\n}`,f=t.darkSelector;return(f===`class`||f===`media`)&&(f=p[f]),d+=`\n\n${f} {\n${c}\n}`,d}function E(e,t=`:root`){return`${t} {\n--radius: ${e};\n}`}function D(e,t,n){let r=c(n[e],t);t===`hsl`&&(r=o(r));let{color:i,alphaCss:a}=O(r,t,e);r=i;let s=`${u[e]}: ${r};\n`;return s+=a,s}function O(e,t,n){if(s(e)||t===`oklch`||![`border`,`input`,`sidebarBorder`].includes(n))return{color:e,alphaCss:``};let[r,i=`1`]=e.split(`/`);r=r.trim(),i=i.trim();let a=Number.parseFloat(i);i.endsWith(`%`)&&(a/=100);let o=``;return n===`border`&&(o=`${d.borderAlpha}: ${a};\n`),n===`input`&&(o+=`${d.inputAlpha}: ${a};\n`),n===`sidebarBorder`&&(o+=`${d.sidebarBorderAlpha}: ${a};\n`),{color:r,alphaCss:o}}function k(e,n){let r=[`primary`,`destructive`,`success`,`warning`,`info`,`carbon`],a=``;return r.forEach(r=>{let s=t(c(e[r],n),n===`hsl`?`hslString`:`oklchString`);i(s).forEach(e=>{let t=s[e];n===`hsl`&&(t=o(t)),a+=`--${r}-${e}: ${t};\n`})}),a}function A(e){let{base:t=f.base,primary:n=f.primary,feedback:r=f.feedback,sidebar:i=`extended`,preset:a,radius:o=`0.625rem`,styleTarget:s=`:root`,darkSelector:c=`class`,format:u=`hsl`}=e||{},d=new Map,p=e=>{let o={base:e?.base??t,primary:e?.primary??n,feedback:e?.feedback??r,sidebar:e?.sidebar??i},f=l(o);if(d.has(f))return d.get(f);let p=T(S(o,e?.preset??a),{styleTarget:s,darkSelector:c,format:u});return d.set(f,p),p},m=e=>E(e??o,s);return{getCss:(e,t)=>`${m(t??o)}\n\n${p(e)}`,getColorCss:p,getRadiusCss:m}}export{g as builtinBasePreset,y as builtinBasePresetKeys,v as builtinFeedbackPreset,x as builtinFeedbackPresetKeys,_ as builtinPrimaryPreset,b as builtinPrimaryPresetKeys,A as createShadcnTheme};
1
+ import{colord as e}from"@soybeanjs/colord";import{generatePalette as t,simplePalette as n,tailwindPalette as r}from"@soybeanjs/colord/palette";function i(e){return Object.keys(e)}function a(e){return!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`)}function o(e){return e.replace(/hsl\(/g,``).replace(/\)/g,``)}const s=e=>[`inherit`,`currentColor`,`transparent`].includes(e);function c(t,i){let o=t;if(s(t))return o;if(t===`black`)return n.black[i];if(t===`white`)return n.white[i];if(a(t)){let[e,n]=t.split(`.`);o=r[e][n][i]}else i===`hsl`&&t.startsWith(`oklch(`)&&(o=e(t).toHslString()),i===`oklch`&&t.startsWith(`hsl(`)&&(o=e(t).toOklchString());return o}function l(e){let{base:t,primary:n,feedback:r,sidebar:i}=e;return`base:${t};primary:${n};feedback:${r};sidebar:${i}`}const u={background:`--background`,foreground:`--foreground`,card:`--card`,cardForeground:`--card-foreground`,popover:`--popover`,popoverForeground:`--popover-foreground`,primary:`--primary`,primaryForeground:`--primary-foreground`,secondary:`--secondary`,secondaryForeground:`--secondary-foreground`,muted:`--muted`,mutedForeground:`--muted-foreground`,accent:`--accent`,accentForeground:`--accent-foreground`,destructive:`--destructive`,destructiveForeground:`--destructive-foreground`,border:`--border`,input:`--input`,ring:`--ring`,success:`--success`,successForeground:`--success-foreground`,warning:`--warning`,warningForeground:`--warning-foreground`,info:`--info`,infoForeground:`--info-foreground`,carbon:`--carbon`,carbonForeground:`--carbon-foreground`,sidebar:`--sidebar`,sidebarForeground:`--sidebar-foreground`,sidebarPrimary:`--sidebar-primary`,sidebarPrimaryForeground:`--sidebar-primary-foreground`,sidebarAccent:`--sidebar-accent`,sidebarAccentForeground:`--sidebar-accent-foreground`,sidebarBorder:`--sidebar-border`,sidebarRing:`--sidebar-ring`,chart1:`--chart-1`,chart2:`--chart-2`,chart3:`--chart-3`,chart4:`--chart-4`,chart5:`--chart-5`},d={borderAlpha:`--border-alpha`,inputAlpha:`--input-alpha`,sidebarBorderAlpha:`--sidebar-border-alpha`},f={base:`neutral`,primary:`indigo`,feedback:`classic`},p={class:`.dark`,media:`@media (prefers-color-scheme: dark)`},m=`oklch(100% 0 0 / 0.1)`,h=`oklch(100% 0 0 / 0.15)`,g={stone:{light:{background:`white`,foreground:`stone.950`,card:`white`,cardForeground:`stone.950`,popover:`white`,popoverForeground:`stone.950`,primaryForeground:`stone.50`,secondary:`stone.100`,secondaryForeground:`stone.900`,muted:`stone.100`,mutedForeground:`stone.500`,accent:`stone.100`,accentForeground:`stone.900`,destructiveForeground:`stone.50`,successForeground:`stone.50`,warningForeground:`stone.50`,infoForeground:`stone.50`,carbon:`stone.800`,carbonForeground:`stone.50`,border:`stone.200`,input:`stone.200`},dark:{background:`stone.950`,foreground:`stone.50`,card:`stone.900`,cardForeground:`stone.50`,popover:`stone.900`,popoverForeground:`stone.50`,primaryForeground:`stone.900`,secondary:`stone.800`,secondaryForeground:`stone.50`,muted:`stone.800`,mutedForeground:`stone.400`,accent:`stone.800`,accentForeground:`stone.50`,destructiveForeground:`stone.900`,successForeground:`stone.900`,warningForeground:`stone.900`,infoForeground:`stone.900`,carbon:`stone.100`,carbonForeground:`stone.900`,border:m,input:h}},zinc:{light:{background:`white`,foreground:`zinc.950`,card:`white`,cardForeground:`zinc.950`,popover:`white`,popoverForeground:`zinc.950`,primaryForeground:`zinc.50`,secondary:`zinc.100`,secondaryForeground:`zinc.900`,muted:`zinc.100`,mutedForeground:`zinc.500`,accent:`zinc.100`,accentForeground:`zinc.900`,destructiveForeground:`zinc.50`,successForeground:`zinc.50`,warningForeground:`zinc.50`,infoForeground:`zinc.50`,carbon:`zinc.800`,carbonForeground:`zinc.50`,border:`zinc.200`,input:`zinc.200`},dark:{background:`zinc.950`,foreground:`zinc.50`,card:`zinc.900`,cardForeground:`zinc.50`,popover:`zinc.900`,popoverForeground:`zinc.50`,primaryForeground:`zinc.900`,secondary:`zinc.800`,secondaryForeground:`zinc.50`,muted:`zinc.800`,mutedForeground:`zinc.400`,accent:`zinc.800`,accentForeground:`zinc.50`,destructiveForeground:`zinc.900`,successForeground:`zinc.900`,warningForeground:`zinc.900`,infoForeground:`zinc.900`,carbon:`zinc.100`,carbonForeground:`zinc.900`,border:m,input:h}},neutral:{light:{background:`white`,foreground:`neutral.950`,card:`white`,cardForeground:`neutral.950`,popover:`white`,popoverForeground:`neutral.950`,primaryForeground:`neutral.50`,secondary:`neutral.100`,secondaryForeground:`neutral.900`,muted:`neutral.100`,mutedForeground:`neutral.500`,accent:`neutral.100`,accentForeground:`neutral.900`,destructiveForeground:`neutral.50`,successForeground:`neutral.50`,warningForeground:`neutral.50`,infoForeground:`neutral.50`,carbon:`neutral.800`,carbonForeground:`neutral.50`,border:`neutral.200`,input:`neutral.200`},dark:{background:`neutral.950`,foreground:`neutral.50`,card:`neutral.900`,cardForeground:`neutral.50`,popover:`neutral.900`,popoverForeground:`neutral.50`,primaryForeground:`neutral.900`,secondary:`neutral.800`,secondaryForeground:`neutral.50`,muted:`neutral.800`,mutedForeground:`neutral.400`,accent:`neutral.800`,accentForeground:`neutral.50`,destructiveForeground:`neutral.900`,successForeground:`neutral.900`,warningForeground:`neutral.900`,infoForeground:`neutral.900`,carbon:`neutral.100`,carbonForeground:`neutral.900`,border:m,input:h}},gray:{light:{background:`white`,foreground:`gray.950`,card:`white`,cardForeground:`gray.950`,popover:`white`,popoverForeground:`gray.950`,primaryForeground:`gray.50`,secondary:`gray.100`,secondaryForeground:`gray.900`,muted:`gray.100`,mutedForeground:`gray.500`,accent:`gray.100`,accentForeground:`gray.900`,carbon:`gray.800`,destructiveForeground:`gray.50`,successForeground:`gray.50`,warningForeground:`gray.50`,infoForeground:`gray.50`,carbonForeground:`gray.50`,border:`gray.200`,input:`gray.200`},dark:{background:`gray.950`,foreground:`gray.50`,card:`gray.900`,cardForeground:`gray.50`,popover:`gray.900`,popoverForeground:`gray.50`,primaryForeground:`gray.900`,secondary:`gray.800`,secondaryForeground:`gray.50`,muted:`gray.800`,mutedForeground:`gray.400`,accent:`gray.800`,accentForeground:`gray.50`,carbon:`gray.100`,destructiveForeground:`gray.900`,successForeground:`gray.900`,warningForeground:`gray.900`,infoForeground:`gray.900`,carbonForeground:`gray.900`,border:m,input:h}},slate:{light:{background:`white`,foreground:`slate.950`,card:`white`,cardForeground:`slate.950`,popover:`white`,popoverForeground:`slate.950`,primaryForeground:`slate.50`,secondary:`slate.100`,secondaryForeground:`slate.900`,muted:`slate.100`,mutedForeground:`slate.500`,accent:`slate.100`,accentForeground:`slate.900`,destructiveForeground:`slate.50`,successForeground:`slate.50`,warningForeground:`slate.50`,infoForeground:`slate.50`,carbon:`slate.800`,carbonForeground:`slate.50`,border:`slate.200`,input:`slate.200`},dark:{background:`slate.950`,foreground:`slate.50`,card:`slate.900`,cardForeground:`slate.50`,popover:`slate.900`,popoverForeground:`slate.50`,primaryForeground:`slate.900`,secondary:`slate.800`,secondaryForeground:`slate.50`,muted:`slate.800`,mutedForeground:`slate.400`,accent:`slate.800`,accentForeground:`slate.50`,carbon:`slate.100`,destructiveForeground:`slate.900`,successForeground:`slate.900`,warningForeground:`slate.900`,infoForeground:`slate.900`,carbonForeground:`slate.900`,border:m,input:h}}},_={stone:{light:{primary:`stone.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`stone.200`,ring:`stone.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},zinc:{light:{primary:`zinc.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`zinc.200`,ring:`zinc.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},neutral:{light:{primary:`neutral.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`neutral.200`,ring:`neutral.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},gray:{light:{primary:`gray.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`gray.200`,ring:`gray.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},slate:{light:{primary:`slate.800`,ring:`stone.400`,chart1:`orange.600`,chart2:`teal.600`,chart3:`cyan.900`,chart4:`amber.400`,chart5:`amber.500`},dark:{primary:`slate.200`,ring:`slate.500`,chart1:`blue.700`,chart2:`emerald.500`,chart3:`amber.500`,chart4:`purple.500`,chart5:`rose.500`}},red:{light:{primary:`red.500`,ring:`red.400`,chart1:`red.300`,chart2:`red.500`,chart3:`red.600`,chart4:`red.700`,chart5:`red.800`},dark:{primary:`red.500`,ring:`red.900`,chart1:`red.300`,chart2:`red.500`,chart3:`red.600`,chart4:`red.700`,chart5:`red.800`}},orange:{light:{primary:`orange.500`,ring:`orange.400`,chart1:`orange.300`,chart2:`orange.500`,chart3:`orange.600`,chart4:`orange.700`,chart5:`orange.800`},dark:{primary:`orange.500`,ring:`orange.900`,chart1:`orange.300`,chart2:`orange.500`,chart3:`orange.600`,chart4:`orange.700`,chart5:`orange.800`}},amber:{light:{primary:`amber.500`,ring:`amber.400`,chart1:`amber.300`,chart2:`amber.500`,chart3:`amber.600`,chart4:`amber.700`,chart5:`amber.800`},dark:{primary:`amber.500`,ring:`amber.900`,chart1:`amber.300`,chart2:`amber.500`,chart3:`amber.600`,chart4:`amber.700`,chart5:`amber.800`}},yellow:{light:{primary:`yellow.500`,ring:`yellow.400`,chart1:`yellow.300`,chart2:`yellow.500`,chart3:`yellow.600`,chart4:`yellow.700`,chart5:`yellow.800`},dark:{primary:`yellow.500`,ring:`yellow.900`,chart1:`yellow.300`,chart2:`yellow.500`,chart3:`yellow.600`,chart4:`yellow.700`,chart5:`yellow.800`}},lime:{light:{primary:`lime.500`,ring:`lime.400`,chart1:`lime.300`,chart2:`lime.500`,chart3:`lime.600`,chart4:`lime.700`,chart5:`lime.800`},dark:{primary:`lime.600`,ring:`lime.900`,chart1:`lime.300`,chart2:`lime.500`,chart3:`lime.600`,chart4:`lime.700`,chart5:`lime.800`}},green:{light:{primary:`green.500`,ring:`green.400`,chart1:`green.300`,chart2:`green.500`,chart3:`green.600`,chart4:`green.700`,chart5:`green.800`},dark:{primary:`green.600`,ring:`green.900`,chart1:`green.300`,chart2:`green.500`,chart3:`green.600`,chart4:`green.700`,chart5:`green.800`}},emerald:{light:{primary:`emerald.500`,ring:`emerald.400`,chart1:`emerald.300`,chart2:`emerald.500`,chart3:`emerald.600`,chart4:`emerald.700`,chart5:`emerald.800`},dark:{primary:`emerald.600`,ring:`emerald.900`,chart1:`emerald.300`,chart2:`emerald.500`,chart3:`emerald.600`,chart4:`emerald.700`,chart5:`emerald.800`}},teal:{light:{primary:`teal.500`,ring:`teal.400`,chart1:`teal.300`,chart2:`teal.500`,chart3:`teal.600`,chart4:`teal.700`,chart5:`teal.800`},dark:{primary:`teal.500`,ring:`teal.900`,chart1:`teal.300`,chart2:`teal.500`,chart3:`teal.600`,chart4:`teal.700`,chart5:`teal.800`}},cyan:{light:{primary:`cyan.500`,ring:`cyan.400`,chart1:`cyan.300`,chart2:`cyan.500`,chart3:`cyan.600`,chart4:`cyan.700`,chart5:`cyan.800`},dark:{primary:`cyan.500`,ring:`cyan.900`,chart1:`cyan.300`,chart2:`cyan.500`,chart3:`cyan.600`,chart4:`cyan.700`,chart5:`cyan.800`}},sky:{light:{primary:`sky.500`,ring:`sky.400`,chart1:`sky.300`,chart2:`sky.500`,chart3:`sky.600`,chart4:`sky.700`,chart5:`sky.800`},dark:{primary:`sky.500`,ring:`sky.900`,chart1:`sky.300`,chart2:`sky.500`,chart3:`sky.600`,chart4:`sky.700`,chart5:`sky.800`}},blue:{light:{primary:`blue.500`,ring:`blue.400`,chart1:`blue.300`,chart2:`blue.500`,chart3:`blue.600`,chart4:`blue.700`,chart5:`blue.800`},dark:{primary:`blue.500`,ring:`blue.900`,chart1:`blue.300`,chart2:`blue.500`,chart3:`blue.600`,chart4:`blue.700`,chart5:`blue.800`}},indigo:{light:{primary:`indigo.500`,ring:`indigo.400`,chart1:`indigo.300`,chart2:`indigo.500`,chart3:`indigo.600`,chart4:`indigo.700`,chart5:`indigo.800`},dark:{primary:`indigo.500`,ring:`indigo.900`,chart1:`indigo.300`,chart2:`indigo.500`,chart3:`indigo.600`,chart4:`indigo.700`,chart5:`indigo.800`}},violet:{light:{primary:`violet.500`,ring:`violet.400`,chart1:`violet.300`,chart2:`violet.500`,chart3:`violet.600`,chart4:`violet.700`,chart5:`violet.800`},dark:{primary:`violet.500`,ring:`violet.900`,chart1:`violet.300`,chart2:`violet.500`,chart3:`violet.600`,chart4:`violet.700`,chart5:`violet.800`}},purple:{light:{primary:`purple.500`,ring:`purple.400`,chart1:`purple.300`,chart2:`purple.500`,chart3:`purple.600`,chart4:`purple.700`,chart5:`purple.800`},dark:{primary:`purple.500`,ring:`purple.900`,chart1:`purple.300`,chart2:`purple.500`,chart3:`purple.600`,chart4:`purple.700`,chart5:`purple.800`}},fuchsia:{light:{primary:`fuchsia.500`,ring:`fuchsia.400`,chart1:`fuchsia.300`,chart2:`fuchsia.500`,chart3:`fuchsia.600`,chart4:`fuchsia.700`,chart5:`fuchsia.800`},dark:{primary:`fuchsia.500`,ring:`fuchsia.900`,chart1:`fuchsia.300`,chart2:`fuchsia.500`,chart3:`fuchsia.600`,chart4:`fuchsia.700`,chart5:`fuchsia.800`}},pink:{light:{primary:`pink.500`,ring:`pink.400`,chart1:`pink.300`,chart2:`pink.500`,chart3:`pink.600`,chart4:`pink.700`,chart5:`pink.800`},dark:{primary:`pink.500`,ring:`pink.900`,chart1:`pink.300`,chart2:`pink.500`,chart3:`pink.600`,chart4:`pink.700`,chart5:`pink.800`}},rose:{light:{primary:`rose.500`,ring:`rose.400`,chart1:`rose.300`,chart2:`rose.500`,chart3:`rose.600`,chart4:`rose.700`,chart5:`rose.800`},dark:{primary:`rose.500`,ring:`rose.900`,chart1:`rose.300`,chart2:`rose.500`,chart3:`rose.600`,chart4:`rose.700`,chart5:`rose.800`}}},v={classic:{light:{destructive:`red.500`,success:`green.500`,warning:`amber.500`,info:`blue.500`},dark:{destructive:`red.400`,success:`green.400`,warning:`amber.400`,info:`blue.400`}},vivid:{light:{destructive:`red.500`,success:`emerald.500`,warning:`amber.500`,info:`sky.500`},dark:{destructive:`red.400`,success:`emerald.400`,warning:`amber.400`,info:`sky.400`}},subtle:{light:{destructive:`rose.500`,success:`emerald.500`,warning:`amber.500`,info:`indigo.500`},dark:{destructive:`rose.300`,success:`emerald.300`,warning:`amber.300`,info:`indigo.300`}},warm:{light:{destructive:`red.500`,success:`lime.500`,warning:`orange.500`,info:`amber.600`},dark:{destructive:`red.400`,success:`lime.400`,warning:`orange.400`,info:`amber.400`}},cool:{light:{destructive:`rose.500`,success:`teal.500`,warning:`cyan.600`,info:`blue.500`},dark:{destructive:`rose.400`,success:`teal.400`,warning:`cyan.400`,info:`blue.400`}},nature:{light:{destructive:`red.500`,success:`green.600`,warning:`lime.600`,info:`teal.600`},dark:{destructive:`red.300`,success:`green.300`,warning:`lime.300`,info:`teal.300`}},modern:{light:{destructive:`red.500`,success:`emerald.500`,warning:`orange.500`,info:`sky.500`},dark:{destructive:`red.400`,success:`emerald.400`,warning:`orange.400`,info:`sky.400`}},vibrant:{light:{destructive:`red.500`,success:`lime.500`,warning:`amber.500`,info:`cyan.500`},dark:{destructive:`pink.400`,success:`lime.400`,warning:`amber.400`,info:`cyan.400`}},professional:{light:{destructive:`red.500`,success:`green.600`,warning:`amber.600`,info:`blue.600`},dark:{destructive:`red.300`,success:`green.300`,warning:`amber.300`,info:`blue.300`}},soft:{light:{destructive:`rose.400`,success:`teal.400`,warning:`yellow.400`,info:`violet.400`},dark:{destructive:`rose.300`,success:`teal.300`,warning:`yellow.300`,info:`violet.300`}},bold:{light:{destructive:`red.600`,success:`emerald.600`,warning:`orange.600`,info:`blue.600`},dark:{destructive:`red.300`,success:`emerald.300`,warning:`orange.300`,info:`blue.300`}},calm:{light:{destructive:`rose.500`,success:`teal.500`,warning:`amber.500`,info:`slate.500`},dark:{destructive:`rose.400`,success:`teal.400`,warning:`amber.400`,info:`slate.400`}},candy:{light:{destructive:`pink.400`,success:`emerald.400`,warning:`yellow.400`,info:`sky.400`},dark:{destructive:`pink.300`,success:`emerald.300`,warning:`yellow.300`,info:`sky.300`}},deep:{light:{destructive:`red.600`,success:`green.700`,warning:`amber.700`,info:`blue.700`},dark:{destructive:`red.200`,success:`green.200`,warning:`amber.200`,info:`blue.200`}},light:{light:{destructive:`red.400`,success:`emerald.400`,warning:`amber.400`,info:`sky.400`},dark:{destructive:`red.400`,success:`emerald.400`,warning:`amber.400`,info:`sky.400`}}},y=i(g),b=i(_),x=i(v);function S(e,t){let n,r,i,a;if(t){let e=w(t);n=e.base,r=e.primary,i=e.feedback,a=e.sidebar}else{let{base:t,primary:o,feedback:s}=e;n=g[t],r=_[o],i=v[s],a=C(n,r)}return{light:{...n.light,...r.light,...i.light,...a.light},dark:{...n.dark,...r.dark,...i.dark,...a.dark}}}function C(e,t){return{light:{sidebar:e.light.background,sidebarForeground:e.light.foreground,sidebarPrimary:t.light.primary,sidebarPrimaryForeground:e.light.primaryForeground,sidebarAccent:e.light.accent,sidebarAccentForeground:e.light.accentForeground,sidebarBorder:e.light.border,sidebarRing:t.light.ring},dark:{sidebar:e.dark.card,sidebarForeground:e.dark.foreground,sidebarPrimary:t.dark.primary,sidebarPrimaryForeground:e.dark.primaryForeground,sidebarAccent:e.dark.accent,sidebarAccentForeground:e.dark.accentForeground,sidebarBorder:e.dark.border,sidebarRing:t.dark.ring}}}function w(e){let{light:t,dark:n}=e;return{base:{light:{background:t.background,foreground:t.background,card:t.background,cardForeground:t.background,popover:t.background,popoverForeground:t.background,primaryForeground:t.background,secondary:t.background,secondaryForeground:t.background,muted:t.background,mutedForeground:t.background,accent:t.background,accentForeground:t.background,destructiveForeground:t.background,successForeground:t.background,warningForeground:t.background,infoForeground:t.background,carbon:t.background,carbonForeground:t.background,border:t.background,input:t.background},dark:{background:n.background,foreground:n.background,card:n.background,cardForeground:n.background,popover:n.background,popoverForeground:n.background,primaryForeground:n.background,secondary:n.background,secondaryForeground:n.background,muted:n.background,mutedForeground:n.background,accent:n.background,accentForeground:n.background,destructiveForeground:n.background,successForeground:n.background,warningForeground:n.background,infoForeground:n.background,carbon:n.background,carbonForeground:n.background,border:n.background,input:n.background}},primary:{light:{primary:t.primary,ring:t.ring,chart1:t.chart1,chart2:t.chart2,chart3:t.chart3,chart4:t.chart4,chart5:t.chart5},dark:{primary:n.primary,ring:n.ring,chart1:n.chart1,chart2:n.chart2,chart3:n.chart3,chart4:n.chart4,chart5:n.chart5}},feedback:{light:{destructive:t.destructive,success:t.success,warning:t.warning,info:t.info},dark:{destructive:n.destructive,success:n.success,warning:n.warning,info:n.info}},sidebar:{light:{sidebar:t.sidebar,sidebarForeground:t.sidebarForeground,sidebarPrimary:t.sidebarPrimary,sidebarPrimaryForeground:t.sidebarPrimaryForeground,sidebarAccent:t.sidebarAccent,sidebarAccentForeground:t.sidebarAccentForeground,sidebarBorder:t.sidebarBorder,sidebarRing:t.sidebarRing},dark:{sidebar:n.sidebar,sidebarForeground:n.sidebarForeground,sidebarPrimary:n.sidebarPrimary,sidebarPrimaryForeground:n.sidebarPrimaryForeground,sidebarAccent:n.sidebarAccent,sidebarAccentForeground:n.sidebarAccentForeground,sidebarBorder:n.sidebarBorder,sidebarRing:n.sidebarRing}}}}function T(e,t){let{light:n,dark:r}=e,{format:a,styleTarget:o}=t,s=``,c=``;i(u).forEach(e=>{s+=D(e,a,n),c+=D(e,a,r)});let l=k(n,a),d=`${o} {\n${s}\n${l}\n}`,f=t.darkSelector;(f===`class`||f===`media`)&&(f=p[f]);let m=k(r,a);return d+=`\n\n${f} {\n${c}\n${m}\n}`,d}function E(e,t=`:root`){return`${t} {\n--radius: ${e};\n}`}function D(e,t,n){let r=c(n[e],t);t===`hsl`&&(r=o(r));let{color:i,alphaCss:a}=O(r,t,e);r=i;let s=`${u[e]}: ${r};\n`;return s+=a,s}function O(e,t,n){if(s(e)||t===`oklch`||![`border`,`input`,`sidebarBorder`].includes(n))return{color:e,alphaCss:``};let[r,i=`1`]=e.split(`/`);r=r.trim(),i=i.trim();let a=Number.parseFloat(i);i.endsWith(`%`)&&(a/=100);let o=``;return n===`border`&&(o=`${d.borderAlpha}: ${a};\n`),n===`input`&&(o+=`${d.inputAlpha}: ${a};\n`),n===`sidebarBorder`&&(o+=`${d.sidebarBorderAlpha}: ${a};\n`),{color:r,alphaCss:o}}function k(e,n){let r=[`primary`,`destructive`,`success`,`warning`,`info`,`carbon`],a=``;return r.forEach(r=>{let s=t(c(e[r],n),n===`hsl`?`hslString`:`oklchString`);i(s).forEach(e=>{let t=s[e];n===`hsl`&&(t=o(t)),a+=`--${r}-${e}: ${t};\n`})}),a}function A(e){let{base:t=f.base,primary:n=f.primary,feedback:r=f.feedback,sidebar:i=`extended`,preset:a,radius:o=`0.625rem`,styleTarget:s=`:root`,darkSelector:c=`class`,format:u=`hsl`}=e||{},d=new Map,p=e=>{let o={base:e?.base??t,primary:e?.primary??n,feedback:e?.feedback??r,sidebar:e?.sidebar??i},f=l(o);if(d.has(f))return d.get(f);let p=T(S(o,e?.preset??a),{styleTarget:s,darkSelector:c,format:u});return d.set(f,p),p},m=e=>E(e??o,s);return{getCss:(e,t)=>`${m(t??o)}\n\n${p(e)}`,getColorCss:p,getRadiusCss:m}}export{g as builtinBasePreset,y as builtinBasePresetKeys,v as builtinFeedbackPreset,x as builtinFeedbackPresetKeys,_ as builtinPrimaryPreset,b as builtinPrimaryPresetKeys,A as createShadcnTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/shadcn-theme",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A powerful and flexible shadcn/ui theme generator with support for dynamic CSS variable injection, preset color schemes, and light/dark mode switching.",
5
5
  "homepage": "https://github.com/soybeanjs/shadcn-theme",
6
6
  "bugs": {