@khanacademy/perseus-core 39.0.0 → 39.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.
- package/dist/data-schema.d.ts +49 -1
- package/dist/es/index.js +52 -42
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +56 -41
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/answer-tile.d.ts +10 -0
- package/dist/parse-perseus-json/perseus-parsers/fill-in-the-blank-widget.d.ts +24 -0
- package/dist/parse-perseus-json/perseus-parsers/fill-in-the-blank-widget.typetest.d.ts +1 -0
- package/dist/utils/generators/fill-in-the-blank-widget-generator.d.ts +4 -0
- package/dist/utils/split-perseus-renderer.d.ts +5 -1
- package/dist/widgets/fill-in-the-blank/fill-in-the-blank-util.d.ts +7 -0
- package/dist/widgets/fill-in-the-blank/index.d.ts +5 -0
- package/dist/widgets/logic-export.types.d.ts +2 -1
- package/dist/widgets/sorter/sorter-util.d.ts +1 -0
- package/package.json +1 -1
package/dist/data-schema.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ export interface PerseusWidgetTypes {
|
|
|
141
141
|
dropdown: DropdownWidget;
|
|
142
142
|
explanation: ExplanationWidget;
|
|
143
143
|
expression: ExpressionWidget;
|
|
144
|
+
"fill-in-the-blank": FillInTheBlankWidget;
|
|
144
145
|
"free-response": FreeResponseWidget;
|
|
145
146
|
grapher: GrapherWidget;
|
|
146
147
|
"graded-group-set": GradedGroupSetWidget;
|
|
@@ -368,6 +369,7 @@ export type DefinitionWidget = WidgetOptions<'definition', PerseusDefinitionWidg
|
|
|
368
369
|
export type DropdownWidget = WidgetOptions<'dropdown', PerseusDropdownWidgetOptions>;
|
|
369
370
|
export type ExplanationWidget = WidgetOptions<'explanation', PerseusExplanationWidgetOptions>;
|
|
370
371
|
export type ExpressionWidget = WidgetOptions<'expression', PerseusExpressionWidgetOptions>;
|
|
372
|
+
export type FillInTheBlankWidget = WidgetOptions<'fill-in-the-blank', PerseusFillInTheBlankWidgetOptions>;
|
|
371
373
|
export type FreeResponseWidget = WidgetOptions<'free-response', PerseusFreeResponseWidgetOptions>;
|
|
372
374
|
export type GradedGroupSetWidget = WidgetOptions<'graded-group-set', PerseusGradedGroupSetWidgetOptions>;
|
|
373
375
|
export type GradedGroupWidget = WidgetOptions<'graded-group', PerseusGradedGroupWidgetOptions>;
|
|
@@ -428,6 +430,52 @@ export type PerseusBlankWidgetOptions = {
|
|
|
428
430
|
/** ID for the correct answer tile for the blank */
|
|
429
431
|
correctId: string;
|
|
430
432
|
};
|
|
433
|
+
/**
|
|
434
|
+
* A draggable tile in a "Drag And Drop" widget's choice bank, shared across
|
|
435
|
+
* the widget family.
|
|
436
|
+
*
|
|
437
|
+
* Presentation only: each widget expresses correctness differently, so one
|
|
438
|
+
* needing extra data should intersect this type locally rather than widen it.
|
|
439
|
+
* Any field added here must be optional.
|
|
440
|
+
*/
|
|
441
|
+
export type PerseusAnswerTile = {
|
|
442
|
+
/**
|
|
443
|
+
* Identifies the tile within its own widget's choice bank: a blank's
|
|
444
|
+
* `correctId` and the learner's placements both name a tile this way.
|
|
445
|
+
* Uniqueness is scoped to the one widget.
|
|
446
|
+
*/
|
|
447
|
+
id: string;
|
|
448
|
+
/**
|
|
449
|
+
* Translatable Markdown; what this tile displays. Blank renders an empty
|
|
450
|
+
* tile, which is announced using `label`.
|
|
451
|
+
*/
|
|
452
|
+
content: string;
|
|
453
|
+
/** Translatable text; the tile's value as plain text, for screen readers */
|
|
454
|
+
label: string;
|
|
455
|
+
/** Display height in px for an image tile. */
|
|
456
|
+
imageHeight?: number;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* Options for the fill-in-the-blank widget. Presents content with inline
|
|
460
|
+
* blanks above a choice bank of answer tiles.
|
|
461
|
+
*/
|
|
462
|
+
export type PerseusFillInTheBlankWidgetOptions = {
|
|
463
|
+
/** Translatable Markdown; the content. Translators may move the
|
|
464
|
+
* `[[☃ blank n]]` widget placeholders within it */
|
|
465
|
+
content: string;
|
|
466
|
+
/** The widgets embedded in `content`, keyed by widget id. */
|
|
467
|
+
widgets: PerseusWidgetsMap;
|
|
468
|
+
/** The choice bank the learner draws answer tiles from */
|
|
469
|
+
tiles: PerseusAnswerTile[];
|
|
470
|
+
/**
|
|
471
|
+
* How many times each tile may be placed, for the whole choice bank.
|
|
472
|
+
*/
|
|
473
|
+
maxUsesPerTile: number | "unlimited";
|
|
474
|
+
/**
|
|
475
|
+
* Randomize the order of the answer tiles or keep them as defined.
|
|
476
|
+
*/
|
|
477
|
+
randomize: boolean;
|
|
478
|
+
};
|
|
431
479
|
/** Options for the categorizer widget. Presents items to sort into groups. */
|
|
432
480
|
export type PerseusCategorizerWidgetOptions = {
|
|
433
481
|
/**
|
|
@@ -1918,5 +1966,5 @@ export type PerseusVideoWidgetOptions = {
|
|
|
1918
1966
|
};
|
|
1919
1967
|
export type PerseusInputNumberAnswer = PerseusNumericInputAnswer;
|
|
1920
1968
|
export type PerseusInputNumberWidgetOptions = PerseusNumericInputWidgetOptions;
|
|
1921
|
-
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;
|
|
1969
|
+
export type PerseusWidgetOptions = PerseusBlankWidgetOptions | PerseusCategorizerWidgetOptions | PerseusCSProgramWidgetOptions | PerseusDefinitionWidgetOptions | PerseusDropdownWidgetOptions | PerseusExplanationWidgetOptions | PerseusExpressionWidgetOptions | PerseusFillInTheBlankWidgetOptions | PerseusFreeResponseWidgetOptions | PerseusGradedGroupSetWidgetOptions | PerseusGradedGroupWidgetOptions | PerseusIFrameWidgetOptions | PerseusImageWidgetOptions | PerseusInputNumberWidgetOptions | PerseusInteractionWidgetOptions | PerseusInteractiveGraphWidgetOptions | PerseusLabelImageWidgetOptions | PerseusMatcherWidgetOptions | PerseusMatrixWidgetOptions | PerseusMeasurerWidgetOptions | PerseusNumberLineWidgetOptions | PerseusNumericInputWidgetOptions | PerseusOrdererWidgetOptions | PerseusPhetSimulationWidgetOptions | PerseusPlotterWidgetOptions | PerseusRadioWidgetOptions | PerseusSorterWidgetOptions | PerseusTableWidgetOptions | PerseusVideoWidgetOptions;
|
|
1922
1970
|
export {};
|
package/dist/es/index.js
CHANGED
|
@@ -114,6 +114,10 @@ function versionedWidgetOptions(latestMajorVersion,parseLatest){return new Versi
|
|
|
114
114
|
|
|
115
115
|
const stringOrNumberOrNullOrUndefined=union(string).or(number).or(constant(null)).or(constant(undefined)).parser;function numberOrNullToString(v){return typeof v==="number"||v===null?String(v):v}const parsePossiblyInvalidAnswerForm=object({value:optional(string),form:defaulted(boolean,()=>false),simplify:defaulted(boolean,()=>false),considered:enumeration("correct","wrong","ungraded"),key:pipeParsers(stringOrNumberOrNullOrUndefined).then(convert(numberOrNullToString)).parser});function removeInvalidAnswerForms(possiblyInvalid){return possiblyInvalid.flatMap(answerForm=>{const{value}=answerForm;if(value!=null){return [{...answerForm,value}]}return []})}const parseAnswerForms=pipeParsers(defaulted(array(parsePossiblyInvalidAnswerForm),()=>[])).then(convert(removeInvalidAnswerForms)).parser;const version2$1=object({major:constant(2),minor:number});const parseExpressionWidgetV2=parseWidgetWithVersion(version2$1,constant("expression"),object({answerForms:parseAnswerForms,functions:array(string),times:boolean,visibleLabel:optional(string),ariaLabel:optional(string),buttonSets:parseLegacyButtonSets,buttonsVisible:optional(enumeration("always","never","focused")),extraKeys:optional(array(keypadKeys))}));const version1$2=object({major:constant(1),minor:number});const parseExpressionWidgetV1=parseWidgetWithVersion(version1$2,constant("expression"),object({answerForms:parseAnswerForms,functions:array(string),times:boolean,visibleLabel:optional(string),ariaLabel:optional(string),buttonSets:parseLegacyButtonSets,buttonsVisible:optional(enumeration("always","never","focused"))}));function migrateV1ToV2$1(widget){const{options}=widget;return {...widget,version:{major:2,minor:0},options:{times:options.times,buttonSets:options.buttonSets,functions:options.functions,buttonsVisible:options.buttonsVisible,visibleLabel:options.visibleLabel,ariaLabel:options.ariaLabel,answerForms:options.answerForms,extraKeys:deriveExtraKeys(options)??[]}}}const version0$2=optional(object({major:constant(0),minor:number}));const parseExpressionWidgetV0=parseWidgetWithVersion(version0$2,constant("expression"),object({functions:array(string),times:boolean,visibleLabel:optional(string),ariaLabel:optional(string),form:boolean,simplify:boolean,value:string,buttonSets:parseLegacyButtonSets,buttonsVisible:optional(enumeration("always","never","focused"))}));function migrateV0ToV1$4(widget){const{options}=widget;return {...widget,version:{major:1,minor:0},options:{times:options.times,buttonSets:options.buttonSets,functions:options.functions,buttonsVisible:options.buttonsVisible,visibleLabel:options.visibleLabel,ariaLabel:options.ariaLabel,answerForms:[{considered:"correct",form:options.form,simplify:options.simplify,value:options.value}]}}}const parseExpressionWidget=versionedWidgetOptions(2,parseExpressionWidgetV2).withMigrationFrom(1,parseExpressionWidgetV1,migrateV1ToV2$1).withMigrationFrom(0,parseExpressionWidgetV0,migrateV0ToV1$4).parser;
|
|
116
116
|
|
|
117
|
+
const answerTileSchema={id:string,content:string,label:string,imageHeight:optional(number)};const parseAnswerTile=object(answerTileSchema);
|
|
118
|
+
|
|
119
|
+
const usesPerTile=(rawValue,ctx)=>{if(rawValue==="unlimited"){return ctx.success(rawValue)}if(typeof rawValue==="number"&&Number.isInteger(rawValue)&&rawValue>=1){return ctx.success(rawValue)}return ctx.failure('a positive number, or "unlimited"',rawValue)};const parseFillInTheBlankWidget=parseWidget(constant("fill-in-the-blank"),object({content:string,widgets:(rawVal,ctx)=>parseWidgetsMap(rawVal,ctx),tiles:array(parseAnswerTile),maxUsesPerTile:usesPerTile,randomize:boolean}));
|
|
120
|
+
|
|
117
121
|
const parseFreeResponseWidget=parseWidget(constant("free-response"),object({allowUnlimitedCharacters:boolean,characterLimit:number,placeholder:string,question:string,scoringCriteria:array(object({text:string}))}));
|
|
118
122
|
|
|
119
123
|
const booleanOrFalse=defaulted(boolean,()=>false);const calculatorVariantOrUndefined=pipeParsers(defaulted(nullable(enumeration("scientific","graphing","four_function")),()=>null)).then(convert(v=>v??undefined)).parser;const baseParser=defaulted(object({calculator:booleanOrFalse,calculatorVariant:calculatorVariantOrUndefined,financialCalculatorMonthlyPayment:booleanOrFalse,financialCalculatorTotalAmount:booleanOrFalse,financialCalculatorTimeToPayOff:booleanOrFalse,periodicTable:booleanOrFalse,periodicTableWithKey:booleanOrFalse}),()=>({calculator:false,calculatorVariant:undefined,financialCalculatorMonthlyPayment:false,financialCalculatorTotalAmount:false,financialCalculatorTimeToPayOff:false,periodicTable:false,periodicTableWithKey:false}));const parsePerseusAnswerArea=pipeParsers(baseParser).then(convert(parsed=>{const{calculatorVariant:parsedCalcVariant,...rest}=parsed;const calculatorVariant=parsed.calculator&&parsedCalcVariant===undefined?"scientific":parsedCalcVariant;return calculatorVariant!==undefined?{...rest,calculatorVariant}:rest})).parser;
|
|
@@ -174,7 +178,7 @@ const parseVideoWidget=parseWidget(constant("video"),object({location:string}));
|
|
|
174
178
|
|
|
175
179
|
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);
|
|
176
180
|
|
|
177
|
-
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({}));
|
|
181
|
+
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 "fill-in-the-blank":return parseAndAssign(`fill-in-the-blank ${n}`,parseFillInTheBlankWidget);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({}));
|
|
178
182
|
|
|
179
183
|
const parsePerseusRenderer=defaulted(object({content:defaulted(string,()=>""),widgets:defaulted((rawVal,ctx)=>parseWidgetsMap(rawVal,ctx),()=>({})),images:parseImages,metadata:any}),()=>({content:"",widgets:{},images:{}}));
|
|
180
184
|
|
|
@@ -228,7 +232,7 @@ const parseUserInputMap=(rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx
|
|
|
228
232
|
|
|
229
233
|
function parseAndMigratePerseusItem(data){const object=typeof data==="string"?JSON.parse(data):data;const result=parse(object,parsePerseusItem);if(isFailure(result)){return failure({message:result.detail,invalidObject:object})}return result}function parseAndMigratePerseusArticle(data){const object=typeof data==="string"?JSON.parse(data):data;const result=parse(object,parsePerseusArticle);if(isFailure(result)){return failure({message:result.detail,invalidObject:object})}return result}function parseAndMigrateUserInputMap(data){const object=typeof data==="string"?JSON.parse(data):data;const result=parse(object,parseUserInputMap);if(isFailure(result)){return failure({message:result.detail,invalidObject:object})}return result}function parseAndMigratePerseusRenderer(data){const object=typeof data==="string"?JSON.parse(data):data;const result=parse(object,parsePerseusRenderer);if(isFailure(result)){return failure({message:result.detail,invalidObject:object})}return result}
|
|
230
234
|
|
|
231
|
-
const libName="@khanacademy/perseus-core";const libVersion="39.
|
|
235
|
+
const libName="@khanacademy/perseus-core";const libVersion="39.2.0";addLibraryVersionToPerseusDebug(libName,libVersion);
|
|
232
236
|
|
|
233
237
|
const Errors=Object.freeze({Unknown:"Unknown",Internal:"Internal",InvalidInput:"InvalidInput",NotAllowed:"NotAllowed",TransientService:"TransientService",Service:"Service"});
|
|
234
238
|
|
|
@@ -244,53 +248,53 @@ const blankWidgetLogic={name:"blank",version:{major:0,minor:0},defaultAlignment:
|
|
|
244
248
|
|
|
245
249
|
function getCategorizerPublicWidgetOptions(options){return {items:options.items,categories:options.categories,randomizeItems:options.randomizeItems}}
|
|
246
250
|
|
|
247
|
-
const defaultWidgetOptions$
|
|
251
|
+
const defaultWidgetOptions$u={items:[],categories:[],values:[],randomizeItems:false};const categorizerWidgetLogic={name:"categorizer",defaultWidgetOptions: defaultWidgetOptions$u,getPublicWidgetOptions:getCategorizerPublicWidgetOptions,accessible:false};
|
|
248
252
|
|
|
249
253
|
function getCSProgramPublicWidgetOptions(options){return options}
|
|
250
254
|
|
|
251
|
-
const DEFAULT_HEIGHT=400;const defaultWidgetOptions$
|
|
255
|
+
const DEFAULT_HEIGHT=400;const defaultWidgetOptions$t={programID:"",programType:null,settings:[{name:"",value:""}],showEditor:false,showButtons:false,height:DEFAULT_HEIGHT};const csProgramWidgetLogic={name:"cs-program",defaultWidgetOptions: defaultWidgetOptions$t,supportedAlignments:["block","full-width"],getPublicWidgetOptions:getCSProgramPublicWidgetOptions,accessible:false};
|
|
252
256
|
|
|
253
|
-
const defaultWidgetOptions$
|
|
257
|
+
const defaultWidgetOptions$s={togglePrompt:"",definition:""};const definitionWidgetLogic={name:"definition",defaultWidgetOptions: defaultWidgetOptions$s,defaultAlignment:"inline",accessible:true};
|
|
254
258
|
|
|
255
259
|
function getDropdownPublicWidgetOptions(options){return {choices:options.choices.map(choice=>({content:choice.content})),placeholder:options.placeholder,visibleLabel:options.visibleLabel,ariaLabel:options.ariaLabel}}
|
|
256
260
|
|
|
257
|
-
const defaultWidgetOptions$
|
|
261
|
+
const defaultWidgetOptions$r={placeholder:"",choices:[{content:"",correct:false}]};const dropdownWidgetLogic={name:"dropdown",defaultWidgetOptions: defaultWidgetOptions$r,defaultAlignment:"inline-block",getPublicWidgetOptions:getDropdownPublicWidgetOptions,accessible:true};
|
|
258
262
|
|
|
259
|
-
const defaultWidgetOptions$
|
|
263
|
+
const defaultWidgetOptions$q={showPrompt:"Explain",hidePrompt:"Hide explanation",explanation:"explanation goes here\n\nmore explanation",widgets:{}};const explanationWidgetLogic={name:"explanation",defaultWidgetOptions: defaultWidgetOptions$q,defaultAlignment:"inline",accessible:true};
|
|
260
264
|
|
|
261
265
|
function getExpressionPublicWidgetOptions(options){return {buttonSets:options.buttonSets,functions:options.functions,times:options.times,visibleLabel:options.visibleLabel,ariaLabel:options.ariaLabel,buttonsVisible:options.buttonsVisible,extraKeys:options.extraKeys}}
|
|
262
266
|
|
|
263
|
-
const currentVersion$1={major:2,minor:0};const defaultWidgetOptions$
|
|
267
|
+
const currentVersion$1={major:2,minor:0};const defaultWidgetOptions$p={answerForms:[],times:false,buttonSets:["basic"],functions:["f","g","h"]};const expressionWidgetLogic={name:"expression",version:currentVersion$1,defaultWidgetOptions:defaultWidgetOptions$p,defaultAlignment:"inline-block",getPublicWidgetOptions:getExpressionPublicWidgetOptions,accessible:true};
|
|
264
268
|
|
|
265
|
-
|
|
269
|
+
class Registry{throwIfUnregistered(){if(!this.anythingRegistered){throw new Error(`${this.name} accessed before initialization!`)}}has(key){this.throwIfUnregistered();return Object.prototype.hasOwnProperty.call(this.contents,key)}get(key){this.throwIfUnregistered();return this.contents[key]}keys(){this.throwIfUnregistered();return Object.keys(this.contents)}entries(){this.throwIfUnregistered();return Object.entries(this.contents)}set(key,value){this.anythingRegistered=true;this.contents[key]=value;}constructor(name="Registry"){this.contents={};this.anythingRegistered=false;this.name=name;}}
|
|
266
270
|
|
|
267
|
-
|
|
271
|
+
const deprecatedStandinWidgetLogic={name:"deprecated-standin",accessible:true};
|
|
268
272
|
|
|
269
|
-
const defaultWidgetOptions$
|
|
273
|
+
const defaultWidgetOptions$o={title:"",content:"",widgets:{},images:{},hint:null};const traverseChildWidgets$3=function(props,traverseRenderer){return {...props,...traverseRenderer(props)}};const gradedGroupWidgetLogic={name:"graded-group",defaultWidgetOptions: defaultWidgetOptions$o,accessible:true,traverseChildWidgets:traverseChildWidgets$3};
|
|
270
274
|
|
|
271
|
-
const defaultWidgetOptions$
|
|
275
|
+
const defaultWidgetOptions$n={gradedGroups:[]};const traverseChildWidgets$2=function(props,traverseRenderer){return {...props,...traverseRenderer(props)}};const gradedGroupSetWidgetLogic={name:"graded-group-set",defaultWidgetOptions: defaultWidgetOptions$n,accessible:true,traverseChildWidgets:traverseChildWidgets$2};
|
|
272
276
|
|
|
273
277
|
function getGrapherPublicWidgetOptions(options){const{correct,...publicOptions}=options;return publicOptions}
|
|
274
278
|
|
|
275
|
-
const defaultWidgetOptions$
|
|
279
|
+
const defaultWidgetOptions$m={graph:{labels:["x","y"],range:[[-10,10],[-10,10]],step:[1,1],backgroundImage:{url:null},markings:"graph",rulerLabel:"",rulerTicks:10,valid:true,showTooltips:false},correct:{type:"linear",coords:null},availableTypes:["linear"]};const grapherWidgetLogic={name:"grapher",defaultWidgetOptions: defaultWidgetOptions$m,getPublicWidgetOptions:getGrapherPublicWidgetOptions,accessible:options=>!options.graph.backgroundImage.url&&options.availableTypes.length===1&&options.availableTypes[0]!=="quadratic"};
|
|
276
280
|
|
|
277
|
-
|
|
281
|
+
function getGroupPublicWidgetOptions(options){return splitPerseusRenderer(options)}
|
|
278
282
|
|
|
279
|
-
const
|
|
283
|
+
const defaultWidgetOptions$l={content:"",widgets:{},images:{}};const traverseChildWidgets$1=function(props,traverseRenderer){return {...props,...traverseRenderer(props)}};const groupWidgetLogic={name:"group",defaultWidgetOptions: defaultWidgetOptions$l,accessible:false,traverseChildWidgets:traverseChildWidgets$1,getPublicWidgetOptions:getGroupPublicWidgetOptions};
|
|
280
284
|
|
|
281
285
|
function getIFramePublicWidgetOptions(options){return options}
|
|
282
286
|
|
|
283
|
-
const defaultWidgetOptions$
|
|
287
|
+
const defaultWidgetOptions$k={url:"",settings:[{name:"",value:""}],width:"400",height:"400",allowFullScreen:false,allowTopNavigation:false};const iframeWidgetLogic={name:"iframe",defaultWidgetOptions: defaultWidgetOptions$k,getPublicWidgetOptions:getIFramePublicWidgetOptions,accessible:false};
|
|
284
288
|
|
|
285
|
-
const defaultWidgetOptions$
|
|
289
|
+
const defaultWidgetOptions$j={title:"",range:[[0,10],[0,10]],box:[400,400],backgroundImage:{url:null,width:0,height:0},scale:1,labels:[],alt:"",caption:"",longDescription:"",decorative:false};const imageWidgetLogic={name:"image",defaultWidgetOptions: defaultWidgetOptions$j,supportedAlignments:["block","wrap-left","wrap-right","full-width"],defaultAlignment:"block",accessible:widgetOptions=>{const bgImage=widgetOptions.backgroundImage;const hasBackgroundImage=bgImage.url!=null;const hasAltText=!!widgetOptions.alt;const isDecorative=widgetOptions.decorative;return hasBackgroundImage&&(hasAltText||isDecorative)}};
|
|
286
290
|
|
|
287
291
|
function getNumericInputAnswerPublicData(answer){return {status:answer.status,answerForms:answer.answerForms,simplify:answer.simplify,value:null,strict:false,message:""}}function getNumericInputPublicWidgetOptions(options){const{answers,...publicWidgetOptions}=options;return {...publicWidgetOptions,answers:answers.map(getNumericInputAnswerPublicData)}}
|
|
288
292
|
|
|
289
293
|
const getInputNumberPublicWidgetOptions=getNumericInputPublicWidgetOptions;
|
|
290
294
|
|
|
291
|
-
const defaultWidgetOptions$
|
|
295
|
+
const defaultWidgetOptions$i={textAlign:"left",coefficient:false,size:"normal",answers:[{status:"correct",value:0,simplify:"required",maxError:0,answerForms:[],message:"",strict:true}]};const inputNumberWidgetLogic={name:"input-number",version:{major:1,minor:0},defaultWidgetOptions: defaultWidgetOptions$i,defaultAlignment:"inline-block",accessible:true,getPublicWidgetOptions:getInputNumberPublicWidgetOptions};
|
|
292
296
|
|
|
293
|
-
const defaultWidgetOptions$
|
|
297
|
+
const defaultWidgetOptions$h={graph:{box:[400,400],labels:["x","y"],range:[[-10,10],[-10,10]],tickStep:[1,1],gridStep:[1,1],markings:"graph"},elements:[]};const interactionWidgetLogic={name:"interaction",defaultWidgetOptions: defaultWidgetOptions$h,accessible:false};
|
|
294
298
|
|
|
295
299
|
const svgLabelsRegex=/^web\+graphie:/;const svgLocalLabelsRegex=/^file\+graphie:/;function getRealImageUrl(graphieUrl){if(isLabeledSVG(graphieUrl)){return getSvgUrl(graphieUrl)}return graphieUrl}function isLabeledSVG(graphieUrl){return svgLabelsRegex.test(graphieUrl)||svgLocalLabelsRegex.test(graphieUrl)}function getBaseUrl(graphieUrl){return graphieUrl.replace(svgLabelsRegex,"https:").replace(svgLocalLabelsRegex,"file:")}function getSvgUrl(graphieUrl){return getBaseUrl(graphieUrl)+".svg"}function getDataUrl(graphieUrl){return getBaseUrl(graphieUrl)+"-data.json"}async function getImageSizeModern(url){const image=new Image;return new Promise((resolve,reject)=>{image.onload=()=>{resolve([image.naturalWidth,image.naturalHeight]);};image.onerror=reject;image.src=getRealImageUrl(url);})}
|
|
296
300
|
|
|
@@ -298,57 +302,57 @@ function accessible(widgetOptions){if(widgetOptions.showProtractor){return false
|
|
|
298
302
|
|
|
299
303
|
function getInteractiveGraphPublicWidgetOptions(options){const{correct,...publicOptions}=options;return publicOptions}
|
|
300
304
|
|
|
301
|
-
const defaultWidgetOptions$
|
|
305
|
+
const defaultWidgetOptions$g={labels:["$x$","$y$"],labelLocation:"onAxis",lockedFigures:[],range:[[-10,10],[-10,10]],step:[1,1],backgroundImage:{url:null},markings:"graph",showAxisArrows:{xMin:true,xMax:true,yMin:true,yMax:true},showAxisTicks:{x:true,y:true},showTooltips:false,showProtractor:false,graph:{type:"none"},correct:{type:"none"}};const interactiveGraphWidgetLogic={name:"interactive-graph",defaultWidgetOptions: defaultWidgetOptions$g,getPublicWidgetOptions:getInteractiveGraphPublicWidgetOptions,accessible};
|
|
302
306
|
|
|
303
307
|
function getLabelImagePublicWidgetOptions(options){return {...options,markers:options.markers.map(getLabelImageMarkerPublicData)}}function getLabelImageMarkerPublicData(marker){const{answers,...publicData}=marker;return publicData}function isLabelImageAccessible(options){const labelImageOptions=options;if(labelImageOptions.imageUrl!==""&&labelImageOptions.imageAlt===""){return false}for(const marker of labelImageOptions.markers){if(marker.label===""){return false}}return true}
|
|
304
308
|
|
|
305
|
-
const defaultWidgetOptions$
|
|
309
|
+
const defaultWidgetOptions$f={choices:[],imageAlt:"",imageUrl:"",imageWidth:0,imageHeight:0,markers:[],multipleAnswers:false,hideChoicesFromInstructions:false};const labelImageWidgetLogic={name:"label-image",defaultWidgetOptions: defaultWidgetOptions$f,getPublicWidgetOptions:getLabelImagePublicWidgetOptions,accessible:isLabelImageAccessible};
|
|
306
310
|
|
|
307
311
|
const seededRNG=function(seed){let randomSeed=seed;return function(){let seed=randomSeed;seed=seed+0x7ed55d16+(seed<<12)&0xffffffff;seed=(seed^0xc761c23c^seed>>>19)&0xffffffff;seed=seed+0x165667b1+(seed<<5)&0xffffffff;seed=(seed+0xd3a2646c^seed<<9)&0xffffffff;seed=seed+0xfd7046c5+(seed<<3)&0xffffffff;seed=(seed^0xb55a4f09^seed>>>16)&0xffffffff;return (randomSeed=seed&0xfffffff)/0x10000000}};function shuffle(array,randomSeed,ensurePermuted=false){let random;if(typeof randomSeed==="function"){random=randomSeed;}else {random=seededRNG(randomSeed);}function isValidShuffle(shuffled){return ensurePermuted?!_.isEqual(array,shuffled):true}return constrainedShuffle(array,random,isValidShuffle)}function constrainedShuffle(array,random,isValidShuffle){const maxIterations=100;const shuffled=[...array];if(shuffled.every(value=>_.isEqual(value,shuffled[0]))){return shuffled}for(let i=0;i<maxIterations;i++){shuffleInPlace(shuffled,random);if(isValidShuffle(shuffled)){return shuffled}}throw new Error(`constrainedShuffle: constraint not met after ${maxIterations} attempts`)}function shuffleInPlace(a,random){for(let i=a.length-1;i>0;i--){const k=randomIntInRange(0,i,random);[a[k],a[i]]=[a[i],a[k]];}}function randomIntInRange(min,max,random){return Math.floor(random()*(max-min+1))+min}const random=seededRNG(new Date().getTime()&0xffffffff);
|
|
308
312
|
|
|
309
313
|
const shuffleMatcher=(options,problemNum)=>{const rng=seededRNG(problemNum);return {left:!options.orderMatters?options.left:shuffleDisplacingFirst$1(options.left,rng),right:shuffleDisplacingFirst$1(options.right,rng)}};function getMatcherPublicWidgetOptions(options){return {...options,left:options.orderMatters?sortAllButFirst$1(options.left):options.left,right:sortAllButFirst$1(options.right)}}function sortAllButFirst$1([first,...rest]){return [first,...rest.sort()]}function shuffleDisplacingFirst$1(array,rng){function isFirstElementDisplaced(shuffled){return shuffled[0]!==array[0]}return constrainedShuffle(array,rng,isFirstElementDisplaced)}
|
|
310
314
|
|
|
311
|
-
const defaultWidgetOptions$
|
|
315
|
+
const defaultWidgetOptions$e={left:["$x$","$y$","$z$"],right:["$1$","$2$","$3$"],labels:["test","label"],orderMatters:false,padding:true};const matcherWidgetLogic={name:"matcher",defaultWidgetOptions: defaultWidgetOptions$e,getPublicWidgetOptions:getMatcherPublicWidgetOptions,accessible:false};
|
|
312
316
|
|
|
313
317
|
function getMatrixPublicWidgetOptions(options){const{answers,...publicOptions}=options;return publicOptions}
|
|
314
318
|
|
|
315
|
-
const defaultWidgetOptions$
|
|
319
|
+
const defaultWidgetOptions$d={matrixBoardSize:[3,3],answers:[[]],prefix:"",suffix:""};const matrixWidgetLogic={name:"matrix",defaultWidgetOptions: defaultWidgetOptions$d,getPublicWidgetOptions:getMatrixPublicWidgetOptions,accessible:false};
|
|
316
320
|
|
|
317
|
-
const defaultWidgetOptions$
|
|
321
|
+
const defaultWidgetOptions$c={box:[480,480],image:{},showProtractor:true,showRuler:false,rulerLabel:"",rulerTicks:10,rulerPixels:40,rulerLength:10};const measurerWidgetLogic={name:"measurer",version:{major:1,minor:0},defaultWidgetOptions:defaultWidgetOptions$c,accessible:false};
|
|
318
322
|
|
|
319
323
|
function getNumberLinePublicWidgetOptions(options){const{correctX,correctRel,...publicOptions}=options;return publicOptions}
|
|
320
324
|
|
|
321
|
-
const defaultWidgetOptions$
|
|
325
|
+
const defaultWidgetOptions$b={range:[0,10],labelRange:[null,null],labelStyle:"decimal",labelTicks:true,isTickCtrl:false,isInequality:false,divisionRange:[1,12],numDivisions:5,snapDivisions:2,tickStep:null,correctRel:"eq",correctX:null,initialX:null,showTooltips:false};const numberLineWidgetLogic={name:"number-line",defaultWidgetOptions: defaultWidgetOptions$b,getPublicWidgetOptions:getNumberLinePublicWidgetOptions,accessible:false};
|
|
322
326
|
|
|
323
|
-
const defaultWidgetOptions$
|
|
327
|
+
const defaultWidgetOptions$a={answers:[{value:null,status:"correct",message:"",simplify:"required",answerForms:[],strict:false,maxError:null}],size:"normal",coefficient:false,labelText:"",textAlign:"left"};const numericInputWidgetLogic={name:"numeric-input",version:{major:1,minor:0},defaultWidgetOptions: defaultWidgetOptions$a,defaultAlignment:"inline-block",getPublicWidgetOptions:getNumericInputPublicWidgetOptions,accessible:true};
|
|
324
328
|
|
|
325
329
|
function getOrdererPublicWidgetOptions(fullOptions){const{options,height,layout}=fullOptions;return {options,height,layout}}function toCard(content){return {content,widgets:{},images:{}}}function getCategoryScore(content){if(/\d/.test(content)){return 0}if(/^\$?[a-zA-Z]+\$?$/.test(content)){return 2}return 1}function mergeCards(correctOptions,otherOptions){const allCards=[...correctOptions,...otherOptions];return [...new Set(allCards.map(card=>card.content))].filter(content=>content!=="").sort().sort((a,b)=>getCategoryScore(a)-getCategoryScore(b)).map(toCard)}
|
|
326
330
|
|
|
327
|
-
const defaultCorrectOptions=[toCard("$x$")];const defaultOtherOptions=[toCard("$y$")];const defaultWidgetOptions$
|
|
331
|
+
const defaultCorrectOptions=[toCard("$x$")];const defaultOtherOptions=[toCard("$y$")];const defaultWidgetOptions$9={correctOptions:defaultCorrectOptions,otherOptions:defaultOtherOptions,options:mergeCards(defaultCorrectOptions,defaultOtherOptions),height:"normal",layout:"horizontal"};const ordererWidgetLogic={name:"orderer",defaultWidgetOptions: defaultWidgetOptions$9,getPublicWidgetOptions:getOrdererPublicWidgetOptions,accessible:false};
|
|
328
332
|
|
|
329
|
-
const defaultWidgetOptions$
|
|
333
|
+
const defaultWidgetOptions$8={url:"",description:""};const phetSimulationWidgetLogic={name:"phet-simulation",defaultWidgetOptions: defaultWidgetOptions$8,accessible:true};
|
|
330
334
|
|
|
331
335
|
function getPlotterPublicWidgetOptions(options){const{correct,...publicOptions}=options;return publicOptions}
|
|
332
336
|
|
|
333
|
-
const defaultWidgetOptions$
|
|
337
|
+
const defaultWidgetOptions$7={scaleY:1,maxY:10,snapsPerLine:2,correct:[1],starting:[1],type:"bar",labels:["",""],categories:[""],picSize:30,picBoxHeight:36,plotDimensions:[275,200],labelInterval:1,picUrl:null};const plotterWidgetLogic={name:"plotter",defaultWidgetOptions: defaultWidgetOptions$7,getPublicWidgetOptions:getPlotterPublicWidgetOptions,accessible:false};
|
|
334
338
|
|
|
335
|
-
const defaultWidgetOptions$
|
|
339
|
+
const defaultWidgetOptions$6={programID:"",height:400};const pythonProgramWidgetLogic={name:"python-program",defaultWidgetOptions: defaultWidgetOptions$6,accessible:true};
|
|
336
340
|
|
|
337
341
|
function getRadioChoicePublicData(choice){const{id,content,isNoneOfTheAbove}=choice;return {id,content,isNoneOfTheAbove}}function usesNumCorrect(multipleSelect,countChoices,numCorrect){return multipleSelect&&countChoices&&numCorrect}function getRadioPublicWidgetOptions(options){const{numCorrect,choices,multipleSelect,countChoices}=options;return {...options,numCorrect:usesNumCorrect(multipleSelect,countChoices,numCorrect)?numCorrect:undefined,choices:choices.map(getRadioChoicePublicData)}}
|
|
338
342
|
|
|
339
|
-
const currentVersion={major:3,minor:0};const defaultWidgetOptions$
|
|
343
|
+
const currentVersion={major:3,minor:0};const defaultWidgetOptions$5={choices:[{content:"",id:"radio-choice-0"},{content:"",id:"radio-choice-1"},{content:"",id:"radio-choice-2"},{content:"",id:"radio-choice-3"}],randomize:false,hasNoneOfTheAbove:false,multipleSelect:false,countChoices:false,deselectEnabled:false};const radioWidgetLogic={name:"radio",version:currentVersion,defaultWidgetOptions:defaultWidgetOptions$5,getPublicWidgetOptions:getRadioPublicWidgetOptions,accessible:true};
|
|
340
344
|
|
|
341
|
-
function getSorterPublicWidgetOptions(options){return {...options,correct:sortAllButFirst(options.correct)}}function shuffleSorter(options,problemNum){const{correct}=options;const rng=seededRNG(problemNum??0);return shuffleDisplacingFirst(correct,rng)}function sortAllButFirst(cards){if(cards.length===0){return []}const[first,...rest]=cards;return [first,...rest.sort()]}function shuffleDisplacingFirst(array,rng){function isFirstElementDisplaced(shuffled){return shuffled[0]!==array[0]}return constrainedShuffle(array,rng,isFirstElementDisplaced)}
|
|
345
|
+
const SORTER_MAX_CARDS=10;function getSorterPublicWidgetOptions(options){return {...options,correct:sortAllButFirst(options.correct)}}function shuffleSorter(options,problemNum){const{correct}=options;const rng=seededRNG(problemNum??0);return shuffleDisplacingFirst(correct,rng)}function sortAllButFirst(cards){if(cards.length===0){return []}const[first,...rest]=cards;return [first,...rest.sort()]}function shuffleDisplacingFirst(array,rng){function isFirstElementDisplaced(shuffled){return shuffled[0]!==array[0]}return constrainedShuffle(array,rng,isFirstElementDisplaced)}
|
|
342
346
|
|
|
343
|
-
const defaultWidgetOptions$
|
|
347
|
+
const defaultWidgetOptions$4={correct:["$x$","$y$","$z$"],layout:"horizontal",padding:true};const sorterWidgetLogic={name:"sorter",defaultWidgetOptions: defaultWidgetOptions$4,getPublicWidgetOptions:getSorterPublicWidgetOptions,accessible:false};
|
|
344
348
|
|
|
345
349
|
function getTablePublicWidgetOptions(options){const{answers,...publicOptions}=options;return publicOptions}
|
|
346
350
|
|
|
347
|
-
const defaultRows=4;const defaultColumns=1;const answers=new Array(defaultRows).fill(0).map(()=>new Array(defaultColumns).fill(""));const defaultWidgetOptions$
|
|
351
|
+
const defaultRows=4;const defaultColumns=1;const answers=new Array(defaultRows).fill(0).map(()=>new Array(defaultColumns).fill(""));const defaultWidgetOptions$3={headers:[""],rows:defaultRows,columns:defaultColumns,answers:answers};const tableWidgetLogic={name:"table",defaultWidgetOptions: defaultWidgetOptions$3,getPublicWidgetOptions:getTablePublicWidgetOptions,accessible:true};
|
|
348
352
|
|
|
349
|
-
const defaultWidgetOptions$
|
|
353
|
+
const defaultWidgetOptions$2={location:""};const videoWidgetLogic={name:"video",defaultWidgetOptions: defaultWidgetOptions$2,supportedAlignments:["block","full-width"],defaultAlignment:"block",accessible:true};
|
|
350
354
|
|
|
351
|
-
const widgets=new Registry("Core widget registry");function registerWidget(type,logic){widgets.set(type,logic);}function isWidgetRegistered(type){const widgetLogic=widgets.get(type);return Boolean(widgetLogic)}function getCurrentVersion(type){const widgetLogic=widgets.get(type);return widgetLogic?.version||{major:0,minor:0}}const getPublicWidgetOptionsFunction=type=>{return widgets.get(type)?.getPublicWidgetOptions??(i=>i)};function getDefaultWidgetOptions(type){const widgetLogic=widgets.get(type);return widgetLogic?.defaultWidgetOptions||{}}function isAccessible(type,widgetOptions){const accessible=widgets.get(type)?.accessible;return typeof accessible==="function"?accessible(widgetOptions):!!accessible}const traverseChildWidgets
|
|
355
|
+
const widgets=new Registry("Core widget registry");function registerWidget(type,logic){widgets.set(type,logic);}function isWidgetRegistered(type){const widgetLogic=widgets.get(type);return Boolean(widgetLogic)}function getCurrentVersion(type){const widgetLogic=widgets.get(type);return widgetLogic?.version||{major:0,minor:0}}const getPublicWidgetOptionsFunction=type=>{return widgets.get(type)?.getPublicWidgetOptions??(i=>i)};function getDefaultWidgetOptions(type){const widgetLogic=widgets.get(type);return widgetLogic?.defaultWidgetOptions||{}}function isAccessible(type,widgetOptions){const accessible=widgets.get(type)?.accessible;return typeof accessible==="function"?accessible(widgetOptions):!!accessible}const traverseChildWidgets=(widgetInfo,traverseRenderer)=>{if(!traverseRenderer){throw new PerseusError("traverseRenderer must be provided, but was not",Errors.Internal)}if(!widgetInfo||!widgetInfo.type||!widgets.get(widgetInfo.type)){return widgetInfo}const widgetExports=widgets.get(widgetInfo.type);const props=widgetInfo.options;if(widgetExports?.traverseChildWidgets!=null&&props!=null){const newProps=widgetExports.traverseChildWidgets(props,traverseRenderer);return {...widgetInfo,options:newProps}}return widgetInfo};const getSupportedAlignments=type=>{const widgetLogic=widgets.get(type);if(!widgetLogic?.supportedAlignments?.[0]){return ["default"]}return widgetLogic?.supportedAlignments};const getDefaultAlignment=type=>{const widgetLogic=widgets.get(type);if(!widgetLogic?.defaultAlignment){return "block"}return widgetLogic.defaultAlignment};const getAlignmentClassName=(type,alignment)=>{switch(alignment){case "block":return " widget-block";case "inline-block":return " widget-inline-block";case "inline":return " widget-inline";case "wrap-left":return " widget-wrap-left";case "wrap-right":return " widget-wrap-right";case "full-width":return " widget-full-width";case "default":return getDefaultAlignment(type);default:return ""}};function registerCoreWidgets(){const widgets=[blankWidgetLogic,categorizerWidgetLogic,csProgramWidgetLogic,definitionWidgetLogic,deprecatedStandinWidgetLogic,dropdownWidgetLogic,explanationWidgetLogic,expressionWidgetLogic,fillInTheBlankWidgetLogic,gradedGroupWidgetLogic,gradedGroupSetWidgetLogic,grapherWidgetLogic,groupWidgetLogic,iframeWidgetLogic,imageWidgetLogic,inputNumberWidgetLogic,interactionWidgetLogic,interactiveGraphWidgetLogic,labelImageWidgetLogic,matcherWidgetLogic,matrixWidgetLogic,measurerWidgetLogic,numberLineWidgetLogic,numericInputWidgetLogic,ordererWidgetLogic,phetSimulationWidgetLogic,plotterWidgetLogic,pythonProgramWidgetLogic,radioWidgetLogic,sorterWidgetLogic,tableWidgetLogic,videoWidgetLogic];widgets.forEach(w=>{registerWidget(w.name,w);});}
|
|
352
356
|
|
|
353
357
|
var coreWidgetRegistry = /*#__PURE__*/Object.freeze({
|
|
354
358
|
__proto__: null,
|
|
@@ -362,16 +366,20 @@ var coreWidgetRegistry = /*#__PURE__*/Object.freeze({
|
|
|
362
366
|
isWidgetRegistered: isWidgetRegistered,
|
|
363
367
|
registerCoreWidgets: registerCoreWidgets,
|
|
364
368
|
registerWidget: registerWidget,
|
|
365
|
-
traverseChildWidgets: traverseChildWidgets
|
|
369
|
+
traverseChildWidgets: traverseChildWidgets
|
|
366
370
|
});
|
|
367
371
|
|
|
368
372
|
const applyDefaultsToWidget=oldWidgetInfo=>{const type=oldWidgetInfo.type;const latestVersion=getCurrentVersion(type);const version=oldWidgetInfo.version??latestVersion;const defaultOptions=getDefaultWidgetOptions(type);const options={...defaultOptions,...oldWidgetInfo.options};let alignment=oldWidgetInfo.alignment;if(alignment==null||alignment==="default"){alignment=getSupportedAlignments(type)?.[0];if(!alignment){throw new PerseusError("applyDefaultsToWidget: No default alignment found",Errors.Internal,{metadata:{widgetType:type}})}}return {...oldWidgetInfo,version,graded:oldWidgetInfo.graded??true,alignment,static:oldWidgetInfo.static??false,options}};function applyDefaultsToWidgets(oldWidgetOptions){return mapObject(oldWidgetOptions,applyDefaultsToWidget)}
|
|
369
373
|
|
|
370
|
-
function splitPerseusRenderer(original){
|
|
374
|
+
function splitPerseusRenderer(original){return {...original,widgets:splitWidgetsMap(original.widgets)}}function splitWidgetsMap(widgets){const upgradedWidgets=applyDefaultsToWidgets(deepClone(widgets??{}));const splitWidgets={};for(const[id,widget]of Object.entries(upgradedWidgets)){if(widget.static){splitWidgets[id]=widget;}else {const publicWidgetOptionsFun=getPublicWidgetOptionsFunction(widget.type);splitWidgets[id]={...widget,options:publicWidgetOptionsFun(widget.options)};}}return splitWidgets}
|
|
371
375
|
|
|
372
|
-
function
|
|
376
|
+
function getFillInTheBlankPublicWidgetOptions(options){return {...options,widgets:splitWidgetsMap(options.widgets)}}
|
|
377
|
+
|
|
378
|
+
const defaultWidgetOptions$1={content:"",widgets:{},tiles:[],maxUsesPerTile:1,randomize:false};const fillInTheBlankWidgetLogic={name:"fill-in-the-blank",version:{major:0,minor:0},defaultAlignment:"block",defaultWidgetOptions: defaultWidgetOptions$1,accessible:true,getPublicWidgetOptions:getFillInTheBlankPublicWidgetOptions,traverseChildWidgets:(props,traverseRenderer)=>({...props,...traverseRenderer(props)})};
|
|
373
379
|
|
|
374
|
-
|
|
380
|
+
function getFreeResponsePublicWidgetOptions(options){return {allowUnlimitedCharacters:options.allowUnlimitedCharacters,characterLimit:options.characterLimit,placeholder:options.placeholder,question:options.question}}
|
|
381
|
+
|
|
382
|
+
const defaultWidgetOptions={allowUnlimitedCharacters:false,characterLimit:500,placeholder:"Please provide response here",question:"",scoringCriteria:[{text:""}]};const freeResponseWidgetLogic={name:"free-response",defaultWidgetOptions,getPublicWidgetOptions:getFreeResponsePublicWidgetOptions};
|
|
375
383
|
|
|
376
384
|
function convertGrapherOptionsToInteractiveGraph(grapherOptions){if(grapherOptions.availableTypes.length!==1){return null}const[type]=grapherOptions.availableTypes;if(type==="quadratic"){return null}const graph={type:grapherFunctionTypeToInteractiveGraphType(type)};return {step:grapherOptions.graph.step,gridStep:grapherOptions.graph.gridStep,snapStep:grapherOptions.graph.snapStep,backgroundImage:grapherOptions.graph.backgroundImage,markings:grapherOptions.graph.markings,labels:grapherOptions.graph.labels.map(wrapTexInDelimitersForMarkdown),labelLocation:"onAxis",showAxisArrows:{xMin:true,xMax:true,yMin:true,yMax:true},showAxisTicks:{x:true,y:true},showProtractor:grapherOptions.graph.showProtractor??false,showTooltips:grapherOptions.graph.showTooltips??false,range:grapherOptions.graph.range,graph,correct:grapherOptions.correct?grapherAnswerTypesToPerseusGraphType(grapherOptions.correct):graph,lockedFigures:[]}}function convertGrapherUserInputToInteractiveGraph(grapherUserInput){return grapherAnswerTypesToPerseusGraphType(grapherUserInput)}function convertInteractiveGraphUserInputToGrapher(interactiveGraphUserInput){switch(interactiveGraphUserInput.type){case "absolute-value":return {type:"absolute_value",coords:interactiveGraphUserInput.coords??null};case "exponential":{invariant(interactiveGraphUserInput.asymptote!=null,"exponential graph asymptote must not be nullish in user input");const asymptoteY=interactiveGraphUserInput.asymptote;return {type:"exponential",coords:interactiveGraphUserInput.coords??null,asymptote:[[0,asymptoteY],[1,asymptoteY]]}}case "linear":return {type:"linear",coords:interactiveGraphUserInput.coords??null};case "logarithm":{invariant(interactiveGraphUserInput.asymptote!=null,"logarithm graph asymptote must not be nullish in user input");const asymptoteX=interactiveGraphUserInput.asymptote;return {type:"logarithm",coords:interactiveGraphUserInput.coords??null,asymptote:[[asymptoteX,0],[asymptoteX,1]]}}case "sinusoid":return {type:"sinusoid",coords:interactiveGraphUserInput.coords??null};case "tangent":return {type:"tangent",coords:interactiveGraphUserInput.coords??null};case "angle":case "circle":case "linear-system":case "none":case "point":case "polygon":case "quadratic":case "ray":case "segment":case "vector":throw Error("Can't convert interactive-graph user input to grapher user input. Type: "+interactiveGraphUserInput.type);default:throw new UnreachableCaseError(interactiveGraphUserInput)}}function grapherAnswerTypesToPerseusGraphType(grapherAnswerTypes){switch(grapherAnswerTypes.type){case "absolute_value":return {type:"absolute-value",coords:grapherAnswerTypes.coords};case "exponential":return {type:"exponential",coords:grapherAnswerTypes.coords,asymptote:grapherAnswerTypes.asymptote[0][1]};case "linear":return {type:"linear",coords:grapherAnswerTypes.coords};case "logarithm":return {type:"logarithm",coords:grapherAnswerTypes.coords,asymptote:grapherAnswerTypes.asymptote[0][0]};case "quadratic":throw Error("Can't convert GrapherAnswerTypes to interactive graph. Type: quadratic");case "sinusoid":return {type:"sinusoid",coords:grapherAnswerTypes.coords};case "tangent":return {type:"tangent",coords:grapherAnswerTypes.coords};default:throw new UnreachableCaseError(grapherAnswerTypes)}}function grapherFunctionTypeToInteractiveGraphType(type){return type==="absolute_value"?"absolute-value":type}function wrapTexInDelimitersForMarkdown(tex){return `$${tex}$`}
|
|
377
385
|
|
|
@@ -383,7 +391,7 @@ function splitPerseusItem(original){const item=deepClone(original);return {...it
|
|
|
383
391
|
|
|
384
392
|
const PerseusFeatureFlags=["perseus-renderer-upgrade","desmos-calculator","article-extras","dnd-widget-fitb"];function isFeatureOn(props,flag){return props.apiOptions?.flags?.[flag]??false}
|
|
385
393
|
|
|
386
|
-
const noop=function(){};const deepCallbackFor=function(contentCallback,widgetCallback,optionsCallback){const deepCallback=function(widgetInfo,widgetId){const newWidgetInfo=traverseChildWidgets
|
|
394
|
+
const noop=function(){};const deepCallbackFor=function(contentCallback,widgetCallback,optionsCallback){const deepCallback=function(widgetInfo,widgetId){const newWidgetInfo=traverseChildWidgets(widgetInfo,rendererOptions=>{return traverseRenderer(rendererOptions,contentCallback,deepCallback,optionsCallback)});const userWidgetInfo=widgetCallback(newWidgetInfo,widgetId);if(userWidgetInfo!==undefined){return userWidgetInfo}return newWidgetInfo};return deepCallback};const traverseRenderer=function(rendererOptions,contentCallback,deepWidgetCallback,optionsCallback){let newContent=rendererOptions.content;if(rendererOptions.content!=null){const modifiedContent=contentCallback(rendererOptions.content);if(modifiedContent!==undefined){newContent=modifiedContent;}}const newWidgets=mapObject(rendererOptions.widgets||{},function(widgetInfo,widgetId){if(widgetInfo==null||widgetInfo.type==null){return widgetInfo}return deepWidgetCallback(widgetInfo,widgetId)});const newOptions=_.extend({},rendererOptions,{content:newContent,widgets:newWidgets});const userOptions=optionsCallback(newOptions);if(userOptions!==undefined){return userOptions}return newOptions};const traverse=function(rendererOptions,contentCallback,widgetCallback,optionsCallback){contentCallback=contentCallback||noop;widgetCallback=widgetCallback||noop;optionsCallback=optionsCallback||noop;return traverseRenderer(rendererOptions,contentCallback,deepCallbackFor(contentCallback,widgetCallback,optionsCallback),optionsCallback)};
|
|
387
395
|
|
|
388
396
|
function isItemAccessible(itemData){const ast=parse$1(itemData.question.content);const widgetIdsInUse=getWidgetIdsFromContent(itemData.question.content);let hasInaccessibleImage=false;traverseContent(ast,node=>{if(node.type==="image"&&(node.alt==null||node.alt==="")){hasInaccessibleImage=true;}});if(hasInaccessibleImage){return false}const itemDataWithOnlyActiveWidgets={...itemData,question:{...itemData.question,widgets:Object.fromEntries(Object.entries(itemData.question.widgets).filter(([id])=>widgetIdsInUse.includes(id)))},hints:itemData.hints.map(hint=>{const hintWidgetIdsInUse=getWidgetIdsFromContent(hint.content);return {...hint,widgets:Object.fromEntries(Object.entries(hint.widgets).filter(([id])=>hintWidgetIdsInUse.includes(id)))}})};let hasInaccessibleWidget=false;const checkAccessibility=info=>{if(info.type&&!isAccessible(info.type,info.options)){hasInaccessibleWidget=true;}};traverse(itemDataWithOnlyActiveWidgets.question,null,checkAccessibility);for(const hint of itemDataWithOnlyActiveWidgets.hints){traverse(hint,null,checkAccessibility);}return !hasInaccessibleWidget}
|
|
389
397
|
|
|
@@ -397,6 +405,8 @@ function generateExplanationOptions(options){return {...explanationWidgetLogic.d
|
|
|
397
405
|
|
|
398
406
|
function generateExpressionOptions(options){return {...expressionWidgetLogic.defaultWidgetOptions,...options}}function generateExpressionAnswerForm(answerFormOptions){return {value:"",form:false,simplify:false,considered:"wrong",...answerFormOptions}}function generateExpressionWidget(expressionWidgetProperties){return {type:"expression",graded:true,version:{major:0,minor:0},static:false,alignment:"default",options:generateExpressionOptions(),...expressionWidgetProperties}}
|
|
399
407
|
|
|
408
|
+
function generateAnswerTile(tile){const defaultAnswerTile={id:"answer-tile-1",content:"answer",label:"answer"};return {...defaultAnswerTile,...tile}}function generateFillInTheBlankOptions(options){return {...fillInTheBlankWidgetLogic.defaultWidgetOptions,...options}}function generateFillInTheBlankWidget(fillInTheBlankWidgetProperties){return {type:"fill-in-the-blank",graded:true,version:{major:0,minor:0},static:false,alignment:"default",...fillInTheBlankWidgetProperties,options:generateFillInTheBlankOptions(fillInTheBlankWidgetProperties?.options)}}
|
|
409
|
+
|
|
400
410
|
function generateFreeResponseOptions(options){return {...freeResponseWidgetLogic.defaultWidgetOptions,...options}}function generateFreeResponseWidget(freeResponseWidgetProperties){return {type:"free-response",graded:true,version:{major:0,minor:0},static:false,alignment:"default",options:generateFreeResponseOptions(),...freeResponseWidgetProperties}}
|
|
401
411
|
|
|
402
412
|
function generateGradedGroupOptions(options){return {...gradedGroupWidgetLogic.defaultWidgetOptions,...options}}function generateGradedGroupWidget(gradedGroupWidgetProperties){return {type:"graded-group",graded:false,version:{major:0,minor:0},static:false,alignment:"default",options:generateGradedGroupOptions(),...gradedGroupWidgetProperties}}
|
|
@@ -453,5 +463,5 @@ const denylist=["key","ref","containerSizeClass","widgetId","onChange","problemN
|
|
|
453
463
|
|
|
454
464
|
registerCoreWidgets();
|
|
455
465
|
|
|
456
|
-
export { coreWidgetRegistry as CoreWidgetRegistry, ErrorCodes, Errors, grapherUtil as GrapherUtil, ItemExtras, PerseusError, PerseusExpressionAnswerFormConsidered, PerseusFeatureFlags, Registry, addWidget, applyDefaultsToWidget, applyDefaultsToWidgets, approximateDeepEqual, approximateEqual, blankWidgetLogic as blankLogic, categorizerWidgetLogic as categorizerLogic, convertGrapherOptionsToInteractiveGraph, convertGrapherUserInputToInteractiveGraph, convertInteractiveGraphUserInputToGrapher, csProgramWidgetLogic as csProgramLogic, deepClone, definitionWidgetLogic as definitionLogic, deriveExtraKeys, deriveNumCorrect, dropdownWidgetLogic as dropdownLogic, excludeDenylistKeys, explanationWidgetLogic as explanationLogic, expressionWidgetLogic as expressionLogic, freeResponseWidgetLogic as freeResponseLogic, generateBlankOptions, generateBlankWidget, generateCategorizerOptions, generateCategorizerWidget, generateDefinitionOptions, generateDefinitionWidget, generateDropdownOptions, generateDropdownWidget, generateExplanationOptions, generateExplanationWidget, generateExpressionAnswerForm, generateExpressionOptions, generateExpressionWidget, generateFreeResponseOptions, generateFreeResponseWidget, generateGradedGroupOptions, generateGradedGroupSetWidget, generateGradedGroupWidget, generateGrapherWidgetOptions, generateGroupOptions, generateGroupWidget, generateIGAbsoluteValueGraph, generateIGAngleGraph, generateIGCircleGraph, generateIGExponentialGraph, generateIGLinearGraph, generateIGLinearSystemGraph, generateIGLockedEllipse, generateIGLockedFunction, generateIGLockedLabel, generateIGLockedLine, generateIGLockedPoint, generateIGLockedPolygon, generateIGLockedVector, generateIGLogarithmGraph, generateIGNoneGraph, generateIGPointGraph, generateIGPolygonGraph, generateIGQuadraticGraph, generateIGRayGraph, generateIGSegmentGraph, generateIGSinusoidGraph, generateIGTangentGraph, generateIGVectorGraph, generateImageOptions, generateImageWidget, generateInputNumberAnswer, generateInputNumberOptions, generateInputNumberWidget, generateInteractiveGraphOptions, generateInteractiveGraphQuestion, generateInteractiveGraphWidget, generateLabelImageOptions, generateLabelImageWidget, generateMatcherOptions, generateMatcherWidget, generateMatrixOptions, generateMatrixWidget, generateMeasurerOptions, generateMeasurerWidget, generateNumberLineOptions, generateNumberLineWidget, generateNumericInputAnswer, generateNumericInputOptions, generateNumericInputWidget, generateOrdererOption, generateOrdererOptions, generateOrdererWidget, generatePhetSimulationOptions, generatePhetSimulationWidget, generatePlotterOptions, generatePlotterWidget, generateRadioChoice, generateRadioOptions, generateRadioWidget, generateSimpleRadioItem, generateSimpleRadioQuestion, generateSorterOptions, generateSorterWidget, generateTableOptions, generateTestPerseusItem, generateTestPerseusRenderer, generateVideoWidget, getAnswersFromWidgets, getBaseUrl, getCSProgramPublicWidgetOptions, getCategorizerPublicWidgetOptions, getDataUrl, getDecimalSeparator, getDefaultAnswerArea, getDefaultFigureForType, getDivideSymbol, getDivideSymbolForTex, getDropdownPublicWidgetOptions, getExpressionPublicWidgetOptions, getFreeResponsePublicWidgetOptions, getGrapherPublicWidgetOptions, getGroupPublicWidgetOptions, getIFramePublicWidgetOptions, getImageSizeModern, getInteractiveGraphPublicWidgetOptions, getLabelImagePublicWidgetOptions, getMatcherPublicWidgetOptions, getMatrixPublicWidgetOptions, getMatrixSize, getNumberLinePublicWidgetOptions, getNumericInputPublicWidgetOptions, getOrdererPublicWidgetOptions, getPerseusAIData, getPlotterPublicWidgetOptions, getRadioPublicWidgetOptions, getRealImageUrl, getSorterPublicWidgetOptions, getSvgUrl, getTablePublicWidgetOptions, getWidgetIdsFromContent, getWidgetIdsFromContentByType, gradedGroupWidgetLogic as gradedGroupLogic, gradedGroupSetWidgetLogic as gradedGroupSetLogic, grapherWidgetLogic as grapherLogic, groupWidgetLogic as groupLogic, iframeWidgetLogic as iframeLogic, imageWidgetLogic as imageLogic, injectWidgets, inputNumberWidgetLogic as inputNumberLogic, interactionWidgetLogic as interactionLogic, interactiveGraphWidgetLogic as interactiveGraphLogic, isFailure, isFeatureOn, isItemAccessible, isLabeledSVG, isSuccess, itemHasHints, itemHasRationales, labelImageWidgetLogic as labelImageLogic, libVersion, lockedFigureColorNames, lockedFigureColors, lockedFigureFillStyles, makeSafeUrl, mapObject, matcherWidgetLogic as matcherLogic, matrixWidgetLogic as matrixLogic, measurerWidgetLogic as measurerLogic, mergeCards, numberLineWidgetLogic as numberLineLogic, numericInputWidgetLogic as numericInputLogic, ordererWidgetLogic as ordererLogic, parseAndMigratePerseusArticle, parseAndMigratePerseusItem, parseAndMigratePerseusRenderer, parseAndMigrateUserInputMap, phetSimulationWidgetLogic as phetSimulationLogic, plotterWidgetLogic as plotterLogic, plotterPlotTypes, pluck, pythonProgramWidgetLogic as pythonProgramLogic, radioWidgetLogic as radioLogic, random, removeOrphanedWidgetsFromPerseusItem, seededRNG, shuffle, shuffleMatcher, shuffleSorter, sorterWidgetLogic as sorterLogic, splitPerseusItem, splitPerseusItemJSON, tableWidgetLogic as tableLogic, toCard, traverse, usesNumCorrect, videoWidgetLogic as videoLogic };
|
|
466
|
+
export { coreWidgetRegistry as CoreWidgetRegistry, ErrorCodes, Errors, grapherUtil as GrapherUtil, ItemExtras, PerseusError, PerseusExpressionAnswerFormConsidered, PerseusFeatureFlags, Registry, SORTER_MAX_CARDS, addWidget, applyDefaultsToWidget, applyDefaultsToWidgets, approximateDeepEqual, approximateEqual, blankWidgetLogic as blankLogic, categorizerWidgetLogic as categorizerLogic, convertGrapherOptionsToInteractiveGraph, convertGrapherUserInputToInteractiveGraph, convertInteractiveGraphUserInputToGrapher, csProgramWidgetLogic as csProgramLogic, deepClone, definitionWidgetLogic as definitionLogic, deriveExtraKeys, deriveNumCorrect, dropdownWidgetLogic as dropdownLogic, excludeDenylistKeys, explanationWidgetLogic as explanationLogic, expressionWidgetLogic as expressionLogic, fillInTheBlankWidgetLogic as fillInTheBlankLogic, freeResponseWidgetLogic as freeResponseLogic, generateAnswerTile, generateBlankOptions, generateBlankWidget, generateCategorizerOptions, generateCategorizerWidget, generateDefinitionOptions, generateDefinitionWidget, generateDropdownOptions, generateDropdownWidget, generateExplanationOptions, generateExplanationWidget, generateExpressionAnswerForm, generateExpressionOptions, generateExpressionWidget, generateFillInTheBlankOptions, generateFillInTheBlankWidget, generateFreeResponseOptions, generateFreeResponseWidget, generateGradedGroupOptions, generateGradedGroupSetWidget, generateGradedGroupWidget, generateGrapherWidgetOptions, generateGroupOptions, generateGroupWidget, generateIGAbsoluteValueGraph, generateIGAngleGraph, generateIGCircleGraph, generateIGExponentialGraph, generateIGLinearGraph, generateIGLinearSystemGraph, generateIGLockedEllipse, generateIGLockedFunction, generateIGLockedLabel, generateIGLockedLine, generateIGLockedPoint, generateIGLockedPolygon, generateIGLockedVector, generateIGLogarithmGraph, generateIGNoneGraph, generateIGPointGraph, generateIGPolygonGraph, generateIGQuadraticGraph, generateIGRayGraph, generateIGSegmentGraph, generateIGSinusoidGraph, generateIGTangentGraph, generateIGVectorGraph, generateImageOptions, generateImageWidget, generateInputNumberAnswer, generateInputNumberOptions, generateInputNumberWidget, generateInteractiveGraphOptions, generateInteractiveGraphQuestion, generateInteractiveGraphWidget, generateLabelImageOptions, generateLabelImageWidget, generateMatcherOptions, generateMatcherWidget, generateMatrixOptions, generateMatrixWidget, generateMeasurerOptions, generateMeasurerWidget, generateNumberLineOptions, generateNumberLineWidget, generateNumericInputAnswer, generateNumericInputOptions, generateNumericInputWidget, generateOrdererOption, generateOrdererOptions, generateOrdererWidget, generatePhetSimulationOptions, generatePhetSimulationWidget, generatePlotterOptions, generatePlotterWidget, generateRadioChoice, generateRadioOptions, generateRadioWidget, generateSimpleRadioItem, generateSimpleRadioQuestion, generateSorterOptions, generateSorterWidget, generateTableOptions, generateTestPerseusItem, generateTestPerseusRenderer, generateVideoWidget, getAnswersFromWidgets, getBaseUrl, getCSProgramPublicWidgetOptions, getCategorizerPublicWidgetOptions, getDataUrl, getDecimalSeparator, getDefaultAnswerArea, getDefaultFigureForType, getDivideSymbol, getDivideSymbolForTex, getDropdownPublicWidgetOptions, getExpressionPublicWidgetOptions, getFreeResponsePublicWidgetOptions, getGrapherPublicWidgetOptions, getGroupPublicWidgetOptions, getIFramePublicWidgetOptions, getImageSizeModern, getInteractiveGraphPublicWidgetOptions, getLabelImagePublicWidgetOptions, getMatcherPublicWidgetOptions, getMatrixPublicWidgetOptions, getMatrixSize, getNumberLinePublicWidgetOptions, getNumericInputPublicWidgetOptions, getOrdererPublicWidgetOptions, getPerseusAIData, getPlotterPublicWidgetOptions, getRadioPublicWidgetOptions, getRealImageUrl, getSorterPublicWidgetOptions, getSvgUrl, getTablePublicWidgetOptions, getWidgetIdsFromContent, getWidgetIdsFromContentByType, gradedGroupWidgetLogic as gradedGroupLogic, gradedGroupSetWidgetLogic as gradedGroupSetLogic, grapherWidgetLogic as grapherLogic, groupWidgetLogic as groupLogic, iframeWidgetLogic as iframeLogic, imageWidgetLogic as imageLogic, injectWidgets, inputNumberWidgetLogic as inputNumberLogic, interactionWidgetLogic as interactionLogic, interactiveGraphWidgetLogic as interactiveGraphLogic, isFailure, isFeatureOn, isItemAccessible, isLabeledSVG, isSuccess, itemHasHints, itemHasRationales, labelImageWidgetLogic as labelImageLogic, libVersion, lockedFigureColorNames, lockedFigureColors, lockedFigureFillStyles, makeSafeUrl, mapObject, matcherWidgetLogic as matcherLogic, matrixWidgetLogic as matrixLogic, measurerWidgetLogic as measurerLogic, mergeCards, numberLineWidgetLogic as numberLineLogic, numericInputWidgetLogic as numericInputLogic, ordererWidgetLogic as ordererLogic, parseAndMigratePerseusArticle, parseAndMigratePerseusItem, parseAndMigratePerseusRenderer, parseAndMigrateUserInputMap, phetSimulationWidgetLogic as phetSimulationLogic, plotterWidgetLogic as plotterLogic, plotterPlotTypes, pluck, pythonProgramWidgetLogic as pythonProgramLogic, radioWidgetLogic as radioLogic, random, removeOrphanedWidgetsFromPerseusItem, seededRNG, shuffle, shuffleMatcher, shuffleSorter, sorterWidgetLogic as sorterLogic, splitPerseusItem, splitPerseusItemJSON, tableWidgetLogic as tableLogic, toCard, traverse, usesNumCorrect, videoWidgetLogic as videoLogic };
|
|
457
467
|
//# sourceMappingURL=index.js.map
|