import { trackSplit } from 'ripple';
import { type Component } from 'ripple';
import { useTreeViewNodeContext, type UseTreeViewNodeContext } from './use-tree-view-node-context';

export interface TreeViewNodeContextProps {
  children: Component<{ context: UseTreeViewNodeContext }>;
}

export component TreeViewNodeContext(props: TreeViewNodeContextProps) {
  const [children] = trackSplit(props, ['children']);
  const context = useTreeViewNodeContext();

  <@children {context} />
}
