/** * Exercise styles and settings (#1226): defaults, the words each document * language prints, `extends` chains, and stripping for storage. * * A configuration that names neither `exerciseStyles` nor `exercises` * resolves (and hashes) as before: the resolved config carries them only * when set, and {@link exerciseSettingsOf} gives the defaults otherwise. */ import type { ColorPaletteEntry, ColorValue, Dimension, ExerciseAnswersStyle, ExerciseArithmeticStyle, ExerciseAreaStyle, ExerciseBankStyle, ExerciseBlankStyle, ExerciseDigitalStyle, ExerciseGridStyle, ExerciseIcon, ExerciseInstructionStyle, ExerciseLevelStyle, ExerciseMatchStyle, ExerciseNumberStyle, ExerciseOptionsStyle, ExercisesConfig, ExerciseSolutionsConfig, ExerciseStyleConfig, ExerciseTrueFalseStyle, PostextConfig } from '../types.js'; /** The words the engine prints for exercises, in one language. */ export interface ExerciseWords { exercise: string; trueFalse: [string, string]; solutions: string; check: string; showSolution: string; hideSolution: string; reset: string; correct: string; wrong: string; hint: string; blank: string; /** "Exercise 3 ยท 2 of 5 right" */ score: string; /** A crossword's clue lists. */ across: string; down: string; } /** The words a document in `locale` prints (English for a language with * none of its own). */ export declare function exerciseWords(locale: string | undefined): ExerciseWords; export interface ResolvedExerciseNumber extends Required> { /** The word before the number, `''` for none. */ label: string; fontFamily?: string; /** Unset: white on a shape, else the main colour. */ color?: ColorValue; } export interface ResolvedExerciseStyle { id: string; name: string; box?: string; number: ResolvedExerciseNumber; instruction: ExerciseInstructionStyle & { bold: boolean; }; options: Required> & { columns?: number; }; blank: Required> & { color?: ColorValue; }; trueFalse: Required; match: Required> & { color: ColorValue; }; bank: Required> & { box?: string; }; area: Required> & { spacing?: Dimension; }; grid: Required> & Pick; arithmetic: Required; level: Required; icons: Record; answers: ExerciseAnswersStyle & { color: ColorValue; }; /** Over `exercises.solutions` (only the fields the style sets). */ solutions: ExerciseSolutionsConfig; digital: Required; marginTop: Dimension; marginBottom: Dimension; itemSpacing: Dimension; } export interface ResolvedExercisesConfig { edition: 'student' | 'teacher'; solutions: Required> & { box?: string; }; seed: number; digital: Required>; words: ExerciseWords; /** The document language (its primary subtag). */ language: string; } /** What the exercises of a document read. */ export interface ExerciseSettings { styles: ResolvedExerciseStyle[]; exercises: ResolvedExercisesConfig; } /** The style shipped when none is declared. */ export declare const DEFAULT_EXERCISE_STYLES: ExerciseStyleConfig[]; export declare function resolveExerciseStylesConfig(styles: ExerciseStyleConfig[] | undefined, locale: string | undefined, palette?: ColorPaletteEntry[]): ResolvedExerciseStyle[]; export declare function resolveExercisesConfig(config: ExercisesConfig | undefined, locale: string | undefined): ResolvedExercisesConfig; /** The exercise settings of a configuration (its defaults when it sets * none), in the document language `locale`. Memoised per config object. */ export declare function exerciseSettingsOf(config: Pick | undefined, locale: string | undefined): ExerciseSettings; /** The style an exercise picks: the matching id, else the first. */ export declare function pickExerciseStyle(styles: readonly ResolvedExerciseStyle[], id: string | undefined): ResolvedExerciseStyle; /** The solutions settings of a style: the book's, with the style's own * fields over them. */ export declare function solutionsOf(style: ResolvedExerciseStyle, book: ResolvedExercisesConfig): ResolvedExercisesConfig['solutions']; /** `exerciseStyles` for storage: `undefined` for the built-in default. */ export declare function stripExerciseStylesDefaults(styles: ExerciseStyleConfig[] | undefined): ExerciseStyleConfig[] | undefined; /** `exercises` for storage: the fields at their defaults dropped (the * solutions heading when it is the word of `locale`), `undefined` when * none is left. */ export declare function stripExercisesDefaults(config: ExercisesConfig | undefined, locale?: string): ExercisesConfig | undefined; //# sourceMappingURL=exercises.d.ts.map