import React from 'react'; import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events'; import type { NumberLineValidationErrors } from '../controller/index.js'; import type { NumberLineArrows, NumberLineAvailableTypes, NumberLineConfiguration, NumberLineGraph, NumberLineModel, NumberLinePointType, NumberLineRay, NumberLineResponse, NumberLineTicks } from '../types.js'; /** The model the author edits; `createDefaultModel()` fills `graph` and `correctResponse`, and the host sets `errors` from the controller's `validate()`. */ export type AuthorModel = Partial & { graph: NumberLineGraph; correctResponse: NumberLineResponse[]; /** `rationale` is read, but `validate()` never sets it */ errors?: NumberLineValidationErrors & { rationale?: string; }; }; type MediaSupport = { add: (handler: Handler) => void; delete: (src: string, done: DeleteDone) => void; }; export type MainProps = { model: AuthorModel; configuration: NumberLineConfiguration; onConfigurationChanged: (configuration: NumberLineConfiguration) => void; onChange: (model: Partial) => void; imageSupport: MediaSupport; uploadSoundSupport: MediaSupport; }; type DialogState = { open: boolean; text?: string; }; type State = { dialog: DialogState; /** `indices` are the correct responses the graph change would drop; `graph` is the graph before it */ correctAnswerDialog: DialogState & { indices?: number[]; graph?: NumberLineGraph; }; }; /** A response in the delivery graph's format: a line's `position` holds both ends */ type GraphElement = { type: NumberLineResponse['type']; position: number | { left: number; right: number; }; pointType?: NumberLinePointType; direction?: NumberLineRay['direction']; leftPoint?: NumberLinePointType; rightPoint?: NumberLinePointType; }; export declare const toPointType: (response: NumberLineResponse) => string; export declare class Main extends React.Component { constructor(props: MainProps); componentDidMount(): void; graphChange: (obj: Partial) => void; changeSize: ({ width, height }: { width: number; height?: number; }) => void; getAdjustedHeight: (availableTypes: NumberLineAvailableTypes | undefined, maxNumberOfPoints: number | undefined) => number; changeMaxNoOfPoints: (_event: unknown, maxNumberOfPoints: number) => void; changeGraphTitle: (title: string) => void; changeTicks: (object: { ticks: NumberLineTicks; }) => void; reloadTicksData: (graph: NumberLineGraph) => NumberLineGraph; updateMajorValue: (graph: NumberLineGraph) => NumberLineGraph; changeArrows: (arrows: NumberLineArrows) => void; setDefaults: () => void; moveCorrectResponse: (index: number, el: GraphElement, position: GraphElement["position"]) => void; availableTypesChange: (availableTypes: NumberLineAvailableTypes) => void; deleteCorrectResponse: (indices: number[]) => void; addCorrectResponse: (data: GraphElement) => void; clearCorrectResponse: () => void; undoCorrectResponse: () => void; render(): React.JSX.Element; } export default Main;