UNPKG

@kitn.ai/ui

Version:

Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.

2 lines (1 loc) 1.19 kB
import{s as m,c as u,i as v,F as w,S as p,t as c,k as x,m as y}from"./define-CNSKFZCd.js";import{c as b}from"./cn-CU7UAWzk.js";var k=c("<div part=skeleton>"),S=c('<div class="flex w-full flex-col gap-2">');const i=r=>typeof r=="number"?`${r}px`:r,F=r=>r==="circle"?"rounded-full":r==="text"?"rounded":"rounded-md";function j(r){const[t,o]=m(r,["class","variant","width","height","lines","style"]),s=()=>t.width!=null,d=()=>t.height!=null,g=()=>!s()&&t.variant!=null&&t.variant!=="circle",f=a=>{const e=typeof t.style=="object"&&t.style?{...t.style}:{};if(t.variant==="circle"){const n=i(t.width)??i(t.height)??"2.5rem";return e.width=n,e.height=n,e}return a?e.width="70%":s()&&(e.width=i(t.width)),d()?e.height=i(t.height):t.variant==="text"&&(e.height="0.75rem"),e},h=(a=!1)=>(()=>{var e=k();return x(e,y({get class(){return b("animate-pulse bg-foreground/10",F(t.variant),g()&&"w-full",t.class)},get style(){return f(a)}},o),!1,!1),e})(),l=()=>t.variant==="text"?Math.max(1,t.lines??1):1;return u(p,{get when(){return l()>1},get fallback(){return h()},get children(){var a=S();return v(a,u(w,{get each(){return Array.from({length:l()})},children:(e,n)=>h(n()===l()-1)})),a}})}export{j as S};