@khanacademy/perseus-core 0.0.0-PR3152-20251218202743 → 0.0.0-PR3154-20251219001324
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 +9 -0
- package/dist/es/index.item-splitting.js +2 -2
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +14 -6
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.item-splitting.js +2 -2
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +38 -5
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/hint.d.ts +1 -0
- package/dist/utils/generators/graded-group-set-widget-generator.d.ts +2 -0
- package/dist/utils/generators/graded-group-widget-generator.d.ts +3 -0
- package/dist/utils/generators/group-widget-generator.d.ts +3 -0
- package/dist/utils/generators/interactive-graph-widget-generator.d.ts +21 -0
- package/dist/widgets/interactive-graph/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/data-schema.d.ts
CHANGED
|
@@ -246,6 +246,15 @@ export type Hint = PerseusRenderer & {
|
|
|
246
246
|
* is displayed. This allows for hints that build upon each other.
|
|
247
247
|
*/
|
|
248
248
|
replace?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* The UI needs to know how many hints there are before we have
|
|
251
|
+
* answerful PerseusItems. In a crunch, we decided to replace existing hints
|
|
252
|
+
* with empty hints and add a placeholder flag to signal that they're
|
|
253
|
+
* not real hints.
|
|
254
|
+
*
|
|
255
|
+
* TODO(LEMS-3806): there's probably a better way to do this
|
|
256
|
+
*/
|
|
257
|
+
placeholder?: boolean;
|
|
249
258
|
};
|
|
250
259
|
export type PerseusImageDetail = {
|
|
251
260
|
width: number;
|
|
@@ -150,7 +150,7 @@ const parsePerseusRenderer=defaulted(object({content:defaulted(string,()=>""),wi
|
|
|
150
150
|
|
|
151
151
|
union(parsePerseusRenderer).or(array(parsePerseusRenderer)).parser;
|
|
152
152
|
|
|
153
|
-
const parseHint=object({replace:defaulted(optional(boolean),()=>undefined),content:string,widgets:defaulted(parseWidgetsMap,()=>({})),images:parseImages,metadata:any});
|
|
153
|
+
const parseHint=object({replace:defaulted(optional(boolean),()=>undefined),placeholder:defaulted(optional(boolean),()=>undefined),content:string,widgets:defaulted(parseWidgetsMap,()=>({})),images:parseImages,metadata:any});
|
|
154
154
|
|
|
155
155
|
const parsePerseusAnswerArea=pipeParsers(defaulted(object({}),()=>({}))).then(convert(toAnswerArea)).parser;function toAnswerArea(raw){return {calculator:!!raw.calculator,financialCalculatorMonthlyPayment:!!raw.financialCalculatorMonthlyPayment,financialCalculatorTotalAmount:!!raw.financialCalculatorTotalAmount,financialCalculatorTimeToPayOff:!!raw.financialCalculatorTimeToPayOff,periodicTable:!!raw.periodicTable,periodicTableWithKey:!!raw.periodicTableWithKey}}
|
|
156
156
|
|
|
@@ -186,7 +186,7 @@ const DEFAULT_STATIC=false;const applyDefaultsToWidget=oldWidgetInfo=>{const typ
|
|
|
186
186
|
|
|
187
187
|
function splitPerseusRenderer(original){const clone=deepClone(original);const originalWidgets=clone.widgets??{};const upgradedWidgets=applyDefaultsToWidgets(originalWidgets);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 {...original,widgets:splitWidgets}}
|
|
188
188
|
|
|
189
|
-
function splitPerseusItem(original){const item=deepClone(original);return {...item,question:splitPerseusRenderer(item.question),hints:
|
|
189
|
+
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))}
|
|
190
190
|
|
|
191
191
|
export { splitPerseusItem, splitPerseusItemJSON };
|
|
192
192
|
//# sourceMappingURL=index.item-splitting.js.map
|