/**
* React Hooks for LearnGraph
*
* Custom hooks for accessing graph data and learning state.
*
* @packageDocumentation
*/
import { type ReactNode } from 'react';
import type { SkillNode } from '../types/index.js';
import type { GraphStorage } from '../storage/index.js';
import type { LearnGraphContextValue, UseLearningPathOptions, UseLearningPathResult, UseZPDOptions, UseZPDResult } from './types.js';
/**
* Provider props
*/
export interface LearnGraphProviderProps {
/** Storage instance */
storage: GraphStorage;
/** Initial mastered skill IDs */
masteredSkillIds?: string[];
/** Children */
children: ReactNode;
}
/**
* LearnGraph context provider
*
* @example
* ```tsx
* import { LearnGraphProvider } from 'learngraph/components';
* import { MemoryStorage } from 'learngraph/storage';
*
* const storage = new MemoryStorage();
* await storage.connect({ backend: 'memory' });
*
* function App() {
* return (
*
*
*
* );
* }
* ```
*/
export declare function LearnGraphProvider({ storage, masteredSkillIds: initialMastered, children, }: LearnGraphProviderProps): JSX.Element;
/**
* Use LearnGraph context
*
* @example
* ```tsx
* function SkillList() {
* const { skills, isLoading } = useLearnGraph();
*
* if (isLoading) return
Loading...
;
*
* return (
*
* {skills.map(skill => (
* - {skill.name}
* ))}
*
* );
* }
* ```
*/
export declare function useLearnGraph(): LearnGraphContextValue;
/**
* Generate learning path to target skill
*
* @example
* ```tsx
* function PathToAlgebra() {
* const { steps, totalMinutes, isLoading } = useLearningPath({
* targetSkillId: 'algebra-101',
* masteredSkillIds: ['arithmetic'],
* });
*
* if (isLoading) return Loading...
;
*
* return (
*
*
Path to Algebra ({totalMinutes} min)
* {steps.map(step => (
*
{step.skill.name}
* ))}
*
* );
* }
* ```
*/
export declare function useLearningPath(options: UseLearningPathOptions): UseLearningPathResult;
/**
* Get Zone of Proximal Development skills
*
* @example
* ```tsx
* function NextSteps() {
* const { readyToLearn, almostReady, isLoading } = useZPD({
* masteredSkillIds: ['skill-1', 'skill-2'],
* limit: 5,
* });
*
* if (isLoading) return Loading...
;
*
* return (
*
*
Ready to Learn
* {readyToLearn.map(skill => (
*
{skill.name}
* ))}
*
* );
* }
* ```
*/
export declare function useZPD(options?: UseZPDOptions): UseZPDResult;
/**
* Use skill hook result
*/
export interface UseSkillResult {
skill: SkillNode | null;
prerequisites: SkillNode[];
dependents: SkillNode[];
isAvailable: boolean;
isMastered: boolean;
isLoading: boolean;
error: Error | null;
}
/**
* Get detailed skill information
*
* @example
* ```tsx
* function SkillDetails({ skillId }: { skillId: string }) {
* const { skill, prerequisites, isAvailable } = useSkill(skillId);
*
* if (!skill) return Skill not found
;
*
* return (
*
*
{skill.name}
*
{skill.description}
* {isAvailable &&
}
*
* );
* }
* ```
*/
export declare function useSkill(skillId: string): UseSkillResult;
/**
* Use filtered skills hook result
*/
export interface UseFilteredSkillsResult {
filteredSkills: SkillNode[];
availableTags: string[];
totalCount: number;
filteredCount: number;
}
/**
* Filter skills with various criteria
*
* @example
* ```tsx
* function FilteredList() {
* const { filteredSkills, availableTags } = useFilteredSkills({
* query: 'algebra',
* bloomLevels: ['apply', 'analyze'],
* tags: ['math'],
* });
*
* return (
*
* {filteredSkills.map(skill => (
* - {skill.name}
* ))}
*
* );
* }
* ```
*/
export declare function useFilteredSkills(filters: {
query?: string;
bloomLevels?: string[];
tags?: string[];
masteryStatus?: 'all' | 'mastered' | 'available' | 'locked';
sortBy?: 'name' | 'bloomLevel' | 'estimatedMinutes';
sortDirection?: 'asc' | 'desc';
}): UseFilteredSkillsResult;
//# sourceMappingURL=hooks.d.ts.map