{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-dpr-cap",
  "type": "registry:hook",
  "title": "useDprCap",
  "description": "Subtree-wide devicePixelRatio ceiling for GPU components. Wrap a gallery of shaders in DprCapContext to trade sharpness for fill rate without touching each component.",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/default/hooks/use-dpr-cap/use-dpr-cap.ts",
      "type": "registry:hook",
      "target": "hooks/use-dpr-cap.ts",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * A subtree-wide devicePixelRatio ceiling, applied on top of each component's\n * own `dpr` knob. A host running many GPU components at once — a gallery of\n * thumbnails, a dashboard of small charts — wraps them in a provider to trade\n * sharpness for fill rate without touching each component:\n *\n * ```tsx\n * <DprCapContext.Provider value={1}>{thumbnails}</DprCapContext.Provider>\n * ```\n *\n * Defaults to no cap.\n */\nexport const DprCapContext = React.createContext<number>(Infinity);\n\n/** The enclosing {@link DprCapContext} ceiling (Infinity when uncapped). */\nexport function useDprCap(): number {\n  return React.useContext(DprCapContext);\n}\n\n/**\n * `min(window.devicePixelRatio, ...caps)`. Reads `window`, so call it inside\n * effects or handlers only — never during render.\n */\nexport function clampDpr(...caps: number[]): number {\n  const device = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n  return Math.min(device, ...caps);\n}\n"
    }
  ]
}