@ghostly-solutions/ui 0.3.3 → 0.3.5
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/chunk-gv8xjarq.js +11 -0
- package/dist/index.js +5 -3
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-rbysacxc.js +0 -12
package/package.json
CHANGED
package/dist/chunk-rbysacxc.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{clsx as ce}from"clsx";import{twMerge as ze}from"tailwind-merge";function KT(...e){return ze(ce(e))}import*as x from"react";function ve(...e){return(T)=>{for(let m of e)if(typeof m==="function")m(T);else if(m!=null)m.current=T}}function bT(...e){return x.useCallback(ve(...e),e)}function kT(e,T){let m=x.createContext(T);m.displayName=e;function i(){let s=x.useContext(m);if(s===void 0)throw Error(`use${e} must be used within a ${e}Provider`);return s}return[m.Provider,i,m]}function CT(e){let T=x.createContext(void 0);T.displayName=e;function m(){return x.useContext(T)}return[T.Provider,m,T]}var M=null;function $(){if(M)return M;if(typeof navigator>"u")return M={os:"linux",isMac:!1,isWindows:!1,isLinux:!0,isMobile:!1},M;let e=navigator.userAgentData?.platform??navigator.platform??"",T=navigator.userAgent??"",m=/mac/i.test(e),i=/win/i.test(e),s=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(T)||"maxTouchPoints"in navigator&&navigator.maxTouchPoints>1&&m,n=/linux/i.test(e)&&!s;return M={os:m?"mac":i?"windows":"linux",isMac:m,isWindows:i,isLinux:n,isMobile:s},M}var le={esc:"escape",return:"enter",del:"delete",space:" ",spacebar:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"},we={mod:"⌘",ctrl:"⌃",control:"⌃",alt:"⌥",option:"⌥",shift:"⇧",meta:"⌘",cmd:"⌘",command:"⌘",enter:"⏎",return:"⏎",backspace:"⌫",delete:"⌦",tab:"⇥",escape:"Esc",esc:"Esc",space:"␣",up:"↑",down:"↓",left:"←",right:"→",arrowup:"↑",arrowdown:"↓",arrowleft:"←",arrowright:"→"},_e={mod:"Ctrl",cmd:"Ctrl",command:"Ctrl",meta:"Super",ctrl:"Ctrl",control:"Ctrl",alt:"Alt",option:"Alt",shift:"Shift",enter:"Enter",return:"Enter",backspace:"Backspace",delete:"Del",tab:"Tab",escape:"Esc",esc:"Esc",space:"Space",up:"↑",down:"↓",left:"←",right:"→",arrowup:"↑",arrowdown:"↓",arrowleft:"←",arrowright:"→"};function $T(e){let T=e.split("+").map((i)=>i.trim().toLowerCase()),m={key:"",mod:!1,ctrl:!1,alt:!1,shift:!1,meta:!1};for(let i of T)if(i==="mod")m.mod=!0;else if(i==="ctrl"||i==="control")m.ctrl=!0;else if(i==="alt"||i==="option")m.alt=!0;else if(i==="shift")m.shift=!0;else if(i==="meta"||i==="cmd"||i==="command")m.meta=!0;else m.key=le[i]??i;return m}function XT(e,T){let{isMac:m}=$(),i=e.key.toLowerCase(),s=T.key.toLowerCase();if(s&&i!==s&&e.code.toLowerCase()!==`key${s}`)return!1;let n=T.meta||T.mod&&m,h=T.ctrl||T.mod&&!m;if(e.metaKey!==n)return!1;if(e.ctrlKey!==h)return!1;if(e.altKey!==T.alt)return!1;if(e.shiftKey!==T.shift)return!1;return!0}function VT(e,T){let m=T??$().isMac,i=m?we:_e,s=e.split("+").map((n)=>{let h=n.trim().toLowerCase();return i[h]??n.trim().toUpperCase()});return m?s.join(""):s.join("+")}function jT(e,T){let i=T??$().isMac?we:_e;return e.split("+").map((s)=>{let n=s.trim().toLowerCase();return i[n]??s.trim().toUpperCase()})}var y={light:"light",dark:"dark",system:"system"},L="data-gs-theme",K="data-gs-color-scheme",z="dark",oe=1,Se="gs",v="gs-theme-state",ae="gs-density",l="gs-theme-state";var eT="ghostly-solutions",TT=y.system,mT="both",iT="/",sT="lax",nT=31536000;function Me(e){return typeof e==="object"&&e!==null}function X(e){return e===y.light||e===y.dark||e===y.system}function Ke(e){return e===y.light||e===y.dark}function f(e){return typeof e==="string"&&e.trim().length>0}function Le(e,T=TT){if(X(e))return e;return T}function hT(e){if(!Array.isArray(e))return[];let T=e.filter(f);if(T.length===0)return[];return[...new Set(T)]}function rT(e,T){let m=f(e)?e:eT;if(T.length===0)return m;if(T.includes(m))return m;return T[0]??m}function be(e,T,m){if(!f(e))return T;if(m.length===0)return e;if(m.includes(e))return e;return T}function yT(e){if(e===!1)return!1;let T=e?.mode==="localStorage"||e?.mode==="cookie"||e?.mode==="both"?e.mode:mT,m=f(e?.key)?e.key:v,i=f(e?.cookie?.name)?e.cookie.name:l,s=f(e?.cookie?.path)?e.cookie.path:iT,n=typeof e?.cookie?.maxAge==="number"&&Number.isFinite(e.cookie.maxAge)?Math.max(0,Math.floor(e.cookie.maxAge)):nT,h=e?.cookie?.sameSite==="strict"||e?.cookie?.sameSite==="none"||e?.cookie?.sameSite==="lax"?e.cookie.sameSite:sT,N=e?.cookie?.secure===!0;return{mode:T,key:m,cookie:{name:i,path:s,maxAge:n,sameSite:h,secure:N}}}function d(e={}){let T=hT(e.themes);return{defaultTheme:rT(e.defaultTheme,T),defaultColorScheme:Le(e.defaultColorScheme),themes:T,attribute:f(e.attribute)?e.attribute:L,colorSchemeAttribute:e.colorSchemeAttribute===!1?!1:f(e.colorSchemeAttribute)?e.colorSchemeAttribute:K,darkClassName:f(e.darkClassName)?e.darkClassName:z,storage:yT(e.storage)}}function t(e,T={}){let m=d(T);return{theme:be(e?.theme,m.defaultTheme,m.themes),colorScheme:Le(e?.colorScheme,m.defaultColorScheme)}}function o(e,T={}){let m=t(e,T);return JSON.stringify({theme:m.theme,colorScheme:m.colorScheme})}function S(e){if(!f(e))return null;try{let T=JSON.parse(e);if(!Me(T))return null;let m=f(T.theme)?T.theme:f(T.t)?T.t:null,i=X(T.colorScheme)?T.colorScheme:X(T.c)?T.c:null;if(!(m&&i))return null;return{theme:m,colorScheme:i}}catch{return null}}function fT(e,T){if(!(f(e)&&f(T)))return null;let m=e.split(";");for(let i of m){let s=i.trim();if(!s)continue;let n=s.indexOf("=");if(n===-1)continue;if(s.slice(0,n).trim()!==T)continue;let N=s.slice(n+1).trim();return N.length>0?N:null}return null}function ke(e){return Boolean(e&&(e.mode==="localStorage"||e.mode==="both"))}function b(e){return Boolean(e&&(e.mode==="cookie"||e.mode==="both"))}function a(e,T={}){if(!f(e))return null;let m=d(T);if(!b(m.storage))return null;let i=fT(e,m.storage.cookie.name);if(!f(i))return null;try{let s=decodeURIComponent(i),n=S(s);if(!n)return null;return t(n,m)}catch{return null}}function RT(e){if(e==="strict")return"Strict";if(e==="none")return"None";return"Lax"}function Ce(e,T={}){let m=d(T);if(!b(m.storage))return null;let i=t(e,m),s=encodeURIComponent(o(i,m)),n=m.storage.cookie,h=`${n.name}=${s}; Path=${n.path}; Max-Age=${n.maxAge}; SameSite=${RT(n.sameSite)}`;if(n.secure)h+="; Secure";return h}function ee(e={}){if(typeof window>"u")return null;let T=d(e);if(ke(T.storage))try{let m=window.localStorage.getItem(T.storage.key),i=S(m);if(i)return t(i,T)}catch{}if(b(T.storage))return a(window.document.cookie,T);return null}function Te(e,T={}){if(typeof window>"u")return;let m=d(T),i=t(e,m),s=o(i,m);if(ke(m.storage))try{window.localStorage.setItem(m.storage.key,s)}catch{}if(b(m.storage)){let n=Ce(i,m);if(n)window.document.cookie=n}}function k(e,T){if(e===y.system)return T;return e}function V(){if(typeof window>"u"||typeof window.matchMedia!=="function")return y.light;return window.matchMedia("(prefers-color-scheme: dark)").matches?y.dark:y.light}function tT(e={}){let T=d(e),m=f(e.state?.theme),i=X(e.state?.colorScheme),s=t(e.state,T);if(f(e.cookieHeader)&&b(T.storage)){let h=a(e.cookieHeader,T);if(h)s=t({theme:m?e.state?.theme:h.theme,colorScheme:i?e.state?.colorScheme:h.colorScheme},T)}let n=Ke(e.systemColorScheme)?e.systemColorScheme:y.light;return{...s,resolvedColorScheme:k(s.colorScheme,n)}}function pT(e){return Me(e)&&Ke(e.resolvedColorScheme)}function He(e,T={},m=y.light){let i=d(T),s=t(e,i),n=pT(e)?{...s,resolvedColorScheme:e.resolvedColorScheme}:{...s,resolvedColorScheme:k(s.colorScheme,m)},h={[i.attribute]:n.theme};if(i.colorSchemeAttribute)h[i.colorSchemeAttribute]=n.colorScheme;return{attributes:h,className:n.resolvedColorScheme===y.dark?i.darkClassName:"",style:{colorScheme:n.resolvedColorScheme},state:n}}function me(e,T,m={}){let i=d(m),s=He(T,i,V());if(e.setAttribute(i.attribute,s.state.theme),i.attribute!==L)e.removeAttribute(L);if(i.colorSchemeAttribute){if(e.setAttribute(i.colorSchemeAttribute,s.state.colorScheme),i.colorSchemeAttribute!==K)e.removeAttribute(K)}else e.removeAttribute(K);if(s.state.resolvedColorScheme===y.dark)e.classList.add(i.darkClassName);else e.classList.remove(i.darkClassName);return e.style.colorScheme=s.state.resolvedColorScheme,s.state}function gT(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}function Ae(e,T){let m=Object.entries(T).filter(([s,n])=>f(s)&&f(n));if(m.length===0)return"";let i=m.map(([s,n])=>` --${s}: ${n};`).join(`
|
|
2
|
-
`);return`${e} {
|
|
3
|
-
${i}
|
|
4
|
-
}`}function Ge(e){let T=d({attribute:e.attribute,darkClassName:e.darkClassName,defaultTheme:e.theme}),m=be(e.theme,T.defaultTheme,[]),i=gT(m),s=`:root[${T.attribute}="${i}"]`,n=`${s}.${T.darkClassName}`,h=Ae(s,e.light),N=e.dark?Ae(n,e.dark):"";if(h&&N)return`${h}
|
|
5
|
-
|
|
6
|
-
${N}
|
|
7
|
-
`;if(h)return`${h}
|
|
8
|
-
`;if(N)return`${N}
|
|
9
|
-
`;return""}function ie(e){if(!Array.isArray(e.themes)||e.themes.length===0)return"";return e.themes.map((T)=>Ge({theme:T.theme,light:T.light,dark:T.dark,attribute:e.attribute,darkClassName:e.darkClassName})).filter(f).join(`
|
|
10
|
-
`)}import{createContext as NT,useCallback as _,useContext as dT,useEffect as J,useLayoutEffect as PT,useMemo as j,useRef as C,useState as Ye}from"react";import{jsxDEV as OT}from"react/jsx-dev-runtime";var $e=typeof window<"u"?PT:J,se=NT(null);function U(e,T){return e.theme===T.theme&&e.colorScheme===T.colorScheme}var W=({children:e,value:T,initialState:m,onChange:i,onStateChange:s,transformState:n,readState:h,writeState:N,syncWithSystem:O=!0,defaultTheme:u,defaultColorScheme:fe,themes:Re,attribute:te,colorSchemeAttribute:pe,darkClassName:ge,storage:Ne})=>{let R=j(()=>d({defaultTheme:u,defaultColorScheme:fe,themes:Re,attribute:te,colorSchemeAttribute:pe,darkClassName:ge,storage:Ne}),[u,fe,Re,te,pe,ge,Ne]),[We,Q]=Ye(()=>t(m,R)),[de,Ze]=Ye(V),p=j(()=>T?t(T,R):null,[T,R])??We,F=j(()=>({...p,resolvedColorScheme:k(p.colorScheme,de)}),[p,de]),A=T!==void 0,B=C(p);B.current=p;let Pe=C(!1),Oe=C(!1),c=C(p),H=C(null),qe=_((r)=>{return ee(r)},[]),Qe=_((r,g)=>{Te(r,g)},[]),ue=h??qe,Ee=N??Qe;J(()=>{if(!O||typeof window>"u"||typeof window.matchMedia!=="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{Ze(r.matches?y.dark:y.light)};return g(),r.addEventListener("change",g),()=>r.removeEventListener("change",g)},[O]),J(()=>{if(A)return;Q((r)=>{let g=t(r,R);return U(r,g)?r:g})},[R,A]),$e(()=>{if(A||Pe.current)return;Pe.current=!0;let r=ue(R);if(!r)return;let g=B.current,I=t(r,R),D={reason:"hydrate",previousState:g},w=n?t(n(I,D),R):I;if(U(g,w))return;H.current=D,Q(w),i?.(w,D),s?.(w,D)},[R,A,i,s,ue,n]),$e(()=>{if(typeof document>"u")return;me(document.documentElement,F,R)},[R,F]),J(()=>{if(typeof window>"u")return;if(!Oe.current){Oe.current=!0,c.current=p;return}let r=c.current;if(U(r,p))return;let g=H.current??{reason:"set-state",previousState:r};H.current=null,Ee(p,R,g),c.current=p},[R,p,Ee]);let E=_((r,g)=>{let I=B.current,D=typeof r==="function"?r(I):r,w=t({theme:D.theme??I.theme,colorScheme:D.colorScheme??I.colorScheme},R),G={reason:g,previousState:I},Y=n?t(n(w,G),R):w;if(U(I,Y))return;if(H.current=G,!A)Q(Y);i?.(Y,G),s?.(Y,G)},[R,A,i,s,n]),Ie=_((r)=>{E(r,"set-state")},[E]),xe=_((r)=>{E({theme:r},"set-theme")},[E]),Fe=_((r)=>{E({colorScheme:r},"set-color-scheme")},[E]),De=_(()=>{let r=F.resolvedColorScheme===y.dark?y.light:y.dark;E({colorScheme:r},"toggle-color-scheme")},[F.resolvedColorScheme,E]),Be=j(()=>({theme:p.theme,colorScheme:p.colorScheme,resolvedColorScheme:F.resolvedColorScheme,state:p,resolvedState:F,contract:R,themes:R.themes,setTheme:xe,setColorScheme:Fe,setState:Ie,toggleColorScheme:De}),[p,F,R,xe,Fe,Ie,De]);return OT(se.Provider,{value:Be,children:e},void 0,!1,void 0,this)};W.displayName="ThemeProvider";var ne=()=>{let e=dT(se);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e};import{jsxDEV as Z}from"react/jsx-dev-runtime";function q(e){return typeof e==="object"&&e!==null}function P(e){return typeof e==="string"&&e.trim().length>0}function Xe(e){if(!q(e))return!1;return Object.values(e).every(P)}function je(e){if(!q(e))return!1;if(!Xe(e.light))return!1;if(e.dark===void 0)return!0;return Xe(e.dark)}function Ue(e){return q(e)&&P(e.cssText)}function uT(e){return q(e)&&P(e.theme)}function he(e){return Error(`Invalid theme registry definition: ${e}`)}function Ve(e){let T=new Set,m=[];for(let i of e){if(!P(i)||T.has(i))continue;T.add(i),m.push(i)}return m}function ET(e){return e.filter(P).join(`
|
|
11
|
-
|
|
12
|
-
`)}function IT(e){let T=[],m=[],i=[];for(let[s,n]of Object.entries(e)){if(!P(s))continue;if(T.push(s),P(n)){i.push(n);continue}if(Ue(n)){i.push(n.cssText);continue}if(je(n)){m.push({theme:s,light:n.light,dark:n.dark});continue}throw he(`record key "${s}" has unsupported value shape`)}return{themeNames:T,tokenDefinitions:m,cssBlocks:i}}function xT(e){let T=[],m=[],i=[];for(let s of e){if(P(s)){T.push(s);continue}if(!uT(s))throw he("array entry must be a theme name or an object with `theme`");let n=s.theme;if(T.push(n),Ue(s)){i.push(s.cssText);continue}if(je(s)){m.push({theme:n,light:s.light,dark:s.dark});continue}throw he(`array entry "${n}" has unsupported value shape`)}return{themeNames:T,tokenDefinitions:m,cssBlocks:i}}function FT(e){if(Array.isArray(e))return xT(e);return IT(e)}function DT(e){return e}function Je(e){let{themes:T,cssText:m,...i}=e,s=FT(T),n=Ve(s.themeNames),h=d({...i,themes:n}),N=ie({themes:s.tokenDefinitions,attribute:h.attribute,darkClassName:h.darkClassName}),O=ET([N,...s.cssBlocks,m??""]),u=Ve(h.themes);if(u.length===0)u.push(h.defaultTheme);return{defaultTheme:h.defaultTheme,themes:u,cssText:O,contract:h}}function re({registry:e,children:T,...m}){return Z(W,{defaultTheme:e.defaultTheme,themes:e.themes,attribute:e.contract.attribute,colorSchemeAttribute:e.contract.colorSchemeAttribute,darkClassName:e.contract.darkClassName,storage:e.contract.storage,...m,children:T},void 0,!1,void 0,this)}re.displayName="ThemeRegistryProvider";function ye({registry:e,id:T,nonce:m,media:i}){if(!P(e.cssText))return null;return Z("style",{id:T,nonce:m,media:i,children:e.cssText},void 0,!1,void 0,this)}ye.displayName="ThemeStyles";function wT(e){let T=Je(e),{themes:m,cssText:i,...s}=e;return{registry:T,provider:({children:O,...u})=>{return Z(re,{registry:T,...s,...u,children:O},void 0,!1,void 0,this)},styles:(O={})=>{return Z(ye,{registry:T,...O},void 0,!1,void 0,this)},useTheme:()=>{return ne()}}}export{KT as a,ve as b,bT as c,kT as d,CT as e,$ as f,$T as g,XT as h,VT as i,jT as j,y as k,L as l,K as m,z as n,oe as o,Se as p,v as q,ae as r,l as s,d as t,t as u,o as v,S as w,a as x,Ce as y,ee as z,Te as A,V as B,tT as C,He as D,Ge as E,ie as F,W as G,ne as H,DT as I,Je as J,re as K,ye as L,wT as M};
|