@khanacademy/perseus 19.6.1 → 19.6.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 +22 -17
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +9 -0
- package/dist/widgets/categorizer.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -19315,6 +19315,15 @@ const isIdPathPrefix = function (prefixArray, wholeArray) {
|
|
|
19315
19315
|
// some return a custom-built object, some delegate to
|
|
19316
19316
|
// `WidgetJsonifyDeprecated` which returns an object containing widget props
|
|
19317
19317
|
// (filtered by deprecated keys)).
|
|
19318
|
+
/**
|
|
19319
|
+
* The Widget type represents the common API that the Renderer uses to interact
|
|
19320
|
+
* with all widgets. All widgets must implement the methods in this API, unless
|
|
19321
|
+
* they are marked as optional (?: ...).
|
|
19322
|
+
*
|
|
19323
|
+
* These methods are called on the widget ref and allow the renderer to
|
|
19324
|
+
* communicate with the individual widgets to coordinate actions such as
|
|
19325
|
+
* scoring, state serialization/deserialization, and focus management.
|
|
19326
|
+
*/
|
|
19318
19327
|
class Renderer extends React__namespace.Component {
|
|
19319
19328
|
// @ts-expect-error - TS2564 - Property '_foundTextNodes' has no initializer and is not definitely assigned in the constructor.
|
|
19320
19329
|
|
|
@@ -24355,18 +24364,14 @@ class Categorizer extends React__namespace.Component {
|
|
|
24355
24364
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24356
24365
|
className: ClassNames.INTERACTIVE,
|
|
24357
24366
|
role: "button",
|
|
24358
|
-
"aria-label": catName
|
|
24359
|
-
|
|
24360
|
-
,
|
|
24361
|
-
onClick: this.onChange.bind(this, itemNum, catNum)
|
|
24367
|
+
"aria-label": catName,
|
|
24368
|
+
onClick: () => this.onChange(itemNum, catNum)
|
|
24362
24369
|
}, isMobile && /*#__PURE__*/React__namespace.createElement("input", {
|
|
24363
24370
|
type: "radio",
|
|
24364
24371
|
name: uniqueId,
|
|
24365
24372
|
className: aphrodite.css(sharedStyles.responsiveInput, sharedStyles.responsiveRadioInput),
|
|
24366
|
-
checked: selected
|
|
24367
|
-
|
|
24368
|
-
,
|
|
24369
|
-
onChange: this.onChange.bind(this, itemNum, catNum),
|
|
24373
|
+
checked: selected,
|
|
24374
|
+
onChange: () => this.onChange(itemNum, catNum),
|
|
24370
24375
|
onClick: e => e.stopPropagation()
|
|
24371
24376
|
}), !isMobile && /*#__PURE__*/React__namespace.createElement("span", {
|
|
24372
24377
|
className: aphrodite.css(styles$r.radioSpan, selected && styles$r.checkedRadioSpan, this.props.static && selected && styles$r.staticCheckedRadioSpan)
|
|
@@ -24386,20 +24391,20 @@ class Categorizer extends React__namespace.Component {
|
|
|
24386
24391
|
className: extraClassNames + " " + aphrodite.css(...inlineStyles)
|
|
24387
24392
|
}, table);
|
|
24388
24393
|
}
|
|
24389
|
-
onChange
|
|
24394
|
+
onChange(itemNum, catNum) {
|
|
24390
24395
|
const values = [...this.props.values];
|
|
24391
24396
|
// @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'never'.
|
|
24392
24397
|
values[itemNum] = catNum;
|
|
24393
24398
|
this.change("values", values);
|
|
24394
24399
|
this.props.trackInteraction();
|
|
24395
|
-
}
|
|
24400
|
+
}
|
|
24396
24401
|
simpleValidate = rubric => {
|
|
24397
24402
|
return Categorizer.validate(this.getUserInput(), rubric);
|
|
24398
24403
|
};
|
|
24399
24404
|
static validate(userInput, rubric) {
|
|
24400
24405
|
let completed = true;
|
|
24401
24406
|
let allCorrect = true;
|
|
24402
|
-
|
|
24407
|
+
rubric.values.forEach((value, i) => {
|
|
24403
24408
|
if (userInput.values[i] == null) {
|
|
24404
24409
|
completed = false;
|
|
24405
24410
|
}
|
|
@@ -41692,7 +41697,7 @@ const init = function (options) {
|
|
|
41692
41697
|
|
|
41693
41698
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41694
41699
|
const libName = "@khanacademy/perseus";
|
|
41695
|
-
const libVersion = "19.6.
|
|
41700
|
+
const libVersion = "19.6.3";
|
|
41696
41701
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41697
41702
|
|
|
41698
41703
|
const apiVersion = {
|