shadcn 4.13.0 → 4.13.1

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.
package/dist/mcp/index.js CHANGED
@@ -1 +1 @@
1
- export{a as server}from'../chunk-AHVD7OOC.js';import'../chunk-G7PLOKI6.js';import'../chunk-MTWZIHEW.js';import'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';
1
+ export{a as server}from'../chunk-IQSJRLV2.js';import'../chunk-UBIN4IG2.js';import'../chunk-2XFBGS5K.js';import'../chunk-MTWZIHEW.js';import'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';
@@ -1,4 +1,6 @@
1
- declare const PRESET_BASES: readonly ["radix", "base"];
1
+ declare const PRESET_BASES: readonly ["radix", "base", "aria"];
2
+ type PresetBase = (typeof PRESET_BASES)[number];
3
+ declare function isPresetBase(value: unknown): value is PresetBase;
2
4
  declare const PRESET_STYLES: readonly ["nova", "vega", "maia", "lyra", "mira", "luma", "sera", "rhea"];
3
5
  declare const PRESET_BASE_COLORS: readonly ["neutral", "stone", "zinc", "gray", "mauve", "olive", "mist", "taupe"];
4
6
  declare const PRESET_THEMES: readonly ["neutral", "stone", "zinc", "gray", "amber", "blue", "cyan", "emerald", "fuchsia", "green", "indigo", "lime", "orange", "pink", "purple", "red", "rose", "sky", "teal", "violet", "yellow", "mauve", "olive", "mist", "taupe"];
@@ -32,4 +34,4 @@ declare function isValidPreset(code: string): boolean;
32
34
  declare function generateRandomConfig(): PresetConfig;
33
35
  declare function generateRandomPreset(): string;
34
36
 
35
- export { DEFAULT_PRESET_CONFIG, PRESET_BASES, PRESET_BASE_COLORS, PRESET_CHART_COLORS, PRESET_FONTS, PRESET_FONT_HEADINGS, PRESET_ICON_LIBRARIES, PRESET_MENU_ACCENTS, PRESET_MENU_COLORS, PRESET_RADII, PRESET_STYLES, PRESET_THEMES, type PresetConfig, V1_CHART_COLOR_MAP, decodePreset, encodePreset, fromBase62, generateRandomConfig, generateRandomPreset, isPresetCode, isValidPreset, toBase62 };
37
+ export { DEFAULT_PRESET_CONFIG, PRESET_BASES, PRESET_BASE_COLORS, PRESET_CHART_COLORS, PRESET_FONTS, PRESET_FONT_HEADINGS, PRESET_ICON_LIBRARIES, PRESET_MENU_ACCENTS, PRESET_MENU_COLORS, PRESET_RADII, PRESET_STYLES, PRESET_THEMES, type PresetBase, type PresetConfig, V1_CHART_COLOR_MAP, decodePreset, encodePreset, fromBase62, generateRandomConfig, generateRandomPreset, isPresetBase, isPresetCode, isValidPreset, toBase62 };
@@ -1 +1 @@
1
- export{m as DEFAULT_PRESET_CONFIG,a as PRESET_BASES,c as PRESET_BASE_COLORS,e as PRESET_CHART_COLORS,h as PRESET_FONTS,i as PRESET_FONT_HEADINGS,g as PRESET_ICON_LIBRARIES,k as PRESET_MENU_ACCENTS,l as PRESET_MENU_COLORS,j as PRESET_RADII,b as PRESET_STYLES,d as PRESET_THEMES,f as V1_CHART_COLOR_MAP,q as decodePreset,p as encodePreset,o as fromBase62,t as generateRandomConfig,u as generateRandomPreset,r as isPresetCode,s as isValidPreset,n as toBase62}from'../chunk-NUMOKWW5.js';
1
+ export{o as DEFAULT_PRESET_CONFIG,a as PRESET_BASES,e as PRESET_BASE_COLORS,g as PRESET_CHART_COLORS,j as PRESET_FONTS,k as PRESET_FONT_HEADINGS,i as PRESET_ICON_LIBRARIES,m as PRESET_MENU_ACCENTS,n as PRESET_MENU_COLORS,l as PRESET_RADII,d as PRESET_STYLES,f as PRESET_THEMES,h as V1_CHART_COLOR_MAP,s as decodePreset,r as encodePreset,q as fromBase62,v as generateRandomConfig,w as generateRandomPreset,b as isPresetBase,t as isPresetCode,u as isValidPreset,p as toBase62}from'../chunk-2XFBGS5K.js';
@@ -1 +1 @@
1
- export{w as RegistriesIndexParseError,k as RegistryError,j as RegistryErrorCode,o as RegistryFetchError,n as RegistryForbiddenError,v as RegistryInvalidNamespaceError,t as RegistryItemNotFoundError,q as RegistryLocalFileError,u as RegistryMissingEnvironmentVariablesError,p as RegistryNotConfiguredError,l as RegistryNotFoundError,r as RegistryParseError,m as RegistryUnauthorizedError,s as RegistryValidationError,Ba as getRegistries,Ca as getRegistriesIndex,pa as getRegistry,qa as getRegistryItems,Ja as loadRegistry,Ka as loadRegistryItem,ra as resolveRegistryItems,Pa as searchRegistries}from'../chunk-G7PLOKI6.js';import'../chunk-MTWZIHEW.js';import'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';
1
+ export{w as RegistriesIndexParseError,k as RegistryError,j as RegistryErrorCode,o as RegistryFetchError,n as RegistryForbiddenError,v as RegistryInvalidNamespaceError,t as RegistryItemNotFoundError,q as RegistryLocalFileError,u as RegistryMissingEnvironmentVariablesError,p as RegistryNotConfiguredError,l as RegistryNotFoundError,r as RegistryParseError,m as RegistryUnauthorizedError,s as RegistryValidationError,Ba as getRegistries,Ca as getRegistriesIndex,pa as getRegistry,qa as getRegistryItems,Ja as loadRegistry,Ka as loadRegistryItem,ra as resolveRegistryItems,Pa as searchRegistries}from'../chunk-UBIN4IG2.js';import'../chunk-2XFBGS5K.js';import'../chunk-MTWZIHEW.js';import'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';
@@ -1 +1 @@
1
- export{e as transformDirection,f as transformFont,c as transformIcons,g as transformMenu}from'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';import W from'postcss';import D from'postcss-selector-parser';import {z}from'zod';import {Project,ScriptKind,SyntaxKind,Node}from'ts-morph';import {twMerge}from'tailwind-merge';var b="cn-",k=z.record(z.string().startsWith(b),z.string());function B(t){let e=W.parse(t),n={};return e.walkRules(i=>{let r=i.selectors??[];if(r.length===0)return;let o=_(i);if(o)for(let c of r){let f=X(c);D(s=>{s.each(g=>{let l=q(g);if(!l)return;let p=l.value;p.startsWith(b)&&(n[p]=n[p]?`${o} ${n[p]}`:o);});}).processSync(f);}}),k.parse(n)}function X(t){return t.replace(/\s*&\s*/g,"").trim()}function _(t){let e=[];for(let n of t.nodes||[])if(n.type==="atrule"&&n.name==="apply"){let i=n.params.trim();i&&e.push(i);}return e.length===0?null:e.join(" ")}function q(t){let e=[];return t.walkClasses(n=>{n.value.startsWith(b)&&e.push(n);}),e.length===0?null:e[e.length-1]}var C=new Set(["cn-menu-target","cn-menu-translucent","cn-logical-sides","cn-rtl-flip","cn-font-heading"]);function m(t){return Node.isStringLiteral(t)||Node.isNoSubstitutionTemplateLiteral(t)}var w=async({sourceFile:t,styleMap:e})=>{let n=new Set;return H(t,e,n),Q(t,e,n),Z(t,e,n),t};function O(t,e,n){let i=t.getLiteralText(),r=y(i);if(r.length===0)return;let o=r.filter(s=>!n.has(s));if(o.length===0){let s=x(i);t.setLiteralValue(s);return}let f=o.filter(s=>!C.has(s)).map(s=>e[s]).filter(s=>!!s);if(f.length>0){let s=f.join(" "),g=x(h(s,i));t.setLiteralValue(g),o.forEach(l=>n.add(l));}else {let s=x(i);t.setLiteralValue(s);}}function H(t,e,n){t.forEachDescendant(i=>{if(!Node.isCallExpression(i))return;let r=i.getExpression();if(!Node.isIdentifier(r)||r.getText()!=="cva")return;let o=i.getArguments()[0];Node.isStringLiteral(o)&&O(o,e,n);let c=i.getArguments()[1];if(!c||!Node.isObjectLiteralExpression(c))return;let f=c.getProperties().find(g=>Node.isPropertyAssignment(g)&&Node.isIdentifier(g.getNameNode())&&g.getNameNode().getText()==="variants");if(!f||!Node.isPropertyAssignment(f))return;let s=f.getInitializer();!s||!Node.isObjectLiteralExpression(s)||s.getProperties().forEach(g=>{if(!Node.isPropertyAssignment(g))return;let l=g.getInitializer();!l||!Node.isObjectLiteralExpression(l)||l.getProperties().forEach(p=>{if(!Node.isPropertyAssignment(p))return;let u=p.getInitializer();u&&Node.isStringLiteral(u)&&O(u,e,n);});});});}function Q(t,e,n){t.forEachDescendant(i=>{if(!Node.isJsxAttribute(i)||i.getNameNode().getText()!=="className")return;let r=i.getInitializer();if(!r)return;let o=U(r);if(o.length===0)return;let c=i.getParent()?.getParent();if(!c||!Node.isJsxOpeningElement(c)&&!Node.isJsxSelfClosingElement(c))return;let f=o.filter(l=>!n.has(l));if(f.length===0){$(r);return}let g=f.filter(l=>!C.has(l)).map(l=>e[l]).filter(l=>!!l);if(g.length>0){let l=g.join(" ");Y(c,l);}else $(r);});}function U(t){let e=[];if(m(t))return y(t.getLiteralText());if(!Node.isJsxExpression(t))return e;let n=t.getExpression();if(!n)return e;if(m(n))return y(n.getLiteralText());if(Node.isCallExpression(n)&&E(n))for(let i of n.getArguments())m(i)&&e.push(...y(i.getLiteralText()));return e}function $(t){if(m(t)){let n=x(t.getLiteralText());t.setLiteralValue(n);return}if(!Node.isJsxExpression(t))return;let e=t.getExpression();if(e){if(m(e)){let n=x(e.getLiteralText());e.setLiteralValue(n);return}if(Node.isCallExpression(e)&&E(e)){for(let n of e.getArguments())if(m(n)){let i=x(n.getLiteralText());n.setLiteralValue(i);}L(e);}}}function y(t){let e=t.matchAll(/\bcn-[\w-]+\b/g);return Array.from(e,n=>n[0])}function x(t){return t.replace(/\bcn-[\w-]+\b/g,e=>C.has(e)?e:"").replace(/\s+/g," ").trim()}function L(t){if(!E(t))return;let e=t.getArguments(),n=e.filter(i=>m(i)?i.getLiteralText().trim()!=="":true);if(n.length!==e.length){let i=n.map(o=>o.getText()),r=t.getParent();r&&Node.isJsxExpression(r)?r.replaceWithText(`{cn(${i.join(", ")})}`):t.replaceWithText(`cn(${i.join(", ")})`);}}function Y(t,e){if(!Node.isJsxOpeningElement(t)&&!Node.isJsxSelfClosingElement(t))return;let n=t.getAttributes().find(o=>Node.isJsxAttribute(o)&&o.getNameNode().getText()==="className");if(!n||!Node.isJsxAttribute(n)){t.addAttribute({name:"className",initializer:`{cn(${JSON.stringify(e)})}`});return}let i=n.getInitializer();if(!i){n.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(m(i)){let o=i.getLiteralText(),c=x(h(e,o));i.setLiteralValue(c);return}if(!Node.isJsxExpression(i))return;let r=i.getExpression();if(!r){n.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(m(r)){let o=r.getLiteralText(),c=x(h(e,o));r.setLiteralValue(c);return}if(Node.isCallExpression(r)&&E(r)){let o=r.getArguments()[0];if(m(o)){let s=o.getLiteralText(),g=x(h(e,s));o.setLiteralValue(g);for(let l=1;l<r.getArguments().length;l++){let p=r.getArguments()[l];if(m(p)){let u=p.getLiteralText(),d=x(u);d!==u&&p.setLiteralValue(d);}}L(r);return}let c=r.getArguments().map(s=>{if(m(s)){let g=x(s.getLiteralText());return g?JSON.stringify(g):null}return s.getText()}).filter(s=>s!==null),f=[JSON.stringify(e),...c];n.setInitializer(`{cn(${f.join(", ")})}`);return}n.setInitializer(`{cn(${JSON.stringify(e)}, ${r.getText()})}`);}function h(t,e){return twMerge(t,e)}function E(t){let e=t.getExpression();return Node.isIdentifier(e)&&e.getText()==="cn"}function Z(t,e,n){t.forEachDescendant(i=>{if(!Node.isCallExpression(i))return;let r=i.getExpression();if(!(!Node.isIdentifier(r)||r.getText()!=="mergeProps"))for(let o of i.getArguments()){if(!Node.isObjectLiteralExpression(o))continue;let c=o.getProperties().find(s=>Node.isPropertyAssignment(s)&&Node.isIdentifier(s.getNameNode())&&s.getNameNode().getText()==="className");if(!c||!Node.isPropertyAssignment(c))continue;let f=c.getInitializer();if(f&&Node.isCallExpression(f)&&E(f)){let s=tt(f);if(s.length===0)continue;let g=s.filter(u=>!n.has(u));if(g.length===0){P(f);continue}let p=g.filter(u=>!C.has(u)).map(u=>e[u]).filter(u=>!!u);if(p.length>0){let u=p.join(" ");et(f,u,n,g);}else P(f);}}});}function tt(t){let e=[];for(let n of t.getArguments())m(n)&&e.push(...y(n.getLiteralText()));return e}function P(t){for(let e of t.getArguments())if(m(e)){let n=x(e.getLiteralText());e.setLiteralValue(n);}L(t);}function et(t,e,n,i){let r=t.getArguments()[0];if(m(r)){let s=r.getLiteralText(),g=x(h(e,s));r.setLiteralValue(g),i.forEach(l=>n.add(l));for(let l=1;l<t.getArguments().length;l++){let p=t.getArguments()[l];if(m(p)){let u=p.getLiteralText(),d=x(u);d!==u&&p.setLiteralValue(d);}}L(t);return}let o=t.getArguments().map(s=>{if(m(s)){let g=x(s.getLiteralText());return g?JSON.stringify(g):null}return s.getText()}).filter(s=>s!==null),c=[JSON.stringify(e),...o];i.forEach(s=>n.add(s)),t.getParent()&&t.replaceWithText(`cn(${c.join(", ")})`);}async function st(t,{styleMap:e,transformers:n=[w]}){let r=new Project({useInMemoryFileSystem:true}).createSourceFile("component.tsx",t,{scriptKind:ScriptKind.TSX,overwrite:true});for(let o of n)await o({sourceFile:r,styleMap:e});return r.getText()}var it=async({sourceFile:t,config:e})=>{if(!e.style?.startsWith("base-"))return t;let n=[],i=t.getDescendantsOfKind(SyntaxKind.JsxElement);for(let r of i){let o=r.getOpeningElement(),c=o.getAttribute("render");if(!c)continue;let s=r.getJsxChildren().map(S=>S.getText()).join("").trim();if(!s||c.getKind()!==SyntaxKind.JsxAttribute)continue;let l=c.asKindOrThrow(SyntaxKind.JsxAttribute).getInitializer();if(!l||l.getKind()!==SyntaxKind.JsxExpression)continue;let u=l.asKindOrThrow(SyntaxKind.JsxExpression).getExpression();if(!u||u.getKind()!==SyntaxKind.JsxSelfClosingElement)continue;let d=u.asKindOrThrow(SyntaxKind.JsxSelfClosingElement),A=d.getTagNameNode().getText(),I=d.getAttributes().map(S=>S.getText()).join(" "),J=I?`{<${A} ${I}>${s}</${A}>}`:`{<${A}>${s}</${A}>}`,M=o.getTagNameNode().getText(),j=o.getAttributes().filter(S=>S.getKind()===SyntaxKind.JsxAttribute?S.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="render":true).map(S=>S.getText()).join(" "),V=j?`${j} render=${J}`:`render=${J}`,F=`<${M} ${V} />`;n.push({elementStart:r.getStart(),elementEnd:r.getEnd(),newText:F});}for(let r of n.reverse()){let o=t.getFullText(),c=o.substring(0,r.elementStart)+r.newText+o.substring(r.elementEnd);t.replaceWithText(c);}return t};export{B as createStyleMap,it as transformRender,st as transformStyle};
1
+ export{e as transformDirection,f as transformFont,c as transformIcons,g as transformMenu}from'../chunk-7SBJAAAY.js';import'../chunk-CHWMSXYA.js';import D from'postcss';import k from'postcss-selector-parser';import {z}from'zod';import {Project,ScriptKind,SyntaxKind,Node}from'ts-morph';import {twMerge}from'tailwind-merge';var b="cn-",B=z.record(z.string().startsWith(b),z.string());function X(t){let e=D.parse(t),r={};return e.walkRules(n=>{let s=n.selectors??[];if(s.length===0)return;let o=q(n);if(o)for(let l of s){let c=_(l);k(i=>{i.each(u=>{let f=G(u);if(!f)return;let g=f.value;g.startsWith(b)&&(r[g]=r[g]?`${o} ${r[g]}`:o);});}).processSync(c);}}),B.parse(r)}function _(t){return t.replace(/\s*&\s*/g,"").trim()}function q(t){let e=[];for(let r of t.nodes||[])if(r.type==="atrule"&&r.name==="apply"){let n=r.params.trim();n&&e.push(n);}return e.length===0?null:e.join(" ")}function G(t){let e=[];return t.walkClasses(r=>{r.value.startsWith(b)&&e.push(r);}),e.length===0?null:e[e.length-1]}var A=new Set(["cn-menu-target","cn-menu-translucent","cn-logical-sides","cn-rtl-flip","cn-font-heading"]);function p(t){return Node.isStringLiteral(t)||Node.isNoSubstitutionTemplateLiteral(t)}var M=async({sourceFile:t,styleMap:e})=>{let r=new Set;return U(t,e,r),Y(t,e,r),Q(t,e,r),rt(t,e,r),t};function Q(t,e,r){t.forEachDescendant(n=>{if(!Node.isPropertyAssignment(n)||n.getNameNode().getText()!=="className")return;let s=n.getInitializer();!s||!Node.isCallExpression(s)||S(s)&&I(s,e,r);});}function $(t,e,r){let n=t.getLiteralText(),s=E(n);if(s.length===0)return;let o=s.filter(i=>!r.has(i));if(o.length===0){let i=m(n);t.setLiteralValue(i);return}let c=o.filter(i=>!A.has(i)).map(i=>e[i]).filter(i=>!!i);if(c.length>0){let i=c.join(" "),u=m(h(i,n));t.setLiteralValue(u),o.forEach(f=>r.add(f));}else {let i=m(n);t.setLiteralValue(i);}}function U(t,e,r){t.forEachDescendant(n=>{if(!Node.isCallExpression(n))return;let s=n.getExpression();if(!Node.isIdentifier(s)||s.getText()!=="cva")return;let o=n.getArguments()[0];Node.isStringLiteral(o)&&$(o,e,r);let l=n.getArguments()[1];if(!l||!Node.isObjectLiteralExpression(l))return;let c=l.getProperties().find(u=>Node.isPropertyAssignment(u)&&Node.isIdentifier(u.getNameNode())&&u.getNameNode().getText()==="variants");if(!c||!Node.isPropertyAssignment(c))return;let i=c.getInitializer();!i||!Node.isObjectLiteralExpression(i)||i.getProperties().forEach(u=>{if(!Node.isPropertyAssignment(u))return;let f=u.getInitializer();!f||!Node.isObjectLiteralExpression(f)||f.getProperties().forEach(g=>{if(!Node.isPropertyAssignment(g))return;let x=g.getInitializer();x&&Node.isStringLiteral(x)&&$(x,e,r);});});});}function Y(t,e,r){t.forEachDescendant(n=>{if(!Node.isJsxAttribute(n)||n.getNameNode().getText()!=="className")return;let s=n.getInitializer();if(!s)return;let o=Z(s);if(o.length>0){o.forEach(g=>I(g,e,r));return}let l=tt(s);if(l.length===0)return;let c=n.getParent()?.getParent();if(!c||!Node.isJsxOpeningElement(c)&&!Node.isJsxSelfClosingElement(c))return;let i=l.filter(g=>!r.has(g));if(i.length===0){P(s);return}let f=i.filter(g=>!A.has(g)).map(g=>e[g]).filter(g=>!!g);if(f.length>0){let g=f.join(" ");et(c,g);}else P(s);});}function Z(t){if(!Node.isJsxExpression(t))return [];let e=t.getExpression();if(!e||Node.isCallExpression(e)&&S(e))return [];let r=[];return e.forEachDescendant(n=>{Node.isCallExpression(n)&&S(n)&&r.push(n);}),r}function tt(t){let e=[];if(p(t))return E(t.getLiteralText());if(!Node.isJsxExpression(t))return e;let r=t.getExpression();if(!r)return e;if(p(r))return E(r.getLiteralText());if(Node.isCallExpression(r)&&S(r))for(let n of r.getArguments())p(n)&&e.push(...E(n.getLiteralText()));return e}function P(t){if(p(t)){let r=m(t.getLiteralText());t.setLiteralValue(r);return}if(!Node.isJsxExpression(t))return;let e=t.getExpression();if(e){if(p(e)){let r=m(e.getLiteralText());e.setLiteralValue(r);return}if(Node.isCallExpression(e)&&S(e)){for(let r of e.getArguments())if(p(r)){let n=m(r.getLiteralText());r.setLiteralValue(n);}N(e);}}}function E(t){let e=t.matchAll(/\bcn-[\w-]+\b/g);return Array.from(e,r=>r[0])}function m(t){return t.replace(/\bcn-[\w-]+\b/g,e=>A.has(e)?e:"").replace(/\s+/g," ").trim()}function N(t){if(!S(t))return;let e=t.getArguments(),r=e.filter(n=>p(n)?n.getLiteralText().trim()!=="":true);if(r.length!==e.length){let n=r.map(o=>o.getText()),s=t.getParent();s&&Node.isJsxExpression(s)?s.replaceWithText(`{cn(${n.join(", ")})}`):t.replaceWithText(`cn(${n.join(", ")})`);}}function et(t,e){if(!Node.isJsxOpeningElement(t)&&!Node.isJsxSelfClosingElement(t))return;let r=t.getAttributes().find(o=>Node.isJsxAttribute(o)&&o.getNameNode().getText()==="className");if(!r||!Node.isJsxAttribute(r)){t.addAttribute({name:"className",initializer:`{cn(${JSON.stringify(e)})}`});return}let n=r.getInitializer();if(!n){r.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(p(n)){let o=n.getLiteralText(),l=m(h(e,o));n.setLiteralValue(l);return}if(!Node.isJsxExpression(n))return;let s=n.getExpression();if(!s){r.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(p(s)){let o=s.getLiteralText(),l=m(h(e,o));s.setLiteralValue(l);return}if(Node.isCallExpression(s)&&S(s)){let o=s.getArguments()[0];if(p(o)){let i=o.getLiteralText(),u=m(h(e,i));o.setLiteralValue(u);for(let f=1;f<s.getArguments().length;f++){let g=s.getArguments()[f];if(p(g)){let x=g.getLiteralText(),y=m(x);y!==x&&g.setLiteralValue(y);}}N(s);return}let l=s.getArguments().map(i=>{if(p(i)){let u=m(i.getLiteralText());return u?JSON.stringify(u):null}return i.getText()}).filter(i=>i!==null),c=[JSON.stringify(e),...l];r.setInitializer(`{cn(${c.join(", ")})}`);return}r.setInitializer(`{cn(${JSON.stringify(e)}, ${s.getText()})}`);}function h(t,e){return twMerge(t,e)}function S(t){let e=t.getExpression();return Node.isIdentifier(e)&&e.getText()==="cn"}function rt(t,e,r){t.forEachDescendant(n=>{if(!Node.isCallExpression(n))return;let s=n.getExpression();if(!(!Node.isIdentifier(s)||s.getText()!=="mergeProps"))for(let o of n.getArguments()){if(!Node.isObjectLiteralExpression(o))continue;let l=o.getProperties().find(i=>Node.isPropertyAssignment(i)&&Node.isIdentifier(i.getNameNode())&&i.getNameNode().getText()==="className");if(!l||!Node.isPropertyAssignment(l))continue;let c=l.getInitializer();c&&Node.isCallExpression(c)&&S(c)&&I(c,e,r,true);}});}function I(t,e,r,n=false){let s=nt(t);if(s.length===0)return;let o=s.filter(i=>!r.has(i));if(o.length===0){w(t);return}let c=o.filter(i=>!A.has(i)).map(i=>e[i]).filter(i=>!!i);if(c.length===0){w(t);return}st(t,c.join(" ")),n&&o.forEach(i=>r.add(i));}function nt(t){let e=[];for(let r of t.getArguments())p(r)&&e.push(...E(r.getLiteralText()));return e}function w(t){for(let e of t.getArguments())if(p(e)){let r=m(e.getLiteralText());e.setLiteralValue(r);}N(t);}function st(t,e){let r=t.getArguments()[0];if(p(r)){let l=r.getLiteralText(),c=m(h(e,l));r.setLiteralValue(c);for(let i=1;i<t.getArguments().length;i++){let u=t.getArguments()[i];if(p(u)){let f=u.getLiteralText(),g=m(f);g!==f&&u.setLiteralValue(g);}}N(t);return}let n=t.getArguments().map(l=>{if(p(l)){let c=m(l.getLiteralText());return c?JSON.stringify(c):null}return l.getText()}).filter(l=>l!==null),s=[JSON.stringify(e),...n];t.getParent()&&t.replaceWithText(`cn(${s.join(", ")})`);}async function at(t,{styleMap:e,transformers:r=[M]}){let s=new Project({useInMemoryFileSystem:true}).createSourceFile("component.tsx",t,{scriptKind:ScriptKind.TSX,overwrite:true});for(let o of r)await o({sourceFile:s,styleMap:e});return s.getText()}var lt=async({sourceFile:t,config:e})=>{if(!e.style?.startsWith("base-"))return t;let r=[],n=t.getDescendantsOfKind(SyntaxKind.JsxElement);for(let s of n){let o=s.getOpeningElement(),l=o.getAttribute("render");if(!l)continue;let i=s.getJsxChildren().map(d=>d.getText()).join("").trim();if(!i||l.getKind()!==SyntaxKind.JsxAttribute)continue;let f=l.asKindOrThrow(SyntaxKind.JsxAttribute).getInitializer();if(!f||f.getKind()!==SyntaxKind.JsxExpression)continue;let x=f.asKindOrThrow(SyntaxKind.JsxExpression).getExpression();if(!x||x.getKind()!==SyntaxKind.JsxSelfClosingElement)continue;let y=x.asKindOrThrow(SyntaxKind.JsxSelfClosingElement),C=y.getTagNameNode().getText(),J=y.getAttributes().map(d=>d.getText()).join(" "),j=J?`{<${C} ${J}>${i}</${C}>}`:`{<${C}>${i}</${C}>}`,F=o.getTagNameNode().getText(),O=o.getAttributes().filter(d=>d.getKind()===SyntaxKind.JsxAttribute?d.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="render":true).map(d=>d.getText()).join(" "),V=O?`${O} render=${j}`:`render=${j}`,z=`<${F} ${V} />`;r.push({elementStart:s.getStart(),elementEnd:s.getEnd(),newText:z});}for(let s of r.reverse()){let o=t.getFullText(),l=o.substring(0,s.elementStart)+s.newText+o.substring(s.elementEnd);t.replaceWithText(l);}return t};export{X as createStyleMap,lt as transformRender,at as transformStyle};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadcn",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "description": "Add components to your apps.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1 +0,0 @@
1
- var A=["radix","base"],m=["nova","vega","maia","lyra","mira","luma","sera","rhea"],p=["neutral","stone","zinc","gray","mauve","olive","mist","taupe"],c=["neutral","stone","zinc","gray","amber","blue","cyan","emerald","fuchsia","green","indigo","lime","orange","pink","purple","red","rose","sky","teal","violet","yellow","mauve","olive","mist","taupe"],b=c,I={neutral:"blue",stone:"lime",zinc:"amber",mauve:"emerald",olive:"violet",mist:"rose",taupe:"cyan"},R=["lucide","hugeicons","tabler","phosphor","remixicon"],E=["inter","noto-sans","nunito-sans","figtree","roboto","raleway","dm-sans","public-sans","outfit","jetbrains-mono","geist","geist-mono","lora","merriweather","playfair-display","noto-serif","roboto-slab","oxanium","manrope","space-grotesk","montserrat","ibm-plex-sans","source-sans-3","instrument-sans","eb-garamond","instrument-serif"],g=["inherit",...E],_=["default","none","small","medium","large"],y=["subtle","bold"],d=["default","inverted","default-translucent","inverted-translucent"],f=[{key:"menuColor",values:d,bits:3},{key:"menuAccent",values:y,bits:3},{key:"radius",values:_,bits:4},{key:"font",values:E,bits:6},{key:"iconLibrary",values:R,bits:6},{key:"theme",values:c,bits:6},{key:"baseColor",values:p,bits:6},{key:"style",values:m,bits:6}],a=[...f,{key:"chartColor",values:b,bits:6},{key:"fontHeading",values:g,bits:5}],T=Object.fromEntries(a.map(e=>[e.key,e.values[0]])),l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",P="b",S=["a","b"];function C(e){if(e===0)return "0";let t="",n=e;for(;n>0;)t=l[n%62]+t,n=Math.floor(n/62);return t}function x(e){let t=0;for(let n=0;n<e.length;n++){let s=l.indexOf(e[n]);if(s===-1)return -1;t=t*62+s;}return t}function O(e){let t={...T,...e},n=0,s=0;for(let o of a){let i=o.values.indexOf(t[o.key]);n+=(i===-1?0:i)*2**s,s+=o.bits;}return P+C(n)}function h(e){if(!e||e.length<2)return null;let t=e[0];if(!S.includes(t))return null;let n=t==="a"?f:a,s=x(e.slice(1));if(s<0)return null;let o={},i=0;for(let r of n){let u=Math.floor(s/2**i)%2**r.bits;o[r.key]=u<r.values.length?r.values[u]:r.values[0],i+=r.bits;}return t==="a"&&(o.fontHeading="inherit"),o}function N(e){if(!e||e.length<2||e.length>10||!S.includes(e[0]))return false;for(let t=1;t<e.length;t++)if(l.indexOf(e[t])===-1)return false;return true}function k(e){return h(e)!==null}function v(){let e=t=>t[Math.floor(Math.random()*t.length)];return Object.fromEntries(a.map(t=>[t.key,e(t.values)]))}function L(){return O(v())}export{A as a,m as b,p as c,c as d,b as e,I as f,R as g,E as h,g as i,_ as j,y as k,d as l,T as m,C as n,x as o,O as p,h as q,N as r,k as s,v as t,L as u};