import { type Accessor, createContext, useContext } from "solid-js"; /** * Value handed down by `` to descendant ``s. * A group-wide `disabled` flag cascades through — each button ORs it with * the toolbar-level `disabled` and its own `disabled` prop. */ export interface ToolbarGroupContextValue { disabled: Accessor; readonly present: boolean; } export const NOOP_TOOLBAR_GROUP_CONTEXT: ToolbarGroupContextValue = { disabled: () => false, present: false, }; export const ToolbarGroupContext = createContext( NOOP_TOOLBAR_GROUP_CONTEXT, ); export function useToolbarGroupContext(): ToolbarGroupContextValue { return useContext(ToolbarGroupContext); }