'use client' import { createContext, useContext } from 'react' import type { Character, Variable } from '@/types/flowchart' type EditorContextValue = { characters: Character[] onAddCharacter: (name: string, color: string) => string // returns new character id variables: Variable[] onAddVariable: (name: string, type: 'numeric' | 'string' | 'boolean', initialValue: number | string | boolean) => string // returns new variable id } const EditorContext = createContext({ characters: [], onAddCharacter: () => '', variables: [], onAddVariable: () => '', }) export const EditorProvider = EditorContext.Provider export function useEditorContext() { return useContext(EditorContext) }