{"version":3,"file":"icon-context.cjs","names":[],"sources":["../../src/icons/icon-context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\n\n/** A slug → icon-component table, as produced by `createIconRegistry`. */\nexport type IconRegistry = Readonly<Record<string, LucideIcon>>;\n\nexport interface IconContextValue {\n    registry: IconRegistry;\n    size: number | string | undefined;\n    strokeWidth: number | undefined;\n}\n\n/**\n * The icon context.\n *\n * Lives here rather than next to `IconProvider` so that the provider module\n * exports only a component — a file mixing components with other values breaks\n * Fast Refresh, which is what `react-refresh/only-export-components` guards.\n */\nexport const IconContext = createContext<IconContextValue | null>(null);\n\n/**\n * Build an icon registry from statically imported lucide components.\n *\n * The point is that the imports are static, so the bundler keeps exactly the\n * icons named here and tree-shakes the rest — the opposite of `DynamicIcon`,\n * which forces a chunk boundary for all ~2000 icons whether you use them or not.\n *\n * @example\n * import { createIconRegistry } from \"tempest-react-sdk/icons\";\n * import { Save, Trash2 } from \"lucide-react\";\n *\n * export const icons = createIconRegistry({ save: Save, \"trash-2\": Trash2 });\n *\n * @param icons - Slug → icon component.\n * @returns The registry, ready for `IconProvider`.\n */\nexport function createIconRegistry(icons: Record<string, LucideIcon>): IconRegistry {\n    return icons;\n}\n\n/**\n * Read the nearest icon context, or `null` outside a provider.\n *\n * @returns The context value, or `null`.\n */\nexport function useIconContext(): IconContextValue | null {\n    return useContext(IconContext);\n}\n"],"mappings":"uBAmBA,IAAa,GAAA,EAAc,EAAA,cAAA,CAAuC,IAAI,EAkBtE,SAAgB,EAAmB,EAAiD,CAChF,OAAO,CACX,CAOA,SAAgB,GAA0C,CACtD,OAAA,EAAO,EAAA,WAAA,CAAW,CAAW,CACjC"}