@khanacademy/perseus-core 38.1.0 → 39.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/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/feature-flags.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -7
- package/dist/es/index.item-splitting.js +0 -182
- package/dist/es/index.item-splitting.js.map +0 -1
- package/dist/index.item-splitting.d.ts +0 -2
- package/dist/index.item-splitting.js +0 -207
- package/dist/index.item-splitting.js.map +0 -1
package/dist/feature-flags.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* export const PerseusFeatureFlags = [];
|
|
10
10
|
* 4. Also update the testing/feature-flags-util.ts for testing purpose
|
|
11
11
|
*/
|
|
12
|
-
declare const PerseusFeatureFlags: readonly ["perseus-renderer-upgrade", "desmos-calculator", "article-extras"];
|
|
12
|
+
declare const PerseusFeatureFlags: readonly ["perseus-renderer-upgrade", "desmos-calculator", "article-extras", "dnd-widget-fitb"];
|
|
13
13
|
export default PerseusFeatureFlags;
|
|
14
14
|
/**
|
|
15
15
|
* Checks if a feature flag is enabled in the given props.
|
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="
|
|
259
|
+
const libName="@khanacademy/perseus-core";const libVersion="39.0.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
|
|
|
@@ -409,7 +409,7 @@ const DEFAULT_COLOR="grayH";function getDefaultFigureForType(type){switch(type){
|
|
|
409
409
|
|
|
410
410
|
function splitPerseusItem(original){const item=deepClone(original);return {...item,question:splitPerseusRenderer(item.question),hints:original.hints.map(()=>({content:"",widgets:{},images:{},placeholder:true}))}}function splitPerseusItemJSON(data){const parseResult=parseAndMigratePerseusItem(data);if(isFailure(parseResult)){throw new SyntaxError(parseResult.detail.message)}const item=parseResult.value;return JSON.stringify(splitPerseusItem(item))}
|
|
411
411
|
|
|
412
|
-
const PerseusFeatureFlags=["perseus-renderer-upgrade","desmos-calculator","article-extras"];function isFeatureOn(props,flag){return props.apiOptions?.flags?.[flag]??false}
|
|
412
|
+
const PerseusFeatureFlags=["perseus-renderer-upgrade","desmos-calculator","article-extras","dnd-widget-fitb"];function isFeatureOn(props,flag){return props.apiOptions?.flags?.[flag]??false}
|
|
413
413
|
|
|
414
414
|
const noop=function(){};const deepCallbackFor=function(contentCallback,widgetCallback,optionsCallback){const deepCallback=function(widgetInfo,widgetId){const newWidgetInfo=traverseChildWidgets$1(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=___default.default.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)};
|
|
415
415
|
|