@khanacademy/perseus-core 28.1.0 → 28.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -298,7 +298,10 @@ export type PerseusImageDetail = {
298
298
  * not material to testing understanding of the skill).
299
299
  */
300
300
  export declare const ItemExtras: readonly ["calculator", "financialCalculatorMonthlyPayment", "financialCalculatorTotalAmount", "financialCalculatorTimeToPayOff", "periodicTable", "periodicTableWithKey"];
301
- export type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean>;
301
+ export type CalculatorVariant = "scientific" | "graphing" | "four_function";
302
+ export type PerseusAnswerArea = Record<(typeof ItemExtras)[number], boolean> & {
303
+ calculatorVariant: CalculatorVariant | null;
304
+ };
302
305
  /**
303
306
  * The type representing the common structure of all widget's options. The
304
307
  * `Options` generic type represents the widget-specific option data.
@@ -144,7 +144,7 @@ union(parsePerseusRenderer).or(array(parsePerseusRenderer)).parser;
144
144
 
145
145
  const parseHint=object({replace:defaulted(optional(boolean),()=>undefined),placeholder:defaulted(optional(boolean),()=>undefined),content:string,widgets:defaulted(parseWidgetsMap,()=>({})),images:parseImages,metadata:any});
146
146
 
147
- const booleanOrFalse=defaulted(boolean,()=>false);const parsePerseusAnswerArea=defaulted(object({calculator:booleanOrFalse,financialCalculatorMonthlyPayment:booleanOrFalse,financialCalculatorTotalAmount:booleanOrFalse,financialCalculatorTimeToPayOff:booleanOrFalse,periodicTable:booleanOrFalse,periodicTableWithKey:booleanOrFalse}),()=>({calculator:false,financialCalculatorMonthlyPayment:false,financialCalculatorTotalAmount:false,financialCalculatorTimeToPayOff:false,periodicTable:false,periodicTableWithKey:false}));
147
+ const booleanOrFalse=defaulted(boolean,()=>false);const nullableCalculatorVariant=defaulted(nullable(enumeration("scientific","graphing","four_function")),()=>null);const baseParser=defaulted(object({calculator:booleanOrFalse,calculatorVariant:nullableCalculatorVariant,financialCalculatorMonthlyPayment:booleanOrFalse,financialCalculatorTotalAmount:booleanOrFalse,financialCalculatorTimeToPayOff:booleanOrFalse,periodicTable:booleanOrFalse,periodicTableWithKey:booleanOrFalse}),()=>({calculator:false,calculatorVariant:null,financialCalculatorMonthlyPayment:false,financialCalculatorTotalAmount:false,financialCalculatorTimeToPayOff:false,periodicTable:false,periodicTableWithKey:false}));const parsePerseusAnswerArea=pipeParsers(baseParser).then(convert(parsed=>{const calculatorVariant=parsed.calculator&&parsed.calculatorVariant===null?"scientific":parsed.calculatorVariant;return {...parsed,calculatorVariant}})).parser;
148
148
 
149
149
  const parsePerseusItem=object({question:parsePerseusRenderer,hints:defaulted(array(parseHint),()=>[]),answerArea:parsePerseusAnswerArea});
150
150