@ohos-ports/shadcn 4.21.0-beta.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 shadcn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # shadcn
2
+
3
+ A CLI for adding components to your project.
4
+
5
+ ## create
6
+
7
+ Use the `create` command to create a new project. You will be taken to a website to build your custom design system and choose your framework.
8
+
9
+ ```bash
10
+ npx shadcn create
11
+ ```
12
+
13
+ ## init
14
+
15
+ Use the `init` command to initialize dependencies for a new project.
16
+
17
+ The `init` command installs dependencies, adds the `cn` util, configures Tailwind CSS, and CSS variables for the project.
18
+
19
+ ```bash
20
+ npx shadcn init
21
+ ```
22
+
23
+ ## apply
24
+
25
+ Use the `apply` command to apply a preset to an existing project.
26
+
27
+ The `apply` command overwrites the current preset configuration, reinstalls detected UI components, and updates fonts and CSS variables to match the new preset.
28
+
29
+ ```bash
30
+ npx shadcn apply --preset a2r6bw
31
+ ```
32
+
33
+ ## add
34
+
35
+ Use the `add` command to add components to your project.
36
+
37
+ The `add` command adds a component to your project and installs all required dependencies.
38
+
39
+ ```bash
40
+ npx shadcn add [component]
41
+ ```
42
+
43
+ ### Example
44
+
45
+ ```bash
46
+ npx shadcn add alert-dialog
47
+ ```
48
+
49
+ You can also run the command without any arguments to view a list of all available components:
50
+
51
+ ```bash
52
+ npx shadcn add
53
+ ```
54
+
55
+ ## Documentation
56
+
57
+ Visit https://ui.shadcn.com/docs/cli to view the documentation.
58
+
59
+ ## License
60
+
61
+ Licensed under the [MIT license](https://github.com/shadcn-ui/ui/blob/main/LICENSE.md).
@@ -0,0 +1 @@
1
+ var c=["radix","base","aria"];function I(e){return c.includes(e)}function k(e){let t=e?c.find(n=>e.startsWith(`${n}-`)):void 0;return {base:t,style:t?e?.slice(t.length+1):e}}var p=["nova","vega","maia","lyra","mira","luma","sera","rhea"],b=["neutral","stone","zinc","gray","mauve","olive","mist","taupe"],f=["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"],R=f,N={neutral:"blue",stone:"lime",zinc:"amber",mauve:"emerald",olive:"violet",mist:"rose",taupe:"cyan"},d=["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],P=["default","none","small","medium","large"],_=["subtle","bold"],y=["default","inverted","default-translucent","inverted-translucent"],S=[{key:"menuColor",values:y,bits:3},{key:"menuAccent",values:_,bits:3},{key:"radius",values:P,bits:4},{key:"font",values:E,bits:6},{key:"iconLibrary",values:d,bits:6},{key:"theme",values:f,bits:6},{key:"baseColor",values:b,bits:6},{key:"style",values:p,bits:6}],a=[...S,{key:"chartColor",values:R,bits:6},{key:"fontHeading",values:g,bits:5}],T=Object.fromEntries(a.map(e=>[e.key,e.values[0]])),l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",x="b",m=["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 O(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 h(e){let t={...T,...e},n=0,s=0;for(let r of a){let i=r.values.indexOf(t[r.key]);n+=(i===-1?0:i)*2**s,s+=r.bits;}return x+C(n)}function v(e){if(!e||e.length<2)return null;let t=e[0];if(!m.includes(t))return null;let n=t==="a"?S:a,s=O(e.slice(1));if(s<0)return null;let r={},i=0;for(let o of n){let u=Math.floor(s/2**i)%2**o.bits;r[o.key]=u<o.values.length?o.values[u]:o.values[0],i+=o.bits;}return t==="a"&&(r.fontHeading="inherit"),r}function L(e){if(!e||e.length<2||e.length>10||!m.includes(e[0]))return false;for(let t=1;t<e.length;t++)if(l.indexOf(e[t])===-1)return false;return true}function B(e){return v(e)!==null}function A(){let e=t=>t[Math.floor(Math.random()*t.length)];return Object.fromEntries(a.map(t=>[t.key,e(t.values)]))}function M(){return h(A())}export{c as a,I as b,k as c,p as d,b as e,f,R as g,N as h,d as i,E as j,g as k,P as l,_ as m,y as n,T as o,C as p,O as q,h as r,v as s,L as t,B as u,A as v,M as w};
@@ -0,0 +1,2 @@
1
+ var f=/^import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/;function d(e){let n=[];for(let t of e.split(`
2
+ `)){let i=t.trim().match(f);i&&n.push({moduleSpecifier:i[2],namedImports:i[1].split(",").map(r=>r.trim())});}return n}function g(e){return d(e).find(n=>n.namedImports.includes("ICON"))?.moduleSpecifier}function I(e){let n=e.indexOf("<"),t=e.indexOf("/>",n);if(n===-1||t===-1)return {componentName:"ICON",attributes:{}};let i=e.slice(n+1,t).trim(),r=i.search(/[^\w]/),s=r===-1?i:i.slice(0,r),c=r===-1?"":i.slice(r);if(!s)return {componentName:"ICON",attributes:{}};let o={},m;for(let[p,a]of l(c)){if(a==="{ICON}"){m=p;continue}o[p]=a;}return {componentName:s,iconAttribute:m,attributes:o}}var u=/[\w-]/;function l(e){let n=[],t=0;for(;t<e.length;){if(!u.test(e[t])){t++;continue}let i=t;for(;t<e.length&&u.test(e[t]);)t++;let r=e.slice(i,t);if(e[t]!=="=")continue;t++;let s=e[t],c=s==="{"?"}":s==='"'||s==="'"?s:"";if(!c)continue;let o=e.indexOf(c,t+1);if(o===-1)break;n.push([r,e.slice(t,o+1)]),t=o+1;}return n}export{d as a,g as b,I as c};
@@ -0,0 +1 @@
1
+ import {z as z$1}from'zod';var l=z$1.union([z$1.string().refine(e=>e.includes("{name}"),{message:"Registry URL must include {name} placeholder"}),z$1.object({url:z$1.string().refine(e=>e.includes("{name}"),{message:"Registry URL must include {name} placeholder"}),params:z$1.record(z$1.string(),z$1.string()).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional()})]),p=z$1.record(z$1.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @v0, @acme)"}),l),o=z$1.object({$schema:z$1.string().optional(),style:z$1.string(),rsc:z$1.coerce.boolean().default(false),tsx:z$1.coerce.boolean().default(true),tailwind:z$1.object({config:z$1.string().optional(),css:z$1.string(),baseColor:z$1.string(),cssVariables:z$1.boolean().default(true),prefix:z$1.string().default("").optional()}),iconLibrary:z$1.string().optional(),rtl:z$1.coerce.boolean().default(false).optional(),menuColor:z$1.enum(["default","inverted","default-translucent","inverted-translucent"]).default("default").optional(),menuAccent:z$1.enum(["subtle","bold"]).default("subtle").optional(),aliases:z$1.object({components:z$1.string(),utils:z$1.string(),ui:z$1.string().optional(),lib:z$1.string().optional(),hooks:z$1.string().optional()}),registries:p.optional()}).strict(),m=o.extend({resolvedPaths:z$1.object({cwd:z$1.string(),tailwindConfig:z$1.string(),tailwindCss:z$1.string(),utils:z$1.string(),components:z$1.string(),lib:z$1.string(),hooks:z$1.string(),ui:z$1.string()})}),C=z$1.record(m),a=z$1.enum(["registry:lib","registry:block","registry:component","registry:ui","registry:hook","registry:page","registry:file","registry:theme","registry:style","registry:item","registry:base","registry:font","registry:example","registry:internal"]),y=z$1.discriminatedUnion("type",[z$1.object({path:z$1.string(),content:z$1.string().optional(),type:z$1.enum(["registry:file","registry:page"]),target:z$1.string()}),z$1.object({path:z$1.string(),content:z$1.string().optional(),type:a.exclude(["registry:file","registry:page"]),target:z$1.string().optional()})]),d=z$1.object({config:z$1.object({content:z$1.array(z$1.string()).optional(),theme:z$1.record(z$1.string(),z$1.any()).optional(),plugins:z$1.array(z$1.string()).optional()}).optional()}),n=z$1.object({theme:z$1.record(z$1.string(),z$1.string()).optional(),light:z$1.record(z$1.string(),z$1.string()).optional(),dark:z$1.record(z$1.string(),z$1.string()).optional()}),g=z$1.lazy(()=>z$1.union([z$1.string(),z$1.array(z$1.union([z$1.string(),z$1.record(z$1.string(),z$1.string())])),z$1.record(z$1.string(),g)])),u=z$1.record(z$1.string(),g),h=z$1.record(z$1.string(),z$1.string()),c=z$1.object({family:z$1.string(),provider:z$1.literal("google"),import:z$1.string(),variable:z$1.string(),weight:z$1.array(z$1.string()).optional(),subsets:z$1.array(z$1.string()).optional(),selector:z$1.string().optional(),dependency:z$1.string().optional()}),r=z$1.object({$schema:z$1.string().optional(),extends:z$1.string().optional(),name:z$1.string(),title:z$1.string().optional(),author:z$1.string().min(2).optional(),description:z$1.string().optional(),dependencies:z$1.array(z$1.string()).optional(),devDependencies:z$1.array(z$1.string()).optional(),registryDependencies:z$1.array(z$1.string()).optional(),files:z$1.array(y).optional(),tailwind:d.optional(),cssVars:n.optional(),css:u.optional(),envVars:h.optional(),meta:z$1.record(z$1.string(),z$1.any()).optional(),docs:z$1.string().optional(),categories:z$1.array(z$1.string()).optional()}),i=z$1.discriminatedUnion("type",[r.extend({type:z$1.literal("registry:base"),config:o.deepPartial().optional()}),r.extend({type:z$1.literal("registry:font"),font:c}),r.extend({type:a.exclude(["registry:base","registry:font"])})]),s=z$1.object({total:z$1.number(),offset:z$1.number(),limit:z$1.number(),hasMore:z$1.boolean()}),f=z$1.object({$schema:z$1.string().optional(),name:z$1.string().optional(),homepage:z$1.string().optional(),include:z$1.array(z$1.string()).optional(),items:z$1.array(i).optional(),pagination:s.optional()}).refine(e=>e.items!==void 0||e.include!==void 0,{message:"Registry must define at least one of `items` or `include`.",path:["items"]}),b=f.transform(e=>({...e,items:e.items??[]})),R=b.pipe(z$1.object({$schema:z$1.string().optional(),name:z$1.string(),homepage:z$1.string(),include:z$1.array(z$1.string()).optional(),items:z$1.array(i),pagination:s.optional()})),v=z$1.array(i),V=z$1.array(z$1.object({name:z$1.string(),label:z$1.string()})),w=z$1.record(z$1.string(),z$1.record(z$1.string(),z$1.string())),k=z$1.object({inlineColors:z$1.object({light:z$1.record(z$1.string(),z$1.string()),dark:z$1.record(z$1.string(),z$1.string())}),cssVars:n,cssVarsV4:n.optional(),inlineColorsTemplate:z$1.string(),cssVarsTemplate:z$1.string()}),z=r.pick({dependencies:true,devDependencies:true,files:true,tailwind:true,cssVars:true,css:true,envVars:true,docs:true}).extend({fonts:z$1.array(r.extend({type:z$1.literal("registry:font"),font:c})).optional()}),x=z$1.object({name:z$1.string(),title:z$1.string().optional(),type:z$1.string().optional(),description:z$1.string().optional(),registry:z$1.string(),addCommandArgument:z$1.string()}),S=z$1.object({registry:z$1.string(),message:z$1.string()}),T=z$1.object({pagination:s,items:z$1.array(x),errors:z$1.array(S).optional()}),A=z$1.record(z$1.string().regex(/^@[a-zA-Z0-9][a-zA-Z0-9-_]*$/),z$1.string()),$=z$1.array(z$1.object({name:z$1.string(),homepage:z$1.string().optional(),url:z$1.string(),description:z$1.string().optional()})),j=z$1.object({name:z$1.string(),title:z$1.string(),description:z$1.string(),base:z$1.string(),style:z$1.string(),baseColor:z$1.string(),theme:z$1.string(),iconLibrary:z$1.string(),font:z$1.string(),rtl:z$1.coerce.boolean().default(false),menuAccent:z$1.enum(["subtle","bold"]),menuColor:z$1.enum(["default","inverted","default-translucent","inverted-translucent"]),radius:z$1.string()}),E=z$1.object({presets:z$1.array(j)});export{$ as A,j as B,E as C,l as a,p as b,o as c,m as d,C as e,a as f,y as g,d as h,n as i,u as j,h as k,c as l,r as m,i as n,s as o,b as p,R as q,v as r,V as s,w as t,k as u,z as v,x as w,S as x,T as y,A as z};