@khanacademy/perseus-core 39.0.0 → 39.1.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/es/index.js +3 -3
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/widgets/sorter/sorter-util.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export { getInteractiveGraphPublicWidgetOptions, type InteractiveGraphPublicWidg
|
|
|
159
159
|
/** @hidden */
|
|
160
160
|
export { getLabelImagePublicWidgetOptions } from "./widgets/label-image/label-image-util";
|
|
161
161
|
/** @hidden */
|
|
162
|
-
export { getSorterPublicWidgetOptions, shuffleSorter, } from "./widgets/sorter/sorter-util";
|
|
162
|
+
export { getSorterPublicWidgetOptions, shuffleSorter, SORTER_MAX_CARDS, } from "./widgets/sorter/sorter-util";
|
|
163
163
|
/** @hidden */
|
|
164
164
|
export type { BlankPublicWidgetOptions } from "./widgets/blank/blank-util";
|
|
165
165
|
/** @hidden */
|
package/dist/index.js
CHANGED
|
@@ -256,7 +256,7 @@ const parseUserInputMap=(rawValue,ctx)=>{if(!isPlainObject(rawValue)){return ctx
|
|
|
256
256
|
|
|
257
257
|
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}
|
|
258
258
|
|
|
259
|
-
const libName="@khanacademy/perseus-core";const libVersion="39.
|
|
259
|
+
const libName="@khanacademy/perseus-core";const libVersion="39.1.0";perseusUtils.addLibraryVersionToPerseusDebug(libName,libVersion);
|
|
260
260
|
|
|
261
261
|
const Errors=Object.freeze({Unknown:"Unknown",Internal:"Internal",InvalidInput:"InvalidInput",NotAllowed:"NotAllowed",TransientService:"TransientService",Service:"Service"});
|
|
262
262
|
|
|
@@ -366,7 +366,7 @@ function getRadioChoicePublicData(choice){const{id,content,isNoneOfTheAbove}=cho
|
|
|
366
366
|
|
|
367
367
|
const currentVersion={major:3,minor:0};const defaultWidgetOptions$4={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$4,getPublicWidgetOptions:getRadioPublicWidgetOptions,accessible:true};
|
|
368
368
|
|
|
369
|
-
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)}
|
|
369
|
+
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)}
|
|
370
370
|
|
|
371
371
|
const defaultWidgetOptions$3={correct:["$x$","$y$","$z$"],layout:"horizontal",padding:true};const sorterWidgetLogic={name:"sorter",defaultWidgetOptions: defaultWidgetOptions$3,getPublicWidgetOptions:getSorterPublicWidgetOptions,accessible:false};
|
|
372
372
|
|
|
@@ -490,6 +490,7 @@ exports.PerseusError = PerseusError;
|
|
|
490
490
|
exports.PerseusExpressionAnswerFormConsidered = PerseusExpressionAnswerFormConsidered;
|
|
491
491
|
exports.PerseusFeatureFlags = PerseusFeatureFlags;
|
|
492
492
|
exports.Registry = Registry;
|
|
493
|
+
exports.SORTER_MAX_CARDS = SORTER_MAX_CARDS;
|
|
493
494
|
exports.addWidget = addWidget;
|
|
494
495
|
exports.applyDefaultsToWidget = applyDefaultsToWidget;
|
|
495
496
|
exports.applyDefaultsToWidgets = applyDefaultsToWidgets;
|