@khanacademy/perseus-core 34.1.0 → 36.0.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.
- package/dist/data-schema.d.ts +16 -3
- package/dist/es/index.item-splitting.js +7 -5
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +20 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.item-splitting.js +7 -5
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/object.d.ts +0 -19
- package/dist/parse-perseus-json/perseus-parsers/blank-user-input.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/blank-user-input.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/blank-widget.d.ts +15 -0
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +22 -11
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.d.ts +16 -5
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +21 -10
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/expression-widget.d.ts +27 -16
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +24 -13
- package/dist/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +60 -49
- package/dist/parse-perseus-json/perseus-parsers/group-widget.d.ts +12 -1
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +23 -12
- package/dist/parse-perseus-json/perseus-parsers/image-widget.d.ts +34 -23
- package/dist/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +45 -23
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +135 -124
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +375 -364
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +27 -16
- package/dist/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +17 -6
- package/dist/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +28 -17
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +28 -17
- package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +15 -4
- package/dist/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +15 -4
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.d.ts +138 -83
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +16 -5
- package/dist/parse-perseus-json/perseus-parsers/table-widget.d.ts +17 -6
- package/dist/parse-perseus-json/perseus-parsers/video-widget.d.ts +14 -3
- package/dist/parse-perseus-json/perseus-parsers/widget.d.ts +25 -4
- package/dist/types.d.ts +0 -1
- package/dist/utils/generators/blank-widget-generator.d.ts +3 -0
- package/dist/utils/generators/number-line-widget-generator.d.ts +3 -0
- package/dist/utils/generators/orderer-widget-generator.d.ts +9 -0
- package/dist/validation.types.d.ts +13 -0
- package/dist/widgets/blank/blank-util.d.ts +7 -0
- package/dist/widgets/blank/index.d.ts +5 -0
- package/dist/widgets/core-widget-registry.d.ts +1 -2
- package/dist/widgets/logic-export.types.d.ts +1 -2
- package/package.json +1 -1
package/dist/data-schema.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ export type MakeWidgetMap<TRegistry> = {
|
|
|
134
134
|
* @see {@link https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation}
|
|
135
135
|
*/
|
|
136
136
|
export interface PerseusWidgetTypes {
|
|
137
|
+
blank: BlankWidget;
|
|
137
138
|
categorizer: CategorizerWidget;
|
|
138
139
|
"cs-program": CSProgramWidget;
|
|
139
140
|
definition: DefinitionWidget;
|
|
@@ -292,6 +293,7 @@ export type PerseusImageDetail = {
|
|
|
292
293
|
/** the height of the image */
|
|
293
294
|
height: number;
|
|
294
295
|
};
|
|
296
|
+
export type Alignment = "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width";
|
|
295
297
|
/**
|
|
296
298
|
* ItemExtras represent extra UI elements that help the learner in answering
|
|
297
299
|
* the question (such as a calculator for questions where solving by hand is
|
|
@@ -340,7 +342,7 @@ export type WidgetOptions<Type extends string, Options extends Record<string, an
|
|
|
340
342
|
* widget logic, which can be various other alignments (e.g.
|
|
341
343
|
* "inline-block", "inline", etc).
|
|
342
344
|
*/
|
|
343
|
-
alignment?:
|
|
345
|
+
alignment?: Alignment;
|
|
344
346
|
/**
|
|
345
347
|
* Options specific to the type field of the widget. See Perseus*WidgetOptions for
|
|
346
348
|
* more details
|
|
@@ -359,6 +361,7 @@ export type WidgetOptions<Type extends string, Options extends Record<string, an
|
|
|
359
361
|
*/
|
|
360
362
|
version?: Version;
|
|
361
363
|
};
|
|
364
|
+
export type BlankWidget = WidgetOptions<'blank', PerseusBlankWidgetOptions>;
|
|
362
365
|
export type CategorizerWidget = WidgetOptions<'categorizer', PerseusCategorizerWidgetOptions>;
|
|
363
366
|
export type CSProgramWidget = WidgetOptions<'cs-program', PerseusCSProgramWidgetOptions>;
|
|
364
367
|
export type DefinitionWidget = WidgetOptions<'definition', PerseusDefinitionWidgetOptions>;
|
|
@@ -418,6 +421,13 @@ export type PerseusImageBackground = {
|
|
|
418
421
|
*/
|
|
419
422
|
export type MarkingsType = "axes" | "graph" | "grid" | "none";
|
|
420
423
|
export type AxisLabelLocation = "onAxis" | "alongEdge";
|
|
424
|
+
/** Options for the blank widget, used within "Drag And Drop" widgets as the dropzone for answer tiles */
|
|
425
|
+
export type PerseusBlankWidgetOptions = {
|
|
426
|
+
/** Display Type for how the blank should be rendered */
|
|
427
|
+
displayType: "normal" | "superscript" | "subscript";
|
|
428
|
+
/** ID for the correct answer tile for the blank */
|
|
429
|
+
correctId: string;
|
|
430
|
+
};
|
|
421
431
|
/** Options for the categorizer widget. Presents items to sort into groups. */
|
|
422
432
|
export type PerseusCategorizerWidgetOptions = {
|
|
423
433
|
/**
|
|
@@ -1903,7 +1913,10 @@ export type PerseusIFrameWidgetOptions = {
|
|
|
1903
1913
|
height: number | string;
|
|
1904
1914
|
/** Whether to allow the IFrame to become full-screen (like a video) */
|
|
1905
1915
|
allowFullScreen: boolean;
|
|
1906
|
-
/**
|
|
1916
|
+
/**
|
|
1917
|
+
* Whether to allow the iframe content to redirect the page
|
|
1918
|
+
* @deprecated - not used in Perseus.
|
|
1919
|
+
*/
|
|
1907
1920
|
allowTopNavigation?: boolean;
|
|
1908
1921
|
/** Always false */
|
|
1909
1922
|
static: boolean;
|
|
@@ -1923,5 +1936,5 @@ export type PerseusVideoWidgetOptions = {
|
|
|
1923
1936
|
};
|
|
1924
1937
|
export type PerseusInputNumberAnswer = PerseusNumericInputAnswer;
|
|
1925
1938
|
export type PerseusInputNumberWidgetOptions = PerseusNumericInputWidgetOptions;
|
|
1926
|
-
export type PerseusWidgetOptions = PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusFreeResponseWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPhetSimulationWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusVideoWidgetOptions;
|
|
1939
|
+
export type PerseusWidgetOptions = PerseusBlankWidgetOptions | PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusFreeResponseWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPhetSimulationWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusVideoWidgetOptions;
|
|
1927
1940
|
export {};
|
|
@@ -30,7 +30,7 @@ function nullable(parseValue){return (rawValue,ctx)=>{if(rawValue===null){return
|
|
|
30
30
|
|
|
31
31
|
const number=(rawValue,ctx)=>{if(typeof rawValue==="number"&&Number.isFinite(rawValue)){return ctx.success(rawValue)}return ctx.failure("number",rawValue)};
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function object(schema){return objectParserWithInitializer(()=>({}),schema)}function looseObject(schema){return objectParserWithInitializer(rawValue=>({...rawValue}),schema)}function objectParserWithInitializer(initializeParsedValue,schema){return (rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx.failure("object",rawValue)}const parsed=initializeParsedValue(rawValue);const mismatches=[];for(const[prop,propParser]of Object.entries(schema)){const result=propParser(rawValue[prop],ctx.forSubtree(prop));if(isSuccess(result)){if(result.value!==undefined||prop in rawValue){parsed[prop]=result.value;}}else {mismatches.push(...result.detail);}}if(mismatches.length>0){return failure(mismatches)}return ctx.success(parsed)}}
|
|
34
34
|
|
|
35
35
|
function optional(parseValue){return (rawValue,ctx)=>{if(rawValue===undefined){return ctx.success(rawValue)}return parseValue(rawValue,ctx)}}
|
|
36
36
|
|
|
@@ -50,7 +50,11 @@ const parsePerseusImageDetail=object({width:number,height:number});
|
|
|
50
50
|
|
|
51
51
|
const parseImages=defaulted(record(string,parsePerseusImageDetail),()=>({}));
|
|
52
52
|
|
|
53
|
-
function
|
|
53
|
+
function convert(f){return (rawValue,ctx)=>ctx.success(f(rawValue))}
|
|
54
|
+
|
|
55
|
+
const parseAlignment=pipeParsers(enumeration("default","block","inline-block","inline","wrap-left","wrap-right","full-width","",undefined)).then(convert(value=>value===""?"default":value)).parser;function parseWidget(parseType,parseOptions){return object({type:parseType,static:optional(boolean),graded:optional(boolean),alignment:parseAlignment,options:parseOptions,key:optional(nullable(number)),version:optional(object({major:number,minor:number}))})}function parseWidgetWithVersion(parseVersion,parseType,parseOptions){return object({type:parseType,static:optional(boolean),graded:optional(boolean),alignment:parseAlignment,options:parseOptions,key:optional(nullable(number)),version:parseVersion})}
|
|
56
|
+
|
|
57
|
+
const parseBlankWidget=parseWidget(constant("blank"),object({displayType:defaulted(enumeration("normal","superscript","subscript"),()=>"normal"),correctId:string}));
|
|
54
58
|
|
|
55
59
|
const parseCategorizerWidget=parseWidget(constant("categorizer"),object({items:array(string),categories:array(string),randomizeItems:defaulted(boolean,()=>false),static:defaulted(boolean,()=>false),values:defaulted(array(defaulted(number,()=>0)),()=>[])}));
|
|
56
60
|
|
|
@@ -66,8 +70,6 @@ const KeypadKeys=["PLUS","MINUS","NEGATIVE","TIMES","DIVIDE","DECIMAL","PERIOD",
|
|
|
66
70
|
|
|
67
71
|
function deriveExtraKeys(widgetOptions){if(widgetOptions.extraKeys){return widgetOptions.extraKeys}const defaultKeys=["PI"];if(widgetOptions.answerForms==null){return defaultKeys}const uniqueExtraVariables={};const uniqueExtraConstants={};for(const answerForm of widgetOptions.answerForms){const maybeExpr=KAS.parse(answerForm.value,widgetOptions);if(maybeExpr.parsed){const expr=maybeExpr.expr;const isGreek=symbol=>symbol==="pi"||symbol==="theta";const toKey=symbol=>isGreek(symbol)?symbol.toUpperCase():symbol;const isKey=key=>KeypadKeys.includes(key);for(const variable of expr.getVars()){const maybeKey=toKey(variable);if(isKey(maybeKey)){uniqueExtraVariables[maybeKey]=true;}}for(const constant of expr.getConsts()){const maybeKey=toKey(constant);if(isKey(maybeKey)){uniqueExtraConstants[maybeKey]=true;}}}}const extraVariables=Object.keys(uniqueExtraVariables).sort();const extraConstants=Object.keys(uniqueExtraConstants).sort();const extraKeys=[...extraVariables,...extraConstants];if(!extraKeys.length){return defaultKeys}return extraKeys}
|
|
68
72
|
|
|
69
|
-
function convert(f){return (rawValue,ctx)=>ctx.success(f(rawValue))}
|
|
70
|
-
|
|
71
73
|
const keypadKeys=enumeration("PLUS","MINUS","NEGATIVE","TIMES","DIVIDE","DECIMAL","PERIOD","PERCENT","CDOT","EQUAL","NEQ","GT","LT","GEQ","LEQ","FRAC_INCLUSIVE","FRAC_EXCLUSIVE","FRAC","EXP","EXP_2","EXP_3","SUB","SQRT","CUBE_ROOT","RADICAL","LEFT_PAREN","RIGHT_PAREN","LN","LOG","LOG_N","SIN","COS","TAN","PI","THETA","UP","RIGHT","DOWN","LEFT","BACKSPACE","DISMISS","JUMP_OUT_PARENTHESES","JUMP_OUT_EXPONENT","JUMP_OUT_BASE","JUMP_INTO_NUMERATOR","JUMP_OUT_NUMERATOR","JUMP_OUT_DENOMINATOR","NUM_0","NUM_1","NUM_2","NUM_3","NUM_4","NUM_5","NUM_6","NUM_7","NUM_8","NUM_9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
|
|
72
74
|
|
|
73
75
|
const parseLegacyButtonSet=enumeration("basic","basic+div","trig","prealgebra","logarithms","basic relations","advanced relations","scientific");const parseLegacyButtonSets=defaulted(array(parseLegacyButtonSet),()=>["basic","trig","prealgebra","logarithms"]);
|
|
@@ -134,7 +136,7 @@ const parseVideoWidget=parseWidget(constant("video"),object({location:string,sta
|
|
|
134
136
|
|
|
135
137
|
const parseStringToNonNegativeInt=(rawValue,ctx)=>{if(typeof rawValue!=="string"||!/^(0|[1-9][0-9]*)$/.test(rawValue)){return ctx.failure("a string representing a non-negative integer",rawValue)}return ctx.success(+rawValue)};const parseWidgetIdComponents=pair(string,parseStringToNonNegativeInt);
|
|
136
138
|
|
|
137
|
-
const parseWidgetsMap=(rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx.failure("PerseusWidgetsMap",rawValue)}const widgetsMap={};for(const key of Object.keys(rawValue)){const entryResult=parseWidgetsMapEntry([key,rawValue[key]],widgetsMap,ctx.forSubtree(key));if(isFailure(entryResult)){return entryResult}}return ctx.success(widgetsMap)};const parseWidgetsMapEntry=([id,widget],widgetMap,ctx)=>{const idComponentsResult=parseWidgetIdComponents(id.split(" "),ctx.forSubtree("(widget ID)"));if(isFailure(idComponentsResult)){return idComponentsResult}const[type,n]=idComponentsResult.value;function parseAndAssign(key,parse){const widgetResult=parse(widget,ctx);if(isFailure(widgetResult)){return widgetResult}widgetMap[key]=widgetResult.value;return ctx.success(undefined)}switch(type){case "categorizer":return parseAndAssign(`categorizer ${n}`,parseCategorizerWidget);case "cs-program":return parseAndAssign(`cs-program ${n}`,parseCSProgramWidget);case "definition":return parseAndAssign(`definition ${n}`,parseDefinitionWidget);case "dropdown":return parseAndAssign(`dropdown ${n}`,parseDropdownWidget);case "explanation":return parseAndAssign(`explanation ${n}`,parseExplanationWidget);case "expression":return parseAndAssign(`expression ${n}`,parseExpressionWidget);case "free-response":return parseAndAssign(`free-response ${n}`,parseFreeResponseWidget);case "grapher":return parseAndAssign(`grapher ${n}`,parseGrapherWidget);case "group":return parseAndAssign(`group ${n}`,parseGroupWidget);case "graded-group":return parseAndAssign(`graded-group ${n}`,parseGradedGroupWidget);case "graded-group-set":return parseAndAssign(`graded-group-set ${n}`,parseGradedGroupSetWidget);case "iframe":return parseAndAssign(`iframe ${n}`,parseIframeWidget);case "image":return parseAndAssign(`image ${n}`,parseImageWidget);case "input-number":return parseAndAssign(`input-number ${n}`,parseInputNumberWidget);case "interaction":return parseAndAssign(`interaction ${n}`,parseInteractionWidget);case "interactive-graph":return parseAndAssign(`interactive-graph ${n}`,parseInteractiveGraphWidget);case "label-image":return parseAndAssign(`label-image ${n}`,parseLabelImageWidget);case "matcher":return parseAndAssign(`matcher ${n}`,parseMatcherWidget);case "matrix":return parseAndAssign(`matrix ${n}`,parseMatrixWidget);case "measurer":return parseAndAssign(`measurer ${n}`,parseMeasurerWidget);case "molecule-renderer":return parseAndAssign(`molecule-renderer ${n}`,parseDeprecatedWidget);case "number-line":return parseAndAssign(`number-line ${n}`,parseNumberLineWidget);case "numeric-input":return parseAndAssign(`numeric-input ${n}`,parseNumericInputWidget);case "orderer":return parseAndAssign(`orderer ${n}`,parseOrdererWidget);case "phet-simulation":return parseAndAssign(`phet-simulation ${n}`,parsePhetSimulationWidget);case "plotter":return parseAndAssign(`plotter ${n}`,parsePlotterWidget);case "python-program":return parseAndAssign(`python-program ${n}`,parsePythonProgramWidget);case "radio":return parseAndAssign(`radio ${n}`,parseRadioWidget);case "sorter":return parseAndAssign(`sorter ${n}`,parseSorterWidget);case "table":return parseAndAssign(`table ${n}`,parseTableWidget);case "video":return parseAndAssign(`video ${n}`,parseVideoWidget);case "sequence":return parseAndAssign(`sequence ${n}`,parseDeprecatedWidget);case "lights-puzzle":return parseAndAssign(`lights-puzzle ${n}`,parseDeprecatedWidget);case "simulator":return parseAndAssign(`simulator ${n}`,parseDeprecatedWidget);case "transformer":return parseAndAssign(`transformer ${n}`,parseDeprecatedWidget);case "passage":return parseAndAssign(`passage ${n}`,parseDeprecatedWidget);case "passage-ref":return parseAndAssign(`passage-ref ${n}`,parseDeprecatedWidget);case "passage-ref-target":return parseAndAssign(`passage-ref-target ${n}`,parseDeprecatedWidget);default:return parseAndAssign(`${type} ${n}`,parseWidget(constant(type),any))}};const parseDeprecatedWidget=parseWidget((_,ctx)=>ctx.success("deprecated-standin"),looseObject({}));
|
|
139
|
+
const parseWidgetsMap=(rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx.failure("PerseusWidgetsMap",rawValue)}const widgetsMap={};for(const key of Object.keys(rawValue)){const entryResult=parseWidgetsMapEntry([key,rawValue[key]],widgetsMap,ctx.forSubtree(key));if(isFailure(entryResult)){return entryResult}}return ctx.success(widgetsMap)};const parseWidgetsMapEntry=([id,widget],widgetMap,ctx)=>{const idComponentsResult=parseWidgetIdComponents(id.split(" "),ctx.forSubtree("(widget ID)"));if(isFailure(idComponentsResult)){return idComponentsResult}const[type,n]=idComponentsResult.value;function parseAndAssign(key,parse){const widgetResult=parse(widget,ctx);if(isFailure(widgetResult)){return widgetResult}widgetMap[key]=widgetResult.value;return ctx.success(undefined)}switch(type){case "blank":return parseAndAssign(`blank ${n}`,parseBlankWidget);case "categorizer":return parseAndAssign(`categorizer ${n}`,parseCategorizerWidget);case "cs-program":return parseAndAssign(`cs-program ${n}`,parseCSProgramWidget);case "definition":return parseAndAssign(`definition ${n}`,parseDefinitionWidget);case "dropdown":return parseAndAssign(`dropdown ${n}`,parseDropdownWidget);case "explanation":return parseAndAssign(`explanation ${n}`,parseExplanationWidget);case "expression":return parseAndAssign(`expression ${n}`,parseExpressionWidget);case "free-response":return parseAndAssign(`free-response ${n}`,parseFreeResponseWidget);case "grapher":return parseAndAssign(`grapher ${n}`,parseGrapherWidget);case "group":return parseAndAssign(`group ${n}`,parseGroupWidget);case "graded-group":return parseAndAssign(`graded-group ${n}`,parseGradedGroupWidget);case "graded-group-set":return parseAndAssign(`graded-group-set ${n}`,parseGradedGroupSetWidget);case "iframe":return parseAndAssign(`iframe ${n}`,parseIframeWidget);case "image":return parseAndAssign(`image ${n}`,parseImageWidget);case "input-number":return parseAndAssign(`input-number ${n}`,parseInputNumberWidget);case "interaction":return parseAndAssign(`interaction ${n}`,parseInteractionWidget);case "interactive-graph":return parseAndAssign(`interactive-graph ${n}`,parseInteractiveGraphWidget);case "label-image":return parseAndAssign(`label-image ${n}`,parseLabelImageWidget);case "matcher":return parseAndAssign(`matcher ${n}`,parseMatcherWidget);case "matrix":return parseAndAssign(`matrix ${n}`,parseMatrixWidget);case "measurer":return parseAndAssign(`measurer ${n}`,parseMeasurerWidget);case "molecule-renderer":return parseAndAssign(`molecule-renderer ${n}`,parseDeprecatedWidget);case "number-line":return parseAndAssign(`number-line ${n}`,parseNumberLineWidget);case "numeric-input":return parseAndAssign(`numeric-input ${n}`,parseNumericInputWidget);case "orderer":return parseAndAssign(`orderer ${n}`,parseOrdererWidget);case "phet-simulation":return parseAndAssign(`phet-simulation ${n}`,parsePhetSimulationWidget);case "plotter":return parseAndAssign(`plotter ${n}`,parsePlotterWidget);case "python-program":return parseAndAssign(`python-program ${n}`,parsePythonProgramWidget);case "radio":return parseAndAssign(`radio ${n}`,parseRadioWidget);case "sorter":return parseAndAssign(`sorter ${n}`,parseSorterWidget);case "table":return parseAndAssign(`table ${n}`,parseTableWidget);case "video":return parseAndAssign(`video ${n}`,parseVideoWidget);case "sequence":return parseAndAssign(`sequence ${n}`,parseDeprecatedWidget);case "lights-puzzle":return parseAndAssign(`lights-puzzle ${n}`,parseDeprecatedWidget);case "simulator":return parseAndAssign(`simulator ${n}`,parseDeprecatedWidget);case "transformer":return parseAndAssign(`transformer ${n}`,parseDeprecatedWidget);case "passage":return parseAndAssign(`passage ${n}`,parseDeprecatedWidget);case "passage-ref":return parseAndAssign(`passage-ref ${n}`,parseDeprecatedWidget);case "passage-ref-target":return parseAndAssign(`passage-ref-target ${n}`,parseDeprecatedWidget);default:return parseAndAssign(`${type} ${n}`,parseWidget(constant(type),any))}};const parseDeprecatedWidget=parseWidget((_,ctx)=>ctx.success("deprecated-standin"),looseObject({}));
|
|
138
140
|
|
|
139
141
|
const parsePerseusRenderer=defaulted(object({content:defaulted(string,()=>""),widgets:defaulted((rawVal,ctx)=>parseWidgetsMap(rawVal,ctx),()=>({})),images:parseImages,metadata:any}),()=>({content:"",widgets:{},images:{}}));
|
|
140
142
|
|