@alkimi.org/ui-kit 0.9.1 → 0.9.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/dist/{chunk-VNF4HDJR.mjs → chunk-2CF4QASK.mjs} +2 -2
- package/dist/chunk-2CF4QASK.mjs.map +1 -0
- package/dist/chunk-CMV76O4U.mjs +3 -0
- package/dist/chunk-CMV76O4U.mjs.map +1 -0
- package/dist/chunk-EWRKHBIV.js +3 -0
- package/dist/chunk-EWRKHBIV.js.map +1 -0
- package/dist/{chunk-ZF6PO6PJ.js → chunk-I5INE4KG.js} +2 -2
- package/dist/{chunk-ZF6PO6PJ.js.map → chunk-I5INE4KG.js.map} +1 -1
- package/dist/chunk-MSYJFTUX.js +3 -0
- package/dist/{chunk-527KMCOG.js.map → chunk-MSYJFTUX.js.map} +1 -1
- package/dist/{chunk-RLO6XENU.js → chunk-RKONP3N6.js} +2 -2
- package/dist/{chunk-RLO6XENU.js.map → chunk-RKONP3N6.js.map} +1 -1
- package/dist/chunk-RYJZXDJ5.mjs +3 -0
- package/dist/chunk-RYJZXDJ5.mjs.map +1 -0
- package/dist/chunk-WY4HCUAP.mjs +3 -0
- package/dist/chunk-WY4HCUAP.mjs.map +1 -0
- package/dist/components/GeometricFluidGrid.js +1 -1
- package/dist/components/GeometricFluidGrid.mjs +1 -1
- package/dist/components/TextDecoder.d.mts +3 -2
- package/dist/components/TextDecoder.d.ts +3 -2
- package/dist/components/TextDecoder.js +1 -1
- package/dist/components/TextDecoder.mjs +1 -1
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/breadcrumb.mjs.map +1 -1
- package/dist/components/button.d.mts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.mjs +1 -1
- package/dist/components/command.d.mts +2 -2
- package/dist/components/command.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/label.mjs +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/slider.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-527KMCOG.js +0 -3
- package/dist/chunk-G7EYYKWS.js +0 -3
- package/dist/chunk-G7EYYKWS.js.map +0 -1
- package/dist/chunk-GOZDJRUZ.mjs +0 -3
- package/dist/chunk-GOZDJRUZ.mjs.map +0 -1
- package/dist/chunk-RGSVOR7N.mjs +0 -3
- package/dist/chunk-RGSVOR7N.mjs.map +0 -1
- package/dist/chunk-VNF4HDJR.mjs.map +0 -1
- package/dist/chunk-XFLIVHNV.mjs +0 -3
- package/dist/chunk-XFLIVHNV.mjs.map +0 -1
package/package.json
CHANGED
package/dist/chunk-527KMCOG.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var _chunkULIOO55Ijs = require('./chunk-ULIOO55I.js');var _chunkGVSERRZXjs = require('./chunk-GVSERRZX.js');var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var c = _interopRequireWildcard(_react);var _lucidereact = require('lucide-react');var _jsxruntime = require('react/jsx-runtime');function U({options:m=[],groups:s,value:i,onValueChange:M,placeholder:f="Select option...",searchPlaceholder:D="Search...",emptyMessage:E="No option found.",disabled:I=!1,className:T,error:L=!1,multiple:l=!1,values:r=[],onValuesChange:u}){let[g,v]=c.useState(!1),x=c.useMemo(()=>s?s.flatMap(e=>e.options):m,[s,m]),C=x.find(e=>e.value===i),a=x.filter(e=>r.includes(e.value)),X=e=>{if(l){let t=r.includes(e)?r.filter(d=>d!==e):[...r,e];_optionalChain([u, 'optionalCall', _ => _(t)])}else _optionalChain([M, 'optionalCall', _2 => _2(e===i?"":e)]),v(!1)},$=(e,t)=>{t.preventDefault(),t.stopPropagation();let d=r.filter(q=>q!==e);_optionalChain([u, 'optionalCall', _3 => _3(d)])},j=()=>l?a.length===0?f:a.length===1?a[0].label:`${a.length} selected`:C?C.label:f,h=e=>{let t=l?r.includes(e.value):i===e.value;return _jsxruntime.jsxs.call(void 0, _chunkGVSERRZXjs.h,{value:e.value,onSelect:X,children:[_jsxruntime.jsx.call(void 0, _lucidereact.Check,{className:_chunkFUYXCJOQjs.a.call(void 0, "mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:e.label})]},e.value)},y=()=>!l||a.length===0?null:_jsxruntime.jsx.call(void 0, "div",{className:"px-2 py-1.5",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-wrap gap-1",children:a.map(e=>_jsxruntime.jsxs.call(void 0, "div",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs",children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:e.label}),_jsxruntime.jsx.call(void 0, _lucidereact.X,{className:"h-3 w-3 cursor-pointer",onClick:t=>$(e.value,t)})]},e.value))})});return _jsxruntime.jsxs.call(void 0, _chunkULIOO55Ijs.a,{open:g,onOpenChange:v,children:[_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.b,{asChild:!0,children:_jsxruntime.jsxs.call(void 0, "button",{type:"button",role:"combobox","aria-expanded":g,disabled:I,className:_chunkFUYXCJOQjs.a.call(void 0, "cursor-pointer flex my-2 h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",!i&&!r.length&&"text-secondary-text",L&&"border-destructive-foreground focus-visible:ring-destructive-foreground",T),children:[_jsxruntime.jsx.call(void 0, "span",{className:"truncate",children:j()}),_jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),_jsxruntime.jsx.call(void 0, _chunkULIOO55Ijs.c,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:_jsxruntime.jsxs.call(void 0, _chunkGVSERRZXjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunkGVSERRZXjs.c,{placeholder:D}),_jsxruntime.jsxs.call(void 0, _chunkGVSERRZXjs.d,{children:[_jsxruntime.jsx.call(void 0, _chunkGVSERRZXjs.e,{children:E}),s?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[y(),s.map(e=>_jsxruntime.jsx.call(void 0, _chunkGVSERRZXjs.f,{heading:e.label,children:e.options.map(h)},e.label))]}):_jsxruntime.jsxs.call(void 0, _chunkGVSERRZXjs.f,{children:[y(),m.map(h)]})]})]})})]})}exports.a = U;
|
|
3
|
-
//# sourceMappingURL=chunk-527KMCOG.js.map
|
package/dist/chunk-G7EYYKWS.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }"use client";
|
|
2
|
-
var _chunkFUYXCJOQjs = require('./chunk-FUYXCJOQ.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jsxruntime = require('react/jsx-runtime');var j="!<>-_\\/[]{}\u2014=+*^?#________",D=e=>e[Math.floor(Math.random()*e.length)],M=e=>{if(typeof e=="string"||typeof e=="number")return String(e);if(Array.isArray(e))return e.map(M).join("");if(_react2.default.isValidElement(e)){let a=e.props;return(a.text||"")+(a.label||"")+(a.title||"")+M(a.children)}return""},R=(e,a,l)=>{if(typeof e=="string"||typeof e=="number"){let f=String(e),c=[];for(let p=0;p<f.length;p++)c.push(_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:a[l.current]||""},`char-${l.current}`)),l.current++;return c}if(Array.isArray(e))return e.map((f,c)=>_jsxruntime.jsx.call(void 0, _react2.default.Fragment,{children:R(f,a,l)},`arr-${c}-${l.current}`));if(_react2.default.isValidElement(e)){let f=e.props,c={};return f.children&&(c.children=R(f.children,a,l)),_react2.default.cloneElement(e,c)}return e},L=({children:e,className:a,duration:l=40,symbols:f=j,delay:c=0,isLoading:p=!1})=>{let[C,T]=_react.useState.call(void 0, null),[I,y]=_react.useState.call(void 0, !1),A=_react.useRef.call(void 0, null),d=_react.useRef.call(void 0, 0),N=_react.useRef.call(void 0, []),t=_react.useRef.call(void 0, null),x=_react.useRef.call(void 0, !1),m=_react.useMemo.call(void 0, ()=>M(e),[e]),_=()=>{let r=[];for(let u=0;u<m.length;u++){let n=m[u],o=Math.floor(Math.random()*(l*.5)),s=o+Math.floor(Math.random()*(l*.5));r.push({to:n,start:o,end:s})}N.current=r,d.current=0,y(!1)},g=_react.useRef.call(void 0, []),k=()=>{let r=[];g.current.length!==m.length&&(g.current=new Array(m.length).fill(void 0));for(let n=0;n<m.length;n++){let o=m[n];o===" "?r.push(" "):((!g.current[n]||Math.random()<.28)&&(g.current[n]=D(f)),r.push(_jsxruntime.jsxs.call(void 0, "span",{className:"relative inline-block",children:[_jsxruntime.jsx.call(void 0, "span",{className:"invisible select-none","aria-hidden":"true",children:o}),_jsxruntime.jsx.call(void 0, "span",{className:"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none",children:g.current[n]})]},n)))}T(R(e,r,{current:0})),t.current=requestAnimationFrame(k)},F=()=>{let r=0,u=[];for(let o=0;o<N.current.length;o++){let s=N.current[o];d.current>=s.end?(r++,u.push(s.to)):(d.current>=s.start&&(!s.char||Math.random()<.28)&&(s.char=D(f)),u.push(_jsxruntime.jsxs.call(void 0, "span",{className:"relative inline-block",children:[_jsxruntime.jsx.call(void 0, "span",{className:"invisible select-none","aria-hidden":"true",children:s.to===" "?"\xA0":s.to}),d.current>=s.start&&_jsxruntime.jsx.call(void 0, "span",{className:"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none",children:s.char})]},o)))}T(R(e,u,{current:0})),r===N.current.length?y(!0):(d.current++,t.current=requestAnimationFrame(F))},S=_react.useRef.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(p)return S.current=!0,x.current=!0,y(!1),t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(k),()=>{t.current&&cancelAnimationFrame(t.current)};if(S.current)return S.current=!1,_(),t.current=requestAnimationFrame(F),()=>{t.current&&cancelAnimationFrame(t.current)}},[p,m]),_react.useEffect.call(void 0, ()=>{if(p)return;let r=new IntersectionObserver(u=>{if(u[0].isIntersecting&&!x.current){x.current=!0;let n=setTimeout(()=>{_(),t.current=requestAnimationFrame(F)},c);return()=>clearTimeout(n)}},{threshold:.1});return A.current&&r.observe(A.current),()=>{r.disconnect(),t.current&&cancelAnimationFrame(t.current)}},[m,c,p]),_jsxruntime.jsx.call(void 0, "span",{ref:A,className:_chunkFUYXCJOQjs.a.call(void 0, "inline-block whitespace-pre-wrap",a),children:I?e:C})};function O(e){return _jsxruntime.jsx.call(void 0, _react.Suspense,{fallback:_jsxruntime.jsx.call(void 0, "span",{className:"invisible",children:e.children}),children:_jsxruntime.jsx.call(void 0, L,{...e})})}exports.a = O;
|
|
3
|
-
//# sourceMappingURL=chunk-G7EYYKWS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/admin/Desktop/PROJECTS/alkimi-ui-kit/dist/chunk-G7EYYKWS.js","../src/components/TextDecoder.tsx"],"names":["SYMBOLS","randomChar","symbols","extractText","node","React","props","injectScrambledText","scrambledChars","indexObj","text","result","i","jsx"],"mappings":"AAAA,qLAAY;AACZ,sDAAuC,4ECQhC,+CAgCC,IA9BFA,CAAAA,CAAU,kCAAA,CAEVC,CAAAA,CAAcC,CAAAA,EAClBA,CAAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,CAAO,CAAA,CAAIA,CAAAA,CAAQ,MAAM,CAAC,CAAA,CAE9CC,CAAAA,CAAeC,CAAAA,EAA4B,CAC/C,EAAA,CAAI,OAAOA,CAAAA,EAAS,QAAA,EAAY,OAAOA,CAAAA,EAAS,QAAA,CAAU,OAAO,MAAA,CAAOA,CAAI,CAAA,CAC5E,EAAA,CAAI,KAAA,CAAM,OAAA,CAAQA,CAAI,CAAA,CAAG,OAAOA,CAAAA,CAAK,GAAA,CAAID,CAAW,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA,CAC7D,EAAA,CAAIE,eAAAA,CAAM,cAAA,CAAeD,CAAI,CAAA,CAAG,CAC9B,IAAME,CAAAA,CAAQF,CAAAA,CAAK,KAAA,CACnB,MAAA,CACGE,CAAAA,CAAM,IAAA,EAAQ,EAAA,CAAA,CAAA,CACdA,CAAAA,CAAM,KAAA,EAAS,EAAA,CAAA,CAAA,CACfA,CAAAA,CAAM,KAAA,EAAS,EAAA,CAAA,CAChBH,CAAAA,CAAYG,CAAAA,CAAM,QAAQ,CAE9B,CACA,MAAO,EACT,CAAA,CAEMC,CAAAA,CAAsB,CAC1BH,CAAAA,CACAI,CAAAA,CACAC,CAAAA,CAAAA,EACc,CACd,EAAA,CAAI,OAAOL,CAAAA,EAAS,QAAA,EAAY,OAAOA,CAAAA,EAAS,QAAA,CAAU,CACxD,IAAMM,CAAAA,CAAO,MAAA,CAAON,CAAI,CAAA,CAClBO,CAAAA,CAAiC,CAAC,CAAA,CACxC,GAAA,CAAA,IAASC,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,CAAAA,CAAK,MAAA,CAAQE,CAAAA,EAAAA,CAC/BD,CAAAA,CAAO,IAAA,CACLE,6BAAAA,eAACR,CAAM,QAAA,CAAN,CACE,QAAA,CAAAG,CAAAA,CAAeC,CAAAA,CAAS,OAAO,CAAA,EAAK,EAAA,CAAA,CADlB,CAAA,KAAA,EAAQA,CAAAA,CAAS,OAAO,CAAA,CAAA","file":"/Users/admin/Desktop/PROJECTS/alkimi-ui-kit/dist/chunk-G7EYYKWS.js","sourcesContent":[null,"\"use client\"\nimport { cn } from \"@/lib/utils\"\nimport React, {\n useState,\n useEffect,\n useMemo,\n useRef,\n Suspense,\n ReactNode,\n} from \"react\"\n\nconst SYMBOLS = \"!<>-_\\\\/[]{}—=+*^?#________\"\n\nconst randomChar = (symbols: string) =>\n symbols[Math.floor(Math.random() * symbols.length)]\n\nconst extractText = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(extractText).join(\"\")\n if (React.isValidElement(node)) {\n const props = node.props as any\n return (\n (props.text || \"\") +\n (props.label || \"\") +\n (props.title || \"\") +\n extractText(props.children)\n )\n }\n return \"\"\n}\n\nconst injectScrambledText = (\n node: ReactNode,\n scrambledChars: (string | ReactNode)[],\n indexObj: { current: number }\n): ReactNode => {\n if (typeof node === \"string\" || typeof node === \"number\") {\n const text = String(node)\n const result: (string | ReactNode)[] = []\n for (let i = 0; i < text.length; i++) {\n result.push(\n <React.Fragment key={`char-${indexObj.current}`}>\n {scrambledChars[indexObj.current] || \"\"}\n </React.Fragment>\n )\n indexObj.current++\n }\n return result\n }\n\n if (Array.isArray(node)) {\n return node.map((child, idx) => (\n <React.Fragment key={`arr-${idx}-${indexObj.current}`}>\n {injectScrambledText(child, scrambledChars, indexObj)}\n </React.Fragment>\n ))\n }\n\n if (React.isValidElement(node)) {\n const props = node.props as any\n const newProps: any = {}\n\n if (props.children) {\n newProps.children = injectScrambledText(\n props.children,\n scrambledChars,\n indexObj\n )\n }\n return React.cloneElement(node, newProps)\n }\n return node\n}\n\nexport interface TextDecoderProps {\n children: ReactNode\n className?: string\n duration?: number\n symbols?: string\n delay?: number\n isLoading?: boolean\n}\n\nconst TextDecoder = ({\n children,\n className,\n duration = 40,\n symbols = SYMBOLS,\n delay = 0,\n isLoading = false,\n}: TextDecoderProps) => {\n const [outputNodes, setOutputNodes] = useState<ReactNode>(null)\n const [isComplete, setIsComplete] = useState(false)\n const elementRef = useRef<HTMLSpanElement>(null)\n const frameRef = useRef(0)\n const queueRef = useRef<\n { to: string; start: number; end: number; char?: string }[]\n >([])\n const rafRef = useRef<number | null>(null)\n const hasAnimatedRef = useRef(false)\n\n const fullText = useMemo(() => extractText(children), [children])\n\n const setupQueue = () => {\n const newQueue = []\n for (let i = 0; i < fullText.length; i++) {\n const to = fullText[i]\n const start = Math.floor(Math.random() * (duration * 0.5))\n const end = start + Math.floor(Math.random() * (duration * 0.5))\n newQueue.push({ to, start, end })\n }\n queueRef.current = newQueue\n frameRef.current = 0\n setIsComplete(false)\n }\n\n const loadingCharsRef = useRef<(string | undefined)[]>([])\n\n const updateLoading = () => {\n const currentScrambledChars: (string | ReactNode)[] = []\n\n if (loadingCharsRef.current.length !== fullText.length) {\n loadingCharsRef.current = new Array(fullText.length).fill(undefined)\n }\n\n for (let i = 0; i < fullText.length; i++) {\n const char = fullText[i]\n\n if (char === \" \") {\n currentScrambledChars.push(\" \")\n } else {\n if (!loadingCharsRef.current[i] || Math.random() < 0.28) {\n loadingCharsRef.current[i] = randomChar(symbols)\n }\n\n currentScrambledChars.push(\n <span key={i} className=\"relative inline-block\">\n <span className=\"invisible select-none\" aria-hidden=\"true\">\n {char}\n </span>\n <span className=\"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none\">\n {loadingCharsRef.current[i]}\n </span>\n </span>\n )\n }\n }\n\n const indexObj = { current: 0 }\n setOutputNodes(\n injectScrambledText(children, currentScrambledChars, indexObj)\n )\n\n rafRef.current = requestAnimationFrame(updateLoading)\n }\n\n const update = () => {\n let complete = 0\n const currentScrambledChars: (string | ReactNode)[] = []\n\n for (let i = 0; i < queueRef.current.length; i++) {\n const item = queueRef.current[i]\n\n if (frameRef.current >= item.end) {\n complete++\n currentScrambledChars.push(item.to)\n } else {\n if (frameRef.current >= item.start) {\n if (!item.char || Math.random() < 0.28) {\n item.char = randomChar(symbols)\n }\n }\n\n currentScrambledChars.push(\n <span key={i} className=\"relative inline-block\">\n <span className=\"invisible select-none\" aria-hidden=\"true\">\n {item.to === \" \" ? \"\\u00A0\" : item.to}\n </span>\n {frameRef.current >= item.start && (\n <span className=\"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none\">\n {item.char}\n </span>\n )}\n </span>\n )\n }\n }\n\n const indexObj = { current: 0 }\n setOutputNodes(\n injectScrambledText(children, currentScrambledChars, indexObj)\n )\n\n if (complete === queueRef.current.length) {\n setIsComplete(true)\n } else {\n frameRef.current++\n rafRef.current = requestAnimationFrame(update)\n }\n }\n\n const wasLoadingRef = useRef(false)\n\n useEffect(() => {\n if (isLoading) {\n wasLoadingRef.current = true\n hasAnimatedRef.current = true\n setIsComplete(false)\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n rafRef.current = requestAnimationFrame(updateLoading)\n return () => {\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }\n\n if (wasLoadingRef.current) {\n wasLoadingRef.current = false\n setupQueue()\n rafRef.current = requestAnimationFrame(update)\n return () => {\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }\n }, [isLoading, fullText])\n\n useEffect(() => {\n if (isLoading) return\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries[0].isIntersecting && !hasAnimatedRef.current) {\n hasAnimatedRef.current = true\n const timeoutId = setTimeout(() => {\n setupQueue()\n rafRef.current = requestAnimationFrame(update)\n }, delay)\n return () => clearTimeout(timeoutId)\n }\n },\n { threshold: 0.1 }\n )\n\n if (elementRef.current) observer.observe(elementRef.current)\n\n return () => {\n observer.disconnect()\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }, [fullText, delay, isLoading])\n\n return (\n <span\n ref={elementRef}\n className={cn(\"inline-block whitespace-pre-wrap\", className)}\n >\n {isComplete ? children : outputNodes}\n </span>\n )\n}\n\nexport default function SuspenseDecodedText(props: TextDecoderProps) {\n return (\n <Suspense fallback={<span className=\"invisible\">{props.children}</span>}>\n <TextDecoder {...props} />\n </Suspense>\n )\n}\n"]}
|
package/dist/chunk-GOZDJRUZ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as e}from"./chunk-S5TKCF6T.mjs";import*as a from"react";import{jsx as s}from"react/jsx-runtime";var r=a.forwardRef(({className:l,...t},o)=>s("label",{ref:o,className:e("text-sm mb-2 font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",l),...t}));r.displayName="Label";export{r as a};
|
|
3
|
-
//# sourceMappingURL=chunk-GOZDJRUZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/label.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm mb-2 font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className\n )}\n {...props}\n />\n )\n)\nLabel.displayName = \"Label\"\n\nexport { Label }\n"],"mappings":";yCAEA,UAAYA,MAAW,QAOnB,cAAAC,MAAA,oBAFJ,IAAMC,EAAc,aAClB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACxBJ,EAAC,SACC,IAAKI,EACL,UAAWC,EACT,kGACAH,CACF,EACC,GAAGC,EACN,CAEJ,EACAF,EAAM,YAAc","names":["React","jsx","Label","className","props","ref","cn"]}
|
package/dist/chunk-RGSVOR7N.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as N,b as w,c as O}from"./chunk-FZ3NXOFK.mjs";import{a as P,c as k,d as S,e as G,f as b,h as R}from"./chunk-U6XL5TKL.mjs";import{a as p}from"./chunk-S5TKCF6T.mjs";import*as c from"react";import{Check as z,ChevronDown as A,X as B}from"lucide-react";import{Fragment as F,jsx as o,jsxs as n}from"react/jsx-runtime";function U({options:m=[],groups:s,value:i,onValueChange:M,placeholder:f="Select option...",searchPlaceholder:D="Search...",emptyMessage:E="No option found.",disabled:I=!1,className:T,error:L=!1,multiple:l=!1,values:r=[],onValuesChange:u}){let[g,v]=c.useState(!1),x=c.useMemo(()=>s?s.flatMap(e=>e.options):m,[s,m]),C=x.find(e=>e.value===i),a=x.filter(e=>r.includes(e.value)),X=e=>{if(l){let t=r.includes(e)?r.filter(d=>d!==e):[...r,e];u?.(t)}else M?.(e===i?"":e),v(!1)},$=(e,t)=>{t.preventDefault(),t.stopPropagation();let d=r.filter(q=>q!==e);u?.(d)},j=()=>l?a.length===0?f:a.length===1?a[0].label:`${a.length} selected`:C?C.label:f,h=e=>{let t=l?r.includes(e.value):i===e.value;return n(R,{value:e.value,onSelect:X,children:[o(z,{className:p("mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),o("span",{className:"truncate",children:e.label})]},e.value)},y=()=>!l||a.length===0?null:o("div",{className:"px-2 py-1.5",children:o("div",{className:"flex flex-wrap gap-1",children:a.map(e=>n("div",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs",children:[o("span",{className:"truncate",children:e.label}),o(B,{className:"h-3 w-3 cursor-pointer",onClick:t=>$(e.value,t)})]},e.value))})});return n(N,{open:g,onOpenChange:v,children:[o(w,{asChild:!0,children:n("button",{type:"button",role:"combobox","aria-expanded":g,disabled:I,className:p("cursor-pointer flex my-2 h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",!i&&!r.length&&"text-secondary-text",L&&"border-destructive-foreground focus-visible:ring-destructive-foreground",T),children:[o("span",{className:"truncate",children:j()}),o(A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o(O,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:n(P,{children:[o(k,{placeholder:D}),n(S,{children:[o(G,{children:E}),s?n(F,{children:[y(),s.map(e=>o(b,{heading:e.label,children:e.options.map(h)},e.label))]}):n(b,{children:[y(),m.map(h)]})]})]})})]})}export{U as a};
|
|
3
|
-
//# sourceMappingURL=chunk-RGSVOR7N.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/combobox.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Check, ChevronDown, X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"@/components/command\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/popover\"\n\nexport interface ComboboxOption {\n value: string\n label: string\n}\n\nexport interface ComboboxGroup {\n label: string\n options: ComboboxOption[]\n}\n\nexport interface ComboboxProps {\n options?: ComboboxOption[]\n groups?: ComboboxGroup[]\n value?: string\n onValueChange?: (value: string) => void\n placeholder?: string\n searchPlaceholder?: string\n emptyMessage?: string\n disabled?: boolean\n className?: string\n error?: boolean\n multiple?: boolean\n values?: string[]\n onValuesChange?: (values: string[]) => void\n}\n\nexport function Combobox({\n options = [],\n groups,\n value,\n onValueChange,\n placeholder = \"Select option...\",\n searchPlaceholder = \"Search...\",\n emptyMessage = \"No option found.\",\n disabled = false,\n className,\n error = false,\n multiple = false,\n values = [],\n onValuesChange,\n}: ComboboxProps) {\n const [open, setOpen] = React.useState(false)\n\n const allOptions = React.useMemo(() => {\n if (groups) return groups.flatMap((g) => g.options)\n return options\n }, [groups, options])\n\n const selectedOption = allOptions.find((option) => option.value === value)\n const selectedOptions = allOptions.filter((option) =>\n values.includes(option.value)\n )\n\n const handleSelect = (currentValue: string) => {\n if (multiple) {\n const newValues = values.includes(currentValue)\n ? values.filter((v) => v !== currentValue)\n : [...values, currentValue]\n onValuesChange?.(newValues)\n } else {\n onValueChange?.(currentValue === value ? \"\" : currentValue)\n setOpen(false)\n }\n }\n\n const handleRemoveValue = (valueToRemove: string, e: React.MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n const newValues = values.filter((v) => v !== valueToRemove)\n onValuesChange?.(newValues)\n }\n\n const getDisplayText = () => {\n if (multiple) {\n if (selectedOptions.length === 0) return placeholder\n if (selectedOptions.length === 1) return selectedOptions[0].label\n return `${selectedOptions.length} selected`\n }\n return selectedOption ? selectedOption.label : placeholder\n }\n\n const renderOption = (option: ComboboxOption) => {\n const isSelected = multiple\n ? values.includes(option.value)\n : value === option.value\n\n return (\n <CommandItem\n key={option.value}\n value={option.value}\n onSelect={handleSelect}\n >\n <Check\n className={cn(\n \"mr-2 h-4 w-4\",\n isSelected ? \"opacity-100\" : \"opacity-0\"\n )}\n />\n <span className=\"truncate\">{option.label}</span>\n </CommandItem>\n )\n }\n\n const renderSelectedChips = () => {\n if (!multiple || selectedOptions.length === 0) return null\n\n return (\n <div className=\"px-2 py-1.5\">\n <div className=\"flex flex-wrap gap-1\">\n {selectedOptions.map((option) => (\n <div\n key={option.value}\n className=\"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs\"\n >\n <span className=\"truncate\">{option.label}</span>\n <X\n className=\"h-3 w-3 cursor-pointer\"\n onClick={(e) => handleRemoveValue(option.value, e)}\n />\n </div>\n ))}\n </div>\n </div>\n )\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n role=\"combobox\"\n aria-expanded={open}\n disabled={disabled}\n className={cn(\n \"cursor-pointer flex my-2 h-9 w-full items-center justify-between rounded-3xl border border-border bg-background hover:bg-secondary px-4 py-2 text-sm text-primary-accent ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n !value && !values.length && \"text-secondary-text\",\n error &&\n \"border-destructive-foreground focus-visible:ring-destructive-foreground\",\n className\n )}\n >\n <span className=\"truncate\">{getDisplayText()}</span>\n <ChevronDown className=\"ml-2 h-4 w-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n className=\"p-0\"\n align=\"start\"\n style={{ width: \"var(--radix-popover-trigger-width)\" }}\n >\n <Command>\n <CommandInput placeholder={searchPlaceholder} />\n <CommandList>\n <CommandEmpty>{emptyMessage}</CommandEmpty>\n {groups ? (\n <>\n {renderSelectedChips()}\n {groups.map((group) => (\n <CommandGroup key={group.label} heading={group.label}>\n {group.options.map(renderOption)}\n </CommandGroup>\n ))}\n </>\n ) : (\n <CommandGroup>\n {renderSelectedChips()}\n {options.map(renderOption)}\n </CommandGroup>\n )}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";4KAAA,UAAYA,MAAW,QACvB,OAAS,SAAAC,EAAO,eAAAC,EAAa,KAAAC,MAAS,eAoGhC,OAqEQ,YAAAC,EAhEN,OAAAC,EALF,QAAAC,MAAA,oBA7DC,SAASC,EAAS,CACvB,QAAAC,EAAU,CAAC,EACX,OAAAC,EACA,MAAAC,EACA,cAAAC,EACA,YAAAC,EAAc,mBACd,kBAAAC,EAAoB,YACpB,aAAAC,EAAe,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4B,CAAY,GAC3B,GAEJ,GACF,EACF,GACF,CAEJ","names":["React","Check","ChevronDown","X","Fragment","jsx","jsxs","Combobox","options","groups","value","onValueChange","placeholder","searchPlaceholder","emptyMessage","disabled","className","error","multiple","values","onValuesChange","open","setOpen","allOptions","g","selectedOption","option","selectedOptions","handleSelect","currentValue","newValues","v","handleRemoveValue","valueToRemove","e","getDisplayText","renderOption","isSelected","CommandItem","Check","cn","renderSelectedChips","X","Popover","PopoverTrigger","ChevronDown","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","group","CommandGroup"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GeometricFluidGrid.tsx"],"sourcesContent":["\"use client\"\nimport React, { useEffect, useRef } from \"react\"\n\n// --- CONFIGURATION ---\nconst GAP = 14\nconst BASE_SIZE = 1\nconst MAX_SIZE = 5\n\n// --- TYPES ---\ninterface Node {\n offsetX: number\n offsetY: number\n vx: number\n vy: number\n radius: number\n t: number\n}\n\ninterface GlitchZone {\n x: number\n y: number\n w: number\n h: number\n life: number\n}\n\ninterface MouseState {\n x: number\n y: number\n lastX: number\n lastY: number\n}\n\n// --- MATH HELPERS ---\nconst getFalloff = (dist: number, radius: number): number => {\n if (dist < radius) {\n const val = 1 - dist / radius\n return val * val * (3 - 2 * val)\n }\n return 0\n}\n\n// --- CLASSES ---\nclass AnchoredBlob {\n // Current Position\n x: number = 0\n y: number = 0\n\n // Anchor Position (Home base)\n anchorX: number = 0\n anchorY: number = 0\n\n // Movement\n vx: number = 0\n vy: number = 0\n\n // Appearance\n nodes: Node[] = []\n opacity: number = 0\n\n // Glitch State\n glitchZones: GlitchZone[] = []\n maxReach: number = 180\n\n constructor(anchorConfig: { x: number; y: number }) {\n this.anchorX = anchorConfig.x\n this.anchorY = anchorConfig.y\n this.x = this.anchorX\n this.y = this.anchorY\n this.init()\n }\n\n init() {\n // 1. Create Internal Nodes (The \"Blob\" composition)\n this.nodes = []\n const nodeCount = 3 + Math.floor(Math.random() * 3) // 3 to 5 nodes\n\n for (let i = 0; i < nodeCount; i++) {\n // Significantly smaller radius (15-40px) to reduce central bulk\n const r = 15 + Math.random() * 25\n // Wider initial spread\n const ox = (Math.random() - 0.5) * 60\n const oy = (Math.random() - 0.5) * 60\n\n this.nodes.push({\n offsetX: ox,\n offsetY: oy,\n vx: (Math.random() - 0.5) * 0.1, // Slower internal movement (was 0.4)\n vy: (Math.random() - 0.5) * 0.1,\n radius: r,\n t: Math.random() * 100,\n })\n }\n\n this.opacity = 1\n }\n\n update() {\n // --- 1. Tethered Movement Logic ---\n const dx = this.anchorX - this.x\n const dy = this.anchorY - this.y\n\n // Spring constant (very loose)\n const k = 0.0005\n const ax = dx * k\n const ay = dy * k\n\n // Random wandering force - Reduced significantly for slower drift\n const wx = (Math.random() - 0.5) * 0.01 // was 0.05\n const wy = (Math.random() - 0.5) * 0.01 // was 0.05\n\n this.vx += ax + wx\n this.vy += ay + wy\n\n this.vx *= 0.96\n this.vy *= 0.96\n\n this.x += this.vx\n this.y += this.vy\n\n // --- 2. Internal Node Animation ---\n this.nodes.forEach((node) => {\n // Slow down time step\n node.t += 0.005 // was 0.02\n\n // Slower oscillation and movement\n node.offsetX += Math.sin(node.t) * 0.1 + node.vx // amp was 0.4\n node.offsetY += Math.cos(node.t * 0.9) * 0.1 + node.vy\n\n // Constrain to \"nucleus\"\n const maxDist = 70\n if (node.offsetX > maxDist || node.offsetX < -maxDist) node.vx *= -1\n if (node.offsetY > maxDist || node.offsetY < -maxDist) node.vy *= -1\n\n // Pulse size\n node.radius += Math.sin(node.t * 2) * 0.1\n })\n\n // --- 3. Manage Glitch Zones ---\n // Remove dead glitches\n this.glitchZones = this.glitchZones.filter((g) => g.life > 0)\n this.glitchZones.forEach((g) => g.life--)\n\n // Randomly spawn new glitches\n if (Math.random() < 0.03) {\n // 3% chance per frame\n const spread = 80\n\n // Snap random positions to exact grid points to ensure clean lines\n const snap = (v: number) =>\n Math.round((v - GAP / 2) / GAP) * GAP + GAP / 2\n\n const rawCx = this.x + (Math.random() - 0.5) * spread\n const rawCy = this.y + (Math.random() - 0.5) * spread\n\n const cx = snap(rawCx)\n const cy = snap(rawCy)\n\n const type = Math.random() > 0.6 ? \"line\" : \"dot\"\n\n if (type === \"line\") {\n const isVert = Math.random() > 0.5\n // Medium length: 40-120px\n const len = 40 + Math.random() * 80\n\n // Thickness is essentially zero (just a sliver) centered on the grid line\n // to guarantee we only pick up exactly one row/column of dots\n const thickness = 2\n\n this.glitchZones.push({\n x: isVert ? cx - thickness / 2 : cx - len / 2,\n y: isVert ? cy - len / 2 : cy - thickness / 2,\n w: isVert ? thickness : len,\n h: isVert ? len : thickness,\n life: 8 + Math.random() * 12,\n })\n } else {\n // Single dot\n // Box just large enough to catch one grid point\n const size = 4\n\n this.glitchZones.push({\n x: cx - size / 2,\n y: cy - size / 2,\n w: size,\n h: size,\n life: 6 + Math.random() * 10,\n })\n }\n }\n }\n}\n\nclass TrailBlob {\n x: number\n y: number\n opacity: number\n decay: number\n nodes: Node[]\n maxReach: number = 60\n\n constructor(x: number, y: number) {\n this.x = x\n this.y = y\n this.opacity = 0.8\n this.decay = 0.03\n\n this.nodes = []\n const count = 2\n for (let i = 0; i < count; i++) {\n this.nodes.push({\n offsetX: (Math.random() - 0.5) * 10,\n offsetY: (Math.random() - 0.5) * 10,\n vx: (Math.random() - 0.5) * 1,\n vy: (Math.random() - 0.5) * 1,\n radius: 5 + Math.random() * 10,\n t: 0,\n })\n }\n }\n\n update() {\n this.opacity -= this.decay\n this.nodes.forEach((node) => {\n node.offsetX += node.vx\n node.offsetY += node.vy\n node.radius *= 0.95\n })\n }\n}\n\ninterface GeometricFluidGridProps {\n variant?: \"animated\" | \"static\"\n}\n\nconst GeometricFluidGrid: React.FC<GeometricFluidGridProps> = ({\n variant = \"animated\",\n}) => {\n const canvasRef = useRef<HTMLCanvasElement>(null)\n\n useEffect(() => {\n const canvas = canvasRef.current\n if (!canvas) return\n\n const ctx = canvas.getContext(\"2d\")\n if (!ctx) return\n\n let animationFrameId: number\n let orbs: AnchoredBlob[] = []\n let trail: TrailBlob[] = []\n let mouse: MouseState = { x: -1000, y: -1000, lastX: -1000, lastY: -1000 }\n\n const initWorld = () => {\n orbs = []\n const w = canvas.width\n const h = canvas.height\n\n // 1. Top Right\n orbs.push(\n new AnchoredBlob({\n x: w - w * 0.15,\n y: h * 0.15,\n })\n )\n\n // 2. ~40% from top and ~40% from left\n orbs.push(\n new AnchoredBlob({\n x: w * 0.4,\n y: h * 0.4,\n })\n )\n\n // 3. Bottom Left\n orbs.push(\n new AnchoredBlob({\n x: w * 0.05 + 50,\n y: h - h * 0.15,\n })\n )\n\n // 4. Bottom Right\n orbs.push(\n new AnchoredBlob({\n x: w - w * 0.05 - 50,\n y: h - h * 0.05 - 50,\n })\n )\n }\n\n const resize = () => {\n const rect = canvas.getBoundingClientRect()\n canvas.width = rect.width\n canvas.height = rect.height\n initWorld()\n }\n\n const handleMouseMove = (e: MouseEvent) => {\n const rect = canvas.getBoundingClientRect()\n mouse.x = e.clientX - rect.left\n mouse.y = e.clientY - rect.top\n\n if (mouse.lastX === -1000) {\n mouse.lastX = mouse.x\n mouse.lastY = mouse.y\n }\n\n const dx = mouse.x - mouse.lastX\n const dy = mouse.y - mouse.lastY\n const dist = Math.sqrt(dx * dx + dy * dy)\n\n if (dist > 20) {\n trail.push(new TrailBlob(mouse.x, mouse.y))\n mouse.lastX = mouse.x\n mouse.lastY = mouse.y\n }\n }\n\n const handleResize = () => {\n resize()\n }\n\n const draw = () => {\n const w = canvas.width\n const h = canvas.height\n\n // Clear Screen\n ctx.fillStyle = \"#050505\"\n ctx.fillRect(0, 0, w, h)\n\n // Static variant: just render uniform dots\n if (variant === \"static\") {\n for (let x = GAP / 2; x < w; x += GAP) {\n for (let y = GAP / 2; y < h; y += GAP) {\n ctx.fillStyle = \"rgba(255, 255, 255, 0.03)\"\n ctx.fillRect(x - 0.5, y - 0.5, 1, 1)\n }\n }\n return // No animation loop for static variant\n }\n\n // Animated variant: update and render with animations\n // Update Logic\n orbs.forEach((orb) => orb.update())\n for (let i = trail.length - 1; i >= 0; i--) {\n trail[i].update()\n if (trail[i].opacity <= 0) trail.splice(i, 1)\n }\n\n const renderList = [...orbs, ...trail]\n\n // Collect all glitch zones for easier checking inside the loop\n // We flat map them to a simple array to iterate quickly\n const allGlitches: GlitchZone[] = []\n orbs.forEach((o) => allGlitches.push(...o.glitchZones))\n\n for (let x = GAP / 2; x < w; x += GAP) {\n for (let y = GAP / 2; y < h; y += GAP) {\n // --- GLITCH CHECK ---\n // Check if this specific grid dot is inside a glitch zone\n let isGlitching = false\n for (const g of allGlitches) {\n // Simple AABB check\n if (x >= g.x && x <= g.x + g.w && y >= g.y && y <= g.y + g.h) {\n isGlitching = true\n break\n }\n }\n\n if (isGlitching) {\n // Glitched Dot: Bright\n // We use the grid itself to manifest the glitch\n ctx.fillStyle = \"rgba(182, 243, 191, 0.95)\"\n\n // Randomly skip some dots in the glitch line for a \"broken\" look\n if (Math.random() > 0.1) {\n const size = Math.random() > 0.5 ? MAX_SIZE * 0.7 : BASE_SIZE * 2\n ctx.beginPath()\n ctx.arc(x, y, size / 2, 0, Math.PI * 2)\n ctx.fill()\n }\n continue // Skip standard influence calculation for this dot\n }\n\n // --- STANDARD INFLUENCE CHECK ---\n let totalInfluence = 0\n\n // Optimization: Is near blob?\n let nearby = false\n for (const entity of renderList) {\n if (\n Math.abs(x - entity.x) < entity.maxReach &&\n Math.abs(y - entity.y) < entity.maxReach\n ) {\n nearby = true\n break\n }\n }\n\n if (!nearby) {\n // Passive Background Dot\n ctx.fillStyle = \"rgba(255, 255, 255, 0.03)\"\n ctx.fillRect(x - 0.5, y - 0.5, 1, 1)\n continue\n }\n\n // Calculate Influence\n for (const entity of renderList) {\n const dx = x - entity.x\n const dy = y - entity.y\n\n if (\n Math.abs(dx) > entity.maxReach ||\n Math.abs(dy) > entity.maxReach\n )\n continue\n\n let localInf = 0\n for (const node of entity.nodes) {\n const nx = dx - node.offsetX\n const ny = dy - node.offsetY\n const dist = Math.sqrt(nx * nx + ny * ny)\n localInf += getFalloff(dist, node.radius)\n }\n if (localInf > 1) localInf = 1\n totalInfluence += localInf * entity.opacity\n }\n\n if (totalInfluence > 1) totalInfluence = 1\n\n // Draw Cell\n if (totalInfluence > 0.01) {\n // Gradient: White (Edge) to Green (#B6F3BF - Center)\n const edgeR = 255,\n centerR = 182\n const edgeG = 255,\n centerG = 243\n const edgeB = 255,\n centerB = 191\n\n // Interpolate from White (0 influence) to Green (1 influence)\n const r = Math.floor(edgeR + (centerR - edgeR) * totalInfluence)\n const g = Math.floor(edgeG + (centerG - edgeG) * totalInfluence)\n const b = Math.floor(edgeB + (centerB - edgeB) * totalInfluence)\n\n const alpha = totalInfluence * 0.5\n const size = BASE_SIZE + totalInfluence * (MAX_SIZE - BASE_SIZE)\n\n ctx.fillStyle = `rgba(${r}, ${g}, ${b}, ${alpha})`\n ctx.beginPath()\n ctx.arc(x, y, size / 2, 0, Math.PI * 2)\n ctx.fill()\n } else {\n ctx.fillStyle = \"rgba(255, 255, 255, 0.03)\"\n ctx.fillRect(x - 0.5, y - 0.5, 1, 1)\n }\n }\n }\n\n animationFrameId = requestAnimationFrame(draw)\n }\n\n window.addEventListener(\"resize\", handleResize)\n if (variant === \"animated\") {\n window.addEventListener(\"mousemove\", handleMouseMove)\n }\n\n resize()\n draw()\n\n return () => {\n window.removeEventListener(\"resize\", handleResize)\n if (variant === \"animated\") {\n window.removeEventListener(\"mousemove\", handleMouseMove)\n }\n cancelAnimationFrame(animationFrameId)\n }\n }, [variant])\n\n return (\n <canvas\n ref={canvasRef}\n className=\"fixed inset-0 -z-999 w-full h-full pointer-events-none\"\n />\n )\n}\n\nexport default GeometricFluidGrid\n"],"mappings":";yCACA,OAAgB,aAAAA,EAAW,UAAAC,MAAc,QA+drC,cAAAC,MAAA,oBA5dJ,IAAMC,EAAM,GACNC,EAAY,EACZC,EAAW,EA4BXC,EAAa,CAACC,EAA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Y,4BAChBA,EAAI,SAAST,EAAI,GAAKC,EAAI,GAAK,EAAG,CAAC,CAEvC,CAGFS,EAAmB,sBAAsBW,CAAI,CAC/C,EAEA,cAAO,iBAAiB,SAAUD,CAAY,EAC1ChB,IAAY,YACd,OAAO,iBAAiB,YAAac,CAAe,EAGtDF,EAAO,EACPK,EAAK,EAEE,IAAM,CACX,OAAO,oBAAoB,SAAUD,CAAY,EAC7ChB,IAAY,YACd,OAAO,oBAAoB,YAAac,CAAe,EAEzD,qBAAqBR,CAAgB,CACvC,CACF,EAAG,CAACN,CAAO,CAAC,EAGVxC,EAAC,UACC,IAAKyC,EACL,UAAU,yDACZ,CAEJ,EAEO+B,EAAQjC","names":["useEffect","useRef","jsx","GAP","BASE_SIZE","MAX_SIZE","getFalloff","dist","radius","val","AnchoredBlob","anchorConfig","__publicField","nodeCount","i","r","ox","oy","dx","dy","k","ax","ay","wx","wy","node","maxDist","g","snap","v","rawCx","rawCy","cx","cy","isVert","len","thickness","TrailBlob","x","y","count","GeometricFluidGrid","variant","canvasRef","useRef","useEffect","canvas","ctx","animationFrameId","orbs","trail","mouse","initWorld","w","resize","rect","handleMouseMove","e","handleResize","draw","orb","renderList","allGlitches","o","isGlitching","size","totalInfluence","nearby","entity","localInf","nx","ny","b","alpha","GeometricFluidGrid_default"]}
|
package/dist/chunk-XFLIVHNV.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as v}from"./chunk-S5TKCF6T.mjs";import b,{useState as w,useEffect as q,useMemo as P,useRef as h,Suspense as $}from"react";import{jsx as i,jsxs as E}from"react/jsx-runtime";var j="!<>-_\\/[]{}\u2014=+*^?#________",D=e=>e[Math.floor(Math.random()*e.length)],M=e=>{if(typeof e=="string"||typeof e=="number")return String(e);if(Array.isArray(e))return e.map(M).join("");if(b.isValidElement(e)){let a=e.props;return(a.text||"")+(a.label||"")+(a.title||"")+M(a.children)}return""},R=(e,a,l)=>{if(typeof e=="string"||typeof e=="number"){let f=String(e),c=[];for(let p=0;p<f.length;p++)c.push(i(b.Fragment,{children:a[l.current]||""},`char-${l.current}`)),l.current++;return c}if(Array.isArray(e))return e.map((f,c)=>i(b.Fragment,{children:R(f,a,l)},`arr-${c}-${l.current}`));if(b.isValidElement(e)){let f=e.props,c={};return f.children&&(c.children=R(f.children,a,l)),b.cloneElement(e,c)}return e},L=({children:e,className:a,duration:l=40,symbols:f=j,delay:c=0,isLoading:p=!1})=>{let[C,T]=w(null),[I,y]=w(!1),A=h(null),d=h(0),N=h([]),t=h(null),x=h(!1),m=P(()=>M(e),[e]),_=()=>{let r=[];for(let u=0;u<m.length;u++){let n=m[u],o=Math.floor(Math.random()*(l*.5)),s=o+Math.floor(Math.random()*(l*.5));r.push({to:n,start:o,end:s})}N.current=r,d.current=0,y(!1)},g=h([]),k=()=>{let r=[];g.current.length!==m.length&&(g.current=new Array(m.length).fill(void 0));for(let n=0;n<m.length;n++){let o=m[n];o===" "?r.push(" "):((!g.current[n]||Math.random()<.28)&&(g.current[n]=D(f)),r.push(E("span",{className:"relative inline-block",children:[i("span",{className:"invisible select-none","aria-hidden":"true",children:o}),i("span",{className:"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none",children:g.current[n]})]},n)))}T(R(e,r,{current:0})),t.current=requestAnimationFrame(k)},F=()=>{let r=0,u=[];for(let o=0;o<N.current.length;o++){let s=N.current[o];d.current>=s.end?(r++,u.push(s.to)):(d.current>=s.start&&(!s.char||Math.random()<.28)&&(s.char=D(f)),u.push(E("span",{className:"relative inline-block",children:[i("span",{className:"invisible select-none","aria-hidden":"true",children:s.to===" "?"\xA0":s.to}),d.current>=s.start&&i("span",{className:"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none",children:s.char})]},o)))}T(R(e,u,{current:0})),r===N.current.length?y(!0):(d.current++,t.current=requestAnimationFrame(F))},S=h(!1);return q(()=>{if(p)return S.current=!0,x.current=!0,y(!1),t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(k),()=>{t.current&&cancelAnimationFrame(t.current)};if(S.current)return S.current=!1,_(),t.current=requestAnimationFrame(F),()=>{t.current&&cancelAnimationFrame(t.current)}},[p,m]),q(()=>{if(p)return;let r=new IntersectionObserver(u=>{if(u[0].isIntersecting&&!x.current){x.current=!0;let n=setTimeout(()=>{_(),t.current=requestAnimationFrame(F)},c);return()=>clearTimeout(n)}},{threshold:.1});return A.current&&r.observe(A.current),()=>{r.disconnect(),t.current&&cancelAnimationFrame(t.current)}},[m,c,p]),i("span",{ref:A,className:v("inline-block whitespace-pre-wrap",a),children:I?e:C})};function O(e){return i($,{fallback:i("span",{className:"invisible",children:e.children}),children:i(L,{...e})})}export{O as a};
|
|
3
|
-
//# sourceMappingURL=chunk-XFLIVHNV.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TextDecoder.tsx"],"sourcesContent":["\"use client\"\nimport { cn } from \"@/lib/utils\"\nimport React, {\n useState,\n useEffect,\n useMemo,\n useRef,\n Suspense,\n ReactNode,\n} from \"react\"\n\nconst SYMBOLS = \"!<>-_\\\\/[]{}—=+*^?#________\"\n\nconst randomChar = (symbols: string) =>\n symbols[Math.floor(Math.random() * symbols.length)]\n\nconst extractText = (node: ReactNode): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(extractText).join(\"\")\n if (React.isValidElement(node)) {\n const props = node.props as any\n return (\n (props.text || \"\") +\n (props.label || \"\") +\n (props.title || \"\") +\n extractText(props.children)\n )\n }\n return \"\"\n}\n\nconst injectScrambledText = (\n node: ReactNode,\n scrambledChars: (string | ReactNode)[],\n indexObj: { current: number }\n): ReactNode => {\n if (typeof node === \"string\" || typeof node === \"number\") {\n const text = String(node)\n const result: (string | ReactNode)[] = []\n for (let i = 0; i < text.length; i++) {\n result.push(\n <React.Fragment key={`char-${indexObj.current}`}>\n {scrambledChars[indexObj.current] || \"\"}\n </React.Fragment>\n )\n indexObj.current++\n }\n return result\n }\n\n if (Array.isArray(node)) {\n return node.map((child, idx) => (\n <React.Fragment key={`arr-${idx}-${indexObj.current}`}>\n {injectScrambledText(child, scrambledChars, indexObj)}\n </React.Fragment>\n ))\n }\n\n if (React.isValidElement(node)) {\n const props = node.props as any\n const newProps: any = {}\n\n if (props.children) {\n newProps.children = injectScrambledText(\n props.children,\n scrambledChars,\n indexObj\n )\n }\n return React.cloneElement(node, newProps)\n }\n return node\n}\n\nexport interface TextDecoderProps {\n children: ReactNode\n className?: string\n duration?: number\n symbols?: string\n delay?: number\n isLoading?: boolean\n}\n\nconst TextDecoder = ({\n children,\n className,\n duration = 40,\n symbols = SYMBOLS,\n delay = 0,\n isLoading = false,\n}: TextDecoderProps) => {\n const [outputNodes, setOutputNodes] = useState<ReactNode>(null)\n const [isComplete, setIsComplete] = useState(false)\n const elementRef = useRef<HTMLSpanElement>(null)\n const frameRef = useRef(0)\n const queueRef = useRef<\n { to: string; start: number; end: number; char?: string }[]\n >([])\n const rafRef = useRef<number | null>(null)\n const hasAnimatedRef = useRef(false)\n\n const fullText = useMemo(() => extractText(children), [children])\n\n const setupQueue = () => {\n const newQueue = []\n for (let i = 0; i < fullText.length; i++) {\n const to = fullText[i]\n const start = Math.floor(Math.random() * (duration * 0.5))\n const end = start + Math.floor(Math.random() * (duration * 0.5))\n newQueue.push({ to, start, end })\n }\n queueRef.current = newQueue\n frameRef.current = 0\n setIsComplete(false)\n }\n\n const loadingCharsRef = useRef<(string | undefined)[]>([])\n\n const updateLoading = () => {\n const currentScrambledChars: (string | ReactNode)[] = []\n\n if (loadingCharsRef.current.length !== fullText.length) {\n loadingCharsRef.current = new Array(fullText.length).fill(undefined)\n }\n\n for (let i = 0; i < fullText.length; i++) {\n const char = fullText[i]\n\n if (char === \" \") {\n currentScrambledChars.push(\" \")\n } else {\n if (!loadingCharsRef.current[i] || Math.random() < 0.28) {\n loadingCharsRef.current[i] = randomChar(symbols)\n }\n\n currentScrambledChars.push(\n <span key={i} className=\"relative inline-block\">\n <span className=\"invisible select-none\" aria-hidden=\"true\">\n {char}\n </span>\n <span className=\"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none\">\n {loadingCharsRef.current[i]}\n </span>\n </span>\n )\n }\n }\n\n const indexObj = { current: 0 }\n setOutputNodes(\n injectScrambledText(children, currentScrambledChars, indexObj)\n )\n\n rafRef.current = requestAnimationFrame(updateLoading)\n }\n\n const update = () => {\n let complete = 0\n const currentScrambledChars: (string | ReactNode)[] = []\n\n for (let i = 0; i < queueRef.current.length; i++) {\n const item = queueRef.current[i]\n\n if (frameRef.current >= item.end) {\n complete++\n currentScrambledChars.push(item.to)\n } else {\n if (frameRef.current >= item.start) {\n if (!item.char || Math.random() < 0.28) {\n item.char = randomChar(symbols)\n }\n }\n\n currentScrambledChars.push(\n <span key={i} className=\"relative inline-block\">\n <span className=\"invisible select-none\" aria-hidden=\"true\">\n {item.to === \" \" ? \"\\u00A0\" : item.to}\n </span>\n {frameRef.current >= item.start && (\n <span className=\"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none\">\n {item.char}\n </span>\n )}\n </span>\n )\n }\n }\n\n const indexObj = { current: 0 }\n setOutputNodes(\n injectScrambledText(children, currentScrambledChars, indexObj)\n )\n\n if (complete === queueRef.current.length) {\n setIsComplete(true)\n } else {\n frameRef.current++\n rafRef.current = requestAnimationFrame(update)\n }\n }\n\n const wasLoadingRef = useRef(false)\n\n useEffect(() => {\n if (isLoading) {\n wasLoadingRef.current = true\n hasAnimatedRef.current = true\n setIsComplete(false)\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n rafRef.current = requestAnimationFrame(updateLoading)\n return () => {\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }\n\n if (wasLoadingRef.current) {\n wasLoadingRef.current = false\n setupQueue()\n rafRef.current = requestAnimationFrame(update)\n return () => {\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }\n }, [isLoading, fullText])\n\n useEffect(() => {\n if (isLoading) return\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries[0].isIntersecting && !hasAnimatedRef.current) {\n hasAnimatedRef.current = true\n const timeoutId = setTimeout(() => {\n setupQueue()\n rafRef.current = requestAnimationFrame(update)\n }, delay)\n return () => clearTimeout(timeoutId)\n }\n },\n { threshold: 0.1 }\n )\n\n if (elementRef.current) observer.observe(elementRef.current)\n\n return () => {\n observer.disconnect()\n if (rafRef.current) cancelAnimationFrame(rafRef.current)\n }\n }, [fullText, delay, isLoading])\n\n return (\n <span\n ref={elementRef}\n className={cn(\"inline-block whitespace-pre-wrap\", className)}\n >\n {isComplete ? children : outputNodes}\n </span>\n )\n}\n\nexport default function SuspenseDecodedText(props: TextDecoderProps) {\n return (\n <Suspense fallback={<span className=\"invisible\">{props.children}</span>}>\n <TextDecoder {...props} />\n </Suspense>\n )\n}\n"],"mappings":";yCAEA,OAAOA,GACL,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EACA,YAAAC,MAEK,QAgCC,cAAAC,EA+FE,QAAAC,MA/FF,oBA9BR,IAAMC,EAAU,mCAEVC,EAAcC,GAClBA,EAAQ,KAAK,MAAM,KAAK,OAAO,EAAIA,EAAQ,MAAM,CAAC,EAE9CC,EAAeC,GAA4B,CAC/C,GAAI,OAAOA,GAAS,UAAY,OAAOA,GAAS,SAAU,OAAO,OAAOA,CAAI,EAC5E,GAAI,MAAM,QAAQA,CAAI,EAAG,OAAOA,EAAK,IAAID,CAAW,EAAE,KAAK,EAAE,EAC7D,GAAIX,EAAM,eAAeY,CAAI,EAAG,CAC9B,IAAMC,EAAQD,EAAK,MACnB,OACGC,EAAM,MAAQ,KACdA,EAAM,OAAS,KACfA,EAAM,OAAS,IAChBF,EAAYE,EAAM,QAAQ,CAE9B,CACA,MAAO,EACT,EAEMC,EAAsB,CAC1BF,EACAG,EACAC,IACc,CACd,GAAI,OAAOJ,GAAS,UAAY,OAAOA,GAAS,SAAU,CACxD,IAAMK,EAAO,OAAOL,CAAI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,EACR,MAAO,IAAM,aAAa2B,CAAS,CACrC,CACF,EACA,CAAE,UAAW,EAAI,CACnB,EAEA,OAAIrB,EAAW,SAASmB,EAAS,QAAQnB,EAAW,OAAO,EAEpD,IAAM,CACXmB,EAAS,WAAW,EAChBhB,EAAO,SAAS,qBAAqBA,EAAO,OAAO,CACzD,CACF,EAAG,CAACE,EAAUX,EAAOC,CAAS,CAAC,EAG7BtB,EAAC,QACC,IAAK2B,EACL,UAAWsB,EAAG,mCAAoC9B,CAAS,EAE1D,SAAAM,EAAaP,EAAWK,EAC3B,CAEJ,EAEe,SAAR2B,EAAqC3C,EAAyB,CACnE,OACEP,EAACD,EAAA,CAAS,SAAUC,EAAC,QAAK,UAAU,YAAa,SAAAO,EAAM,SAAS,EAC9D,SAAAP,EAACiB,EAAA,CAAa,GAAGV,EAAO,EAC1B,CAEJ","names":["React","useState","useEffect","useMemo","useRef","Suspense","jsx","jsxs","SYMBOLS","randomChar","symbols","extractText","node","props","injectScrambledText","scrambledChars","indexObj","text","result","i","child","idx","newProps","TextDecoder","children","className","duration","delay","isLoading","outputNodes","setOutputNodes","isComplete","setIsComplete","elementRef","frameRef","queueRef","rafRef","hasAnimatedRef","fullText","setupQueue","newQueue","to","start","end","loadingCharsRef","updateLoading","currentScrambledChars","char","update","complete","item","wasLoadingRef","observer","entries","timeoutId","cn","SuspenseDecodedText"]}
|