import { ActionUnion, BoundActionCreators } from '../utils/typedActions'; /** * @file Context for managing inline editing state of node titles and data */ import * as React from "react"; export type NodeId = string; export type InlineEditingState = { editingNodeId: NodeId | null; editingField: "title" | "data" | null; originalValue: string; currentValue: string; isActive: boolean; }; export declare const inlineEditingActions: { readonly startEditing: ((nodeId: string, field: "title" | "data", value: string) => { type: "START_EDITING"; payload: { nodeId: string; field: "title" | "data"; value: string; }; }) & { readonly type: "START_EDITING"; }; readonly updateValue: ((value: string) => { type: "UPDATE_VALUE"; payload: { value: string; }; }) & { readonly type: "UPDATE_VALUE"; }; readonly confirmEdit: (() => { type: "CONFIRM_EDIT"; }) & { readonly type: "CONFIRM_EDIT"; }; readonly cancelEdit: (() => { type: "CANCEL_EDIT"; }) & { readonly type: "CANCEL_EDIT"; }; readonly endEditing: (() => { type: "END_EDITING"; }) & { readonly type: "END_EDITING"; }; }; export type InlineEditingAction = ActionUnion; export declare const defaultInlineEditingState: InlineEditingState; export declare const inlineEditingReducer: (state: InlineEditingState, action: InlineEditingAction) => InlineEditingState; export type InlineEditingActionsValue = { dispatch: React.Dispatch; actions: BoundActionCreators; actionCreators: typeof inlineEditingActions; isEditing: (nodeId: NodeId, field?: "title" | "data") => boolean; startEditing: (nodeId: NodeId, field: "title" | "data", value: string) => void; updateValue: (value: string) => void; confirmEdit: () => void; cancelEdit: () => void; }; export type InlineEditingContextValue = InlineEditingActionsValue & { state: InlineEditingState; }; export declare const InlineEditingContext: React.Context; export type InlineEditingProviderProps = { children: React.ReactNode; initialState?: Partial; }; export declare const InlineEditingProvider: React.FC; /** * Hook to access only the inline editing state * Use this when you only need to read state and don't need actions */ export declare const useInlineEditingState: () => InlineEditingState; /** * Hook to access only the inline editing actions * Use this when you only need to dispatch actions and don't need to re-render on state changes * The returned actions have stable references and won't cause re-renders */ export declare const useInlineEditingActions: () => InlineEditingActionsValue; /** * Hook to access both state and actions (backward compatible) * Prefer useInlineEditingState or useInlineEditingActions for better performance */ export declare const useInlineEditing: () => InlineEditingContextValue;