import * as PerseusLinter from "@khanacademy/perseus-linter"; /** * The main item (aka Exercise) renderer in Perseus. This component renders its * question renderer and hints renderer using standard React practices (an * earlier ItemRenderer component used to use jQuery and ReactDOM.render()ing * to render into elements it didn't own. * * This component is compatible with server-rendering of a perseus exercise. */ import * as React from "react"; import { PerseusI18nContext } from "./components/i18n-context"; import Renderer from "./renderer"; import type { FocusPath, PerseusDependenciesV2, SharedRendererProps } from "./types"; import type { GetPromptJSONInterface, RendererPromptJSON } from "./widget-ai-utils/prompt-types"; import type { KeypadAPI } from "@khanacademy/math-input"; import type { PerseusItem, ShowSolutions, KeypadContextRendererInterface, RendererInterface, UserInputMap } from "@khanacademy/perseus-core"; type OwnProps = { hintsVisible?: number; item: PerseusItem; problemNum?: number; reviewMode?: boolean; highlightEmptyWidgets?: boolean; keypadElement?: KeypadAPI | null | undefined; dependencies: PerseusDependenciesV2; showSolutions?: ShowSolutions; }; type HOCProps = { onRendered: (isRendered: boolean) => void; }; type Props = SharedRendererProps & OwnProps & HOCProps; type DefaultProps = Required>; type State = { /** * Keeps track of whether each asset (SvgImage or TeX) rendered by * the questionRenderer has finished loading or rendering. */ assetStatuses: { [assetKey: string]: boolean; }; }; /** * @deprecated and likely a very broken API * [LEMS-3185] do not trust serializedState */ type SerializedState = { question: any; hints: any; }; export declare class ServerItemRenderer extends React.Component implements RendererInterface, KeypadContextRendererInterface, GetPromptJSONInterface { static contextType: React.Context; context: React.ContextType; questionRenderer: Renderer; hintsRenderer: any; _currentFocus: FocusPath; _fullyRendered: boolean; blurTimeoutID: number | null | undefined; userInput: UserInputMap; static defaultProps: DefaultProps; constructor(props: Props); componentDidMount(): void; componentDidUpdate(): void; componentWillUnmount(): void; maybeCallOnRendered(): void; _handleFocusChange: (newFocus: FocusPath, oldFocus: FocusPath) => void; _setCurrentFocus(newFocus: FocusPath): void; _onRendererBlur(blurPath: FocusPath): void; focusPath(path: FocusPath): void; blurPath(path: FocusPath): void; getDOMNodeForPath(path: FocusPath): Element | Text | null | undefined; getInputPaths(): ReadonlyArray; focus(): boolean | null | undefined; blur(): void; getNumHints(): number; getPromptJSON(): RendererPromptJSON; /** * Returns an object of the widget `.getUserInput()` results */ getUserInput(): UserInputMap; /** * Returns an array of all widget IDs in the order they occur in * the question content. */ getWidgetIds(): ReadonlyArray; /** * Get a representation of the current state of the item. */ /** * @deprecated - do not use in new code. */ getSerializedState(): SerializedState; setAssetStatus: (assetKey: string, status: boolean) => void; render(): React.ReactNode; } declare const _default: React.ForwardRefExoticComponent & { apiOptions?: Readonly<{ isArticle?: boolean; onFocusChange?: (newFocusPath: FocusPath, oldFocusPath: FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown; showAlignmentOptions?: boolean; readOnly?: boolean; editingDisabled?: boolean; answerableCallback?: (arg1: boolean) => unknown; getAnotherHint?: () => unknown; interactionCallback?: (widgetData: { [widgetId: string]: any; }) => void; imagePlaceholder?: React.ReactNode; widgetPlaceholder?: React.ReactNode; baseElements?: { Link: React.ComponentType; }; imagePreloader?: (dimensions: import("./types").Dimensions) => React.ReactNode; trackInteraction?: (args: { type: string; id: string; correct?: boolean; } & Partial & Partial<{ visible: number; }>) => void; customKeypad?: boolean; nativeKeypadProxy?: (blur: () => void) => KeypadAPI; isMobile?: boolean; isMobileApp?: boolean; setDrawingAreaAvailable?: (arg1: boolean) => unknown; hintProgressColor?: string; canScrollPage?: boolean; editorChangeDelay?: number; flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale", boolean>; }> | undefined; linterContext?: PerseusLinter.LinterContextProps | undefined; onRendered?: ((isRendered: boolean) => void) | undefined; } & {}, "onRendered"> & React.RefAttributes>; export default _default;