@khanacademy/perseus-core 39.2.2 → 39.2.3
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/es/index.js +3 -3
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/widgets/sorter/sorter-util.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -161,7 +161,7 @@ export { getInteractiveGraphPublicWidgetOptions, type InteractiveGraphPublicWidg
|
|
|
161
161
|
/** @hidden */
|
|
162
162
|
export { getLabelImagePublicWidgetOptions } from "./widgets/label-image/label-image-util";
|
|
163
163
|
/** @hidden */
|
|
164
|
-
export { getSorterPublicWidgetOptions, shuffleSorter, SORTER_MAX_CARDS, } from "./widgets/sorter/sorter-util";
|
|
164
|
+
export { getSorterPublicWidgetOptions, exceedsCardLimit, shuffleSorter, SORTER_MAX_HORIZONTAL_CARDS, SORTER_MAX_CARDS, } from "./widgets/sorter/sorter-util";
|
|
165
165
|
/** @hidden */
|
|
166
166
|
export type { BlankPublicWidgetOptions } from "./widgets/blank/blank-util";
|
|
167
167
|
/** @hidden */
|
package/dist/index.js
CHANGED
|
@@ -260,7 +260,7 @@ const parseUserInputMap=(rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx
|
|
|
260
260
|
|
|
261
261
|
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}
|
|
262
262
|
|
|
263
|
-
const libName="@khanacademy/perseus-core";const libVersion="39.2.
|
|
263
|
+
const libName="@khanacademy/perseus-core";const libVersion="39.2.3";perseusUtils.addLibraryVersionToPerseusDebug(libName,libVersion);
|
|
264
264
|
|
|
265
265
|
const Errors=Object.freeze({Unknown:"Unknown",Internal:"Internal",InvalidInput:"InvalidInput",NotAllowed:"NotAllowed",TransientService:"TransientService",Service:"Service"});
|
|
266
266
|
|
|
@@ -370,7 +370,7 @@ function getRadioChoicePublicData(choice){const{id,content,isNoneOfTheAbove}=cho
|
|
|
370
370
|
|
|
371
371
|
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};
|
|
372
372
|
|
|
373
|
-
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)}
|
|
373
|
+
const SORTER_MAX_CARDS=10;function exceedsCardLimit(correct){return correct.length>SORTER_MAX_CARDS}const SORTER_MAX_HORIZONTAL_CARDS=5;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)}
|
|
374
374
|
|
|
375
375
|
const defaultWidgetOptions$4={correct:["$x$","$y$","$z$"],layout:"horizontal",padding:true};const sorterWidgetLogic={name:"sorter",defaultWidgetOptions: defaultWidgetOptions$4,getPublicWidgetOptions:getSorterPublicWidgetOptions,accessible:false};
|
|
376
376
|
|
|
@@ -501,6 +501,7 @@ exports.PerseusExpressionAnswerFormConsidered = PerseusExpressionAnswerFormConsi
|
|
|
501
501
|
exports.PerseusFeatureFlags = PerseusFeatureFlags;
|
|
502
502
|
exports.Registry = Registry;
|
|
503
503
|
exports.SORTER_MAX_CARDS = SORTER_MAX_CARDS;
|
|
504
|
+
exports.SORTER_MAX_HORIZONTAL_CARDS = SORTER_MAX_HORIZONTAL_CARDS;
|
|
504
505
|
exports.addWidget = addWidget;
|
|
505
506
|
exports.applyDefaultsToWidget = applyDefaultsToWidget;
|
|
506
507
|
exports.applyDefaultsToWidgets = applyDefaultsToWidgets;
|
|
@@ -517,6 +518,7 @@ exports.definitionLogic = definitionWidgetLogic;
|
|
|
517
518
|
exports.deriveExtraKeys = deriveExtraKeys;
|
|
518
519
|
exports.deriveNumCorrect = deriveNumCorrect;
|
|
519
520
|
exports.dropdownLogic = dropdownWidgetLogic;
|
|
521
|
+
exports.exceedsCardLimit = exceedsCardLimit;
|
|
520
522
|
exports.excludeDenylistKeys = excludeDenylistKeys;
|
|
521
523
|
exports.explanationLogic = explanationWidgetLogic;
|
|
522
524
|
exports.expressionLogic = expressionWidgetLogic;
|