shadcn 3.6.1 → 3.6.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.
- package/LICENSE.md +21 -0
- package/README.md +11 -3
- package/dist/{chunk-6SDOGUEN.js → chunk-BFNVF2P5.js} +2 -2
- package/dist/chunk-BFNVF2P5.js.map +1 -0
- package/dist/{chunk-AXG36CF4.js → chunk-I3JXSMK6.js} +3 -3
- package/dist/{chunk-AXG36CF4.js.map → chunk-I3JXSMK6.js.map} +1 -1
- package/dist/{chunk-7C5BCSX2.js → chunk-PMFK2ZSQ.js} +3 -3
- package/dist/{chunk-7C5BCSX2.js.map → chunk-PMFK2ZSQ.js.map} +1 -1
- package/dist/{chunk-VEWRF4V7.js → chunk-SSXFFJQN.js} +3 -3
- package/dist/{chunk-VEWRF4V7.js.map → chunk-SSXFFJQN.js.map} +1 -1
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +20 -20
- package/dist/chunk-6SDOGUEN.js.map +0 -1
package/dist/mcp/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as server}from'../chunk-
|
|
1
|
+
export{b as server}from'../chunk-SSXFFJQN.js';import'../chunk-I3JXSMK6.js';import'../chunk-WKG3W635.js';import'../chunk-PMFK2ZSQ.js';import'../chunk-BFNVF2P5.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/registry/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{E as RegistriesIndexParseError,u as RegistryError,y as RegistryFetchError,x as RegistryForbiddenError,D as RegistryInvalidNamespaceError,A as RegistryLocalFileError,C as RegistryMissingEnvironmentVariablesError,z as RegistryNotConfiguredError,v as RegistryNotFoundError,B as RegistryParseError,w as RegistryUnauthorizedError,ja as getRegistriesIndex,Z as getRegistry,_ as getRegistryItems,$ as resolveRegistryItems,ma as searchRegistries}from'../chunk-
|
|
1
|
+
export{E as RegistriesIndexParseError,u as RegistryError,y as RegistryFetchError,x as RegistryForbiddenError,D as RegistryInvalidNamespaceError,A as RegistryLocalFileError,C as RegistryMissingEnvironmentVariablesError,z as RegistryNotConfiguredError,v as RegistryNotFoundError,B as RegistryParseError,w as RegistryUnauthorizedError,ja as getRegistriesIndex,Z as getRegistry,_ as getRegistryItems,$ as resolveRegistryItems,ma as searchRegistries}from'../chunk-I3JXSMK6.js';import'../chunk-WKG3W635.js';import'../chunk-PMFK2ZSQ.js';import'../chunk-BFNVF2P5.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as transformIcons,b as transformMenu}from'../chunk-
|
|
1
|
+
export{a as transformIcons,b as transformMenu}from'../chunk-PMFK2ZSQ.js';import'../chunk-BFNVF2P5.js';import z$1 from'postcss';import K from'postcss-selector-parser';import {z}from'zod';import {Project,ScriptKind,SyntaxKind,Node}from'ts-morph';var N="cn-",R=z.record(z.string().startsWith(N),z.string());function W(t){let e=z$1.parse(t),r={};return e.walkRules(s=>{let n=s.selectors??[];if(n.length===0)return;let i=D(s);if(i)for(let g of n){let c=B(g);K(o=>{o.each(l=>{let u=k(l);if(!u)return;let f=u.value;f.startsWith(N)&&(r[f]=r[f]?`${i} ${r[f]}`:i);});}).processSync(c);}}),R.parse(r)}function B(t){return t.replace(/\s*&\s*/g,"").trim()}function D(t){let e=[];for(let r of t.nodes||[])if(r.type==="atrule"&&r.name==="apply"){let s=r.params.trim();s&&e.push(s);}return e.length===0?null:e.join(" ")}function k(t){let e=[];return t.walkClasses(r=>{r.value.startsWith(N)&&e.push(r);}),e.length===0?null:e[e.length-1]}var X=new Set(["cn-menu-target"]);function p(t){return Node.isStringLiteral(t)||Node.isNoSubstitutionTemplateLiteral(t)}var $=async({sourceFile:t,styleMap:e})=>{let r=new Set;return _(t,e,r),q(t,e,r),Q(t,e,r),t};function O(t,e,r){let s=t.getLiteralText(),n=y(s);if(n.length===0)return;let i=n.filter(c=>!r.has(c));if(i.length===0){let c=m(s);t.setLiteralValue(c);return}let g=i.map(c=>e[c]).filter(c=>!!c);if(g.length>0){let c=g.join(" "),o=m(E(c,s));t.setLiteralValue(o),i.forEach(l=>r.add(l));}else {let c=m(s);t.setLiteralValue(c);}}function _(t,e,r){t.forEachDescendant(s=>{if(!Node.isCallExpression(s))return;let n=s.getExpression();if(!Node.isIdentifier(n)||n.getText()!=="cva")return;let i=s.getArguments()[0];Node.isStringLiteral(i)&&O(i,e,r);let g=s.getArguments()[1];if(!g||!Node.isObjectLiteralExpression(g))return;let c=g.getProperties().find(l=>Node.isPropertyAssignment(l)&&Node.isIdentifier(l.getNameNode())&&l.getNameNode().getText()==="variants");if(!c||!Node.isPropertyAssignment(c))return;let o=c.getInitializer();!o||!Node.isObjectLiteralExpression(o)||o.getProperties().forEach(l=>{if(!Node.isPropertyAssignment(l))return;let u=l.getInitializer();!u||!Node.isObjectLiteralExpression(u)||u.getProperties().forEach(f=>{if(!Node.isPropertyAssignment(f))return;let x=f.getInitializer();x&&Node.isStringLiteral(x)&&O(x,e,r);});});});}function q(t,e,r){t.forEachDescendant(s=>{if(!Node.isJsxAttribute(s)||s.getNameNode().getText()!=="className")return;let n=s.getInitializer();if(!n)return;let i=G(n);if(i.length===0)return;let g=s.getParent()?.getParent();if(!g||!Node.isJsxOpeningElement(g)&&!Node.isJsxSelfClosingElement(g))return;let c=i.filter(l=>!r.has(l));if(c.length===0){I(n);return}let o=c.map(l=>e[l]).filter(l=>!!l);if(o.length>0){let l=o.join(" ");H(g,l);}else I(n);});}function G(t){let e=[];if(p(t))return y(t.getLiteralText());if(!Node.isJsxExpression(t))return e;let r=t.getExpression();if(!r)return e;if(p(r))return y(r.getLiteralText());if(Node.isCallExpression(r)&&A(r))for(let s of r.getArguments())p(s)&&e.push(...y(s.getLiteralText()));return e}function I(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)&&A(e)){for(let r of e.getArguments())if(p(r)){let s=m(r.getLiteralText());r.setLiteralValue(s);}C(e);}}}function y(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=>X.has(e)?e:"").replace(/\s+/g," ").trim()}function C(t){if(!A(t))return;let e=t.getArguments(),r=e.filter(s=>p(s)?s.getLiteralText().trim()!=="":true);if(r.length!==e.length){let s=r.map(i=>i.getText()),n=t.getParent();n&&Node.isJsxExpression(n)?n.replaceWithText(`{cn(${s.join(", ")})}`):t.replaceWithText(`cn(${s.join(", ")})`);}}function H(t,e){if(!Node.isJsxOpeningElement(t)&&!Node.isJsxSelfClosingElement(t))return;let r=t.getAttributes().find(i=>Node.isJsxAttribute(i)&&i.getNameNode().getText()==="className");if(!r||!Node.isJsxAttribute(r)){t.addAttribute({name:"className",initializer:`{cn(${JSON.stringify(e)})}`});return}let s=r.getInitializer();if(!s){r.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(p(s)){let i=s.getLiteralText(),g=m(E(e,i));s.setLiteralValue(g);return}if(!Node.isJsxExpression(s))return;let n=s.getExpression();if(!n){r.setInitializer(`{cn(${JSON.stringify(e)})}`);return}if(p(n)){let i=n.getLiteralText(),g=m(E(e,i));n.setLiteralValue(g);return}if(Node.isCallExpression(n)&&A(n)){let i=n.getArguments()[0];if(p(i)){let o=i.getLiteralText(),l=m(E(e,o));i.setLiteralValue(l);for(let u=1;u<n.getArguments().length;u++){let f=n.getArguments()[u];if(p(f)){let x=f.getLiteralText(),T=m(x);T!==x&&f.setLiteralValue(T);}}C(n);return}let g=n.getArguments().map(o=>{if(p(o)){let l=m(o.getLiteralText());return l?JSON.stringify(l):null}return o.getText()}).filter(o=>o!==null),c=[JSON.stringify(e),...g];r.setInitializer(`{cn(${c.join(", ")})}`);return}r.setInitializer(`{cn(${JSON.stringify(e)}, ${n.getText()})}`);}function E(t,e){let r=e.split(/\s+/).filter(Boolean);return [...t.split(/\s+/).filter(Boolean),...r].join(" ").trim()}function A(t){let e=t.getExpression();return Node.isIdentifier(e)&&e.getText()==="cn"}function Q(t,e,r){t.forEachDescendant(s=>{if(!Node.isCallExpression(s))return;let n=s.getExpression();if(!(!Node.isIdentifier(n)||n.getText()!=="mergeProps"))for(let i of s.getArguments()){if(!Node.isObjectLiteralExpression(i))continue;let g=i.getProperties().find(o=>Node.isPropertyAssignment(o)&&Node.isIdentifier(o.getNameNode())&&o.getNameNode().getText()==="className");if(!g||!Node.isPropertyAssignment(g))continue;let c=g.getInitializer();if(c&&Node.isCallExpression(c)&&A(c)){let o=U(c);if(o.length===0)continue;let l=o.filter(f=>!r.has(f));if(l.length===0){P(c);continue}let u=l.map(f=>e[f]).filter(f=>!!f);if(u.length>0){let f=u.join(" ");Y(c,f,r,l);}else P(c);}}});}function U(t){let e=[];for(let r of t.getArguments())p(r)&&e.push(...y(r.getLiteralText()));return e}function P(t){for(let e of t.getArguments())if(p(e)){let r=m(e.getLiteralText());e.setLiteralValue(r);}C(t);}function Y(t,e,r,s){let n=t.getArguments()[0];if(p(n)){let o=n.getLiteralText(),l=m(E(e,o));n.setLiteralValue(l),s.forEach(u=>r.add(u));for(let u=1;u<t.getArguments().length;u++){let f=t.getArguments()[u];if(p(f)){let x=f.getLiteralText(),T=m(x);T!==x&&f.setLiteralValue(T);}}C(t);return}let i=t.getArguments().map(o=>{if(p(o)){let l=m(o.getLiteralText());return l?JSON.stringify(l):null}return o.getText()}).filter(o=>o!==null),g=[JSON.stringify(e),...i];s.forEach(o=>r.add(o)),t.getParent()&&t.replaceWithText(`cn(${g.join(", ")})`);}async function et(t,{styleMap:e,transformers:r=[$]}){let n=new Project({useInMemoryFileSystem:true}).createSourceFile("component.tsx",t,{scriptKind:ScriptKind.TSX,overwrite:true});for(let i of r)await i({sourceFile:n,styleMap:e});return n.getText()}var rt=async({sourceFile:t,config:e})=>{if(!e.style?.startsWith("base-"))return t;let r=[],s=t.getDescendantsOfKind(SyntaxKind.JsxElement);for(let n of s){let i=n.getOpeningElement(),g=i.getAttribute("render");if(!g)continue;let o=n.getJsxChildren().map(S=>S.getText()).join("").trim();if(!o||g.getKind()!==SyntaxKind.JsxAttribute)continue;let u=g.asKindOrThrow(SyntaxKind.JsxAttribute).getInitializer();if(!u||u.getKind()!==SyntaxKind.JsxExpression)continue;let x=u.asKindOrThrow(SyntaxKind.JsxExpression).getExpression();if(!x||x.getKind()!==SyntaxKind.JsxSelfClosingElement)continue;let T=x.asKindOrThrow(SyntaxKind.JsxSelfClosingElement),h=T.getTagNameNode().getText(),b=T.getAttributes().map(S=>S.getText()).join(" "),j=b?`{<${h} ${b}>${o}</${h}>}`:`{<${h}>${o}</${h}>}`,w=i.getTagNameNode().getText(),J=i.getAttributes().filter(S=>S.getKind()===SyntaxKind.JsxAttribute?S.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="render":true).map(S=>S.getText()).join(" "),M=J?`${J} render=${j}`:`render=${j}`,V=`<${w} ${M} />`;r.push({elementStart:n.getStart(),elementEnd:n.getEnd(),newText:V});}for(let n of r.reverse()){let i=t.getFullText(),g=i.substring(0,n.elementStart)+n.newText+i.substring(n.elementEnd);t.replaceWithText(g);}return t};export{W as createStyleMap,rt as transformRender,et as transformStyle};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shadcn",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "Add components to your apps.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -56,24 +56,6 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"bin": "./dist/index.js",
|
|
59
|
-
"scripts": {
|
|
60
|
-
"dev": "tsup --watch",
|
|
61
|
-
"build": "tsup",
|
|
62
|
-
"typecheck": "tsc --noEmit",
|
|
63
|
-
"clean": "rimraf dist && rimraf components",
|
|
64
|
-
"start:dev": "cross-env REGISTRY_URL=http://localhost:4000/r node dist/index.js",
|
|
65
|
-
"start:prod": "cross-env REGISTRY_URL=https://ui.shadcn.com/r node dist/index.js",
|
|
66
|
-
"start": "node dist/index.js",
|
|
67
|
-
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
|
|
68
|
-
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
|
|
69
|
-
"release": "changeset version",
|
|
70
|
-
"pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
|
|
71
|
-
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
|
|
72
|
-
"pub:release": "pnpm build && pnpm publish --access public",
|
|
73
|
-
"test": "vitest run",
|
|
74
|
-
"test:dev": "REGISTRY_URL=http://localhost:4000/r vitest run",
|
|
75
|
-
"mcp:inspect": "pnpm dlx @modelcontextprotocol/inspector node dist/index.js mcp"
|
|
76
|
-
},
|
|
77
59
|
"dependencies": {
|
|
78
60
|
"@antfu/ni": "^25.0.0",
|
|
79
61
|
"@babel/core": "^7.28.0",
|
|
@@ -117,5 +99,23 @@
|
|
|
117
99
|
"tsup": "^8.5.0",
|
|
118
100
|
"type-fest": "^4.41.0",
|
|
119
101
|
"typescript": "^5.9.2"
|
|
102
|
+
},
|
|
103
|
+
"scripts": {
|
|
104
|
+
"dev": "tsup --watch",
|
|
105
|
+
"build": "tsup",
|
|
106
|
+
"typecheck": "tsc --noEmit",
|
|
107
|
+
"clean": "rimraf dist && rimraf components",
|
|
108
|
+
"start:dev": "cross-env REGISTRY_URL=http://localhost:4000/r node dist/index.js",
|
|
109
|
+
"start:prod": "cross-env REGISTRY_URL=https://ui.shadcn.com/r node dist/index.js",
|
|
110
|
+
"start": "node dist/index.js",
|
|
111
|
+
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
|
|
112
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
|
|
113
|
+
"release": "changeset version",
|
|
114
|
+
"pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
|
|
115
|
+
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
|
|
116
|
+
"pub:release": "pnpm build && pnpm publish --access public",
|
|
117
|
+
"test": "vitest run",
|
|
118
|
+
"test:dev": "REGISTRY_URL=http://localhost:4000/r vitest run",
|
|
119
|
+
"mcp:inspect": "pnpm dlx @modelcontextprotocol/inspector node dist/index.js mcp"
|
|
120
120
|
}
|
|
121
|
-
}
|
|
121
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/icons/libraries.ts"],"names":["iconLibraries"],"mappings":"AAAO,IAAMA,CAAAA,CAAgB,CAC3B,MAAA,CAAQ,CACN,KAAM,QAAA,CACN,KAAA,CAAO,SACP,QAAA,CAAU,CAAC,cAAc,CAAA,CACzB,MAAA,CAAQ,sCACR,KAAA,CAAO,UAAA,CACP,OAAQ,cACV,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,MAAO,cAAA,CACP,QAAA,CAAU,CAAC,qBAAqB,CAAA,CAChC,OAAQ,4CAAA,CACR,KAAA,CAAO,UAAA,CACP,MAAA,CAAQ,qBACV,CAAA,CACA,UAAW,CACT,IAAA,CAAM,YACN,KAAA,CAAO,WAAA,CACP,SAAU,CAAC,kBAAA,CAAoB,4BAA4B,CAAA,CAC3D,MAAA,CACE,CAAA;AAAA,kDAAA,CAAA,CACF,KAAA,CAAO,+CAAA,CACP,MAAA,CAAQ,4BACV,CACF","file":"chunk-6SDOGUEN.js","sourcesContent":["export const iconLibraries = {\n lucide: {\n name: \"lucide\",\n title: \"Lucide\",\n packages: [\"lucide-react\"],\n import: \"import { ICON } from 'lucide-react'\",\n usage: \"<ICON />\",\n export: \"lucide-react\",\n },\n tabler: {\n name: \"tabler\",\n title: \"Tabler Icons\",\n packages: [\"@tabler/icons-react\"],\n import: \"import { ICON } from '@tabler/icons-react'\",\n usage: \"<ICON />\",\n export: \"@tabler/icons-react\",\n },\n hugeicons: {\n name: \"hugeicons\",\n title: \"HugeIcons\",\n packages: [\"@hugeicons/react\", \"@hugeicons/core-free-icons\"],\n import:\n \"import { HugeiconsIcon } from '@hugeicons/react'\\nimport { ICON } from '@hugeicons/core-free-icons';\",\n usage: \"<HugeiconsIcon icon={ICON} strokeWidth={2} />\",\n export: \"@hugeicons/core-free-icons\",\n },\n} as const\n\nexport type IconLibraries = typeof iconLibraries\n\nexport type IconLibrary = IconLibraries[keyof IconLibraries]\n\nexport type IconLibraryName = keyof IconLibraries\n"]}
|