Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
import { useSyncExternalStore } from 'react';
import {
type EditorSurface,
getSelectionStats,
subscribeSelectionStats,
} from '@/editor/selection-stats';
import type { DocumentStats } from '@/lib/document-stats';
export function useSelectionStats(
activeDocName: string | null,
surface: EditorSurface,
): DocumentStats | null {
return useSyncExternalStore(subscribeSelectionStats, () =>
getSelectionStats(activeDocName, surface),
);
}