import LocalLogicClient from "@local-logic/client"; import "@local-logic/core/style.css"; import { theme, useThemeSwitcher, type Themes } from "@local-logic/core/ui"; import React, { useContext } from "react"; interface LocalLogicProviderProps { client: ReturnType; options?: { appearance?: { theme?: Themes; variables?: Partial; }; /** * Removes animations and reduces stlying that does not print well (eg. * shadows, gradients). */ renderForPrint?: boolean; }; children: React.ReactNode; } interface DefaultContext { client: LocalLogicProviderProps["client"]; options: LocalLogicProviderProps["options"]; } const LocalLogicContext = React.createContext( {} as DefaultContext ); const useLocalLogic = () => useContext(LocalLogicContext); const LocalLogicProvider = ({ client, options, children, }: LocalLogicProviderProps) => { useThemeSwitcher({ themeName: options?.appearance?.theme, overrides: options?.appearance?.variables, }); return ( {children} ); }; export { useLocalLogic, LocalLogicProvider, LocalLogicContext };