{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "glass",
  "type": "registry:lib",
  "title": "Doto Glass helper",
  "description": "Shared Doto UI helper (Glass.tsx) used by several components.",
  "author": "Ahmad Raza (MrReal) <https://ahmadraza.cv>",
  "registryDependencies": [
    "https://doto-ui.ahmadraza.cv/r/doto-theme.json"
  ],
  "files": [
    {
      "path": "registry/doto-ui/glass.tsx",
      "content": "\"use client\";\n\nimport { useCallback, useRef, type ReactNode, type CSSProperties } from 'react';\n\n/**\n * Pointer-tracked specular highlight, written straight to CSS custom props\n * inside a single rAF so it never triggers a React re-render.\n */\nexport function useLens<T extends HTMLElement>() {\n  const ref = useRef<T>(null);\n  const frame = useRef(0);\n  const onPointerMove = useCallback((e: React.PointerEvent) => {\n    const el = ref.current;\n    if (!el) return;\n    const { clientX, clientY } = e;\n    if (frame.current) return;\n    frame.current = requestAnimationFrame(() => {\n      frame.current = 0;\n      const r = el.getBoundingClientRect();\n      el.style.setProperty('--mx', `${clientX - r.left}px`);\n      el.style.setProperty('--my', `${clientY - r.top}px`);\n    });\n  }, []);\n  return { ref, onPointerMove };\n}\n\ninterface GlassProps {\n  children?: ReactNode;\n  className?: string;\n  style?: CSSProperties;\n  radius?: string;\n  lens?: boolean;\n  dots?: boolean;\n  onClick?: () => void;\n}\n\n/** The core iOS 26 Liquid Glass surface. */\nexport function Glass({ children, className = '', style, radius = '24px', lens = false, dots = false, onClick }: GlassProps) {\n  const lensApi = useLens<HTMLDivElement>();\n  return (\n    <div\n      ref={lens ? lensApi.ref : undefined}\n      onPointerMove={lens ? lensApi.onPointerMove : undefined}\n      onClick={onClick}\n      className={`glass ${dots ? 'glass-dot' : ''} ${lens ? 'lens' : ''} ${className}`}\n      style={{ borderRadius: radius, ...style }}\n    >\n      {lens && <span className=\"lens-hl\" />}\n      {children}\n    </div>\n  );\n}\n\n/** iOS hairline separator */\nexport function Hairline({ className = '' }: { className?: string }) {\n  return <div className={`h-px w-full ${className}`} style={{ background: 'color-mix(in srgb, var(--doto-fg) 11%, transparent)' }} />;\n}\n\n/** Nothing OS mono label */\nexport function Mono({ children, className = '', style }: { children: ReactNode; className?: string; style?: CSSProperties }) {\n  return <span style={style} className={`font-mono text-[10px] tracking-[.28em] uppercase ${className}`}>{children}</span>;\n}\n\n/** iOS-style pressable with spring return */\nexport function Touch({\n  children, onClick, className = '', active = 'scale-[.955]', ariaLabel,\n}: { children: ReactNode; onClick?: () => void; className?: string; active?: string; ariaLabel?: string }) {\n  return (\n    <button aria-label={ariaLabel} onClick={onClick} className={`spring ${className} active:${active} select-none`}>\n      {children}\n    </button>\n  );\n}\n\n/** 24h → 12h clock helper */\nexport const fmtTime = (d: Date, h24 = false) =>\n  h24\n    ? `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`\n    : d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' });\n",
      "type": "registry:lib",
      "target": "@components/doto-ui/glass.tsx"
    }
  ]
}
