@khanacademy/perseus 28.1.0 → 28.2.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.css +4 -5
- package/dist/es/index.js +25 -18
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +4 -5
- package/dist/index.js +26 -18
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +1 -8
- package/dist/types.d.ts +0 -1
- package/dist/widgets/expression.d.ts +2 -4
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +2 -0
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +2 -1
- package/package.json +4 -3
package/dist/index.css
CHANGED
|
@@ -1500,7 +1500,6 @@ body.mobile ul.inequalities-one-line-radios > li {
|
|
|
1500
1500
|
.perseus-clearfix:after {
|
|
1501
1501
|
clear: both;
|
|
1502
1502
|
}
|
|
1503
|
-
/* Fall back colors? Eg educator, talks & interviews */
|
|
1504
1503
|
.framework-perseus code {
|
|
1505
1504
|
font-family: Courier, monospace;
|
|
1506
1505
|
}
|
|
@@ -2418,7 +2417,7 @@ img.zoom-img {
|
|
|
2418
2417
|
width: 40px;
|
|
2419
2418
|
}
|
|
2420
2419
|
.framework-perseus .number-input.invalid-input {
|
|
2421
|
-
background-color: #
|
|
2420
|
+
background-color: #ffbaba;
|
|
2422
2421
|
outline-color: red;
|
|
2423
2422
|
}
|
|
2424
2423
|
.framework-perseus .number-input.mini {
|
|
@@ -2604,7 +2603,7 @@ img.zoom-img {
|
|
|
2604
2603
|
z-index: 2;
|
|
2605
2604
|
}
|
|
2606
2605
|
body.mobile .categorizer-container td.category input[type="radio"]:checked + span:before {
|
|
2607
|
-
color: #
|
|
2606
|
+
color: #1c758a;
|
|
2608
2607
|
}
|
|
2609
2608
|
body.mobile .categorizer-container td.category input[type="radio"] + span:active:before {
|
|
2610
2609
|
color: #666;
|
|
@@ -2677,7 +2676,7 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
|
|
|
2677
2676
|
margin-left: 0;
|
|
2678
2677
|
}
|
|
2679
2678
|
.framework-perseus .perseus-graded-group.answer-incorrect {
|
|
2680
|
-
border-left: 3px solid #
|
|
2679
|
+
border-left: 3px solid #ff8787;
|
|
2681
2680
|
margin-left: 0;
|
|
2682
2681
|
}
|
|
2683
2682
|
.framework-perseus .perseus-graded-group .group-icon {
|
|
@@ -3490,7 +3489,7 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
|
|
|
3490
3489
|
background-color: #fcc;
|
|
3491
3490
|
}
|
|
3492
3491
|
.perseus-error {
|
|
3493
|
-
background: #
|
|
3492
|
+
background: #ffbaba;
|
|
3494
3493
|
border: 2px solid red;
|
|
3495
3494
|
border-radius: 5px;
|
|
3496
3495
|
padding: 20px;
|
package/dist/index.js
CHANGED
|
@@ -869,7 +869,7 @@ const denylist = [
|
|
|
869
869
|
// (technically the renderer still adds them)
|
|
870
870
|
"key", "ref",
|
|
871
871
|
// added by src/renderer.jsx
|
|
872
|
-
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets",
|
|
872
|
+
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets",
|
|
873
873
|
// added by src/editor.jsx, for widgets removing themselves
|
|
874
874
|
// this is soooo not the right place for this, but alas.
|
|
875
875
|
"onRemove",
|
|
@@ -19151,7 +19151,7 @@ const {
|
|
|
19151
19151
|
// Note: these size cutoffs represent content-width cutoffs as specified in
|
|
19152
19152
|
// http://zpl.io/1mVmvU (broken link - we no longer use Zeplin)
|
|
19153
19153
|
// TODO(benkomalo): these values aren't used in JS outside of this file, but
|
|
19154
|
-
// are coupled to the values in styles/
|
|
19154
|
+
// are coupled to the values in styles/styles.less - DRY it up at some point
|
|
19155
19155
|
const smMax = articleMaxWidthTableInPx;
|
|
19156
19156
|
const mdMax = articleMaxWidthInPx;
|
|
19157
19157
|
const containerSizeClass = {
|
|
@@ -19832,7 +19832,6 @@ class Renderer extends React__namespace.Component {
|
|
|
19832
19832
|
findExternalWidgets: () => [],
|
|
19833
19833
|
alwaysUpdate: false,
|
|
19834
19834
|
reviewMode: false,
|
|
19835
|
-
hintMode: false,
|
|
19836
19835
|
serializedState: null,
|
|
19837
19836
|
onSerializedStateUpdated: () => {},
|
|
19838
19837
|
linterContext: PerseusLinter__namespace.linterContextDefault
|
|
@@ -20111,9 +20110,7 @@ class Renderer extends React__namespace.Component {
|
|
|
20111
20110
|
...widgetProps,
|
|
20112
20111
|
widgetId: id,
|
|
20113
20112
|
alignment: widgetInfo && widgetInfo.alignment,
|
|
20114
|
-
|
|
20115
|
-
// exercise question by verifying that it has no problem number.
|
|
20116
|
-
static: widgetInfo && widgetInfo.static && !this.props.problemNum,
|
|
20113
|
+
static: widgetInfo?.static,
|
|
20117
20114
|
problemNum: this.props.problemNum,
|
|
20118
20115
|
apiOptions: this.getApiOptions(),
|
|
20119
20116
|
keypadElement: this.props.keypadElement,
|
|
@@ -20123,7 +20120,6 @@ class Renderer extends React__namespace.Component {
|
|
|
20123
20120
|
onBlur: ___default["default"].partial(this._onWidgetBlur, id),
|
|
20124
20121
|
findWidgets: this.findWidgets,
|
|
20125
20122
|
reviewModeRubric: reviewModeRubric,
|
|
20126
|
-
hintMode: this.props.hintMode,
|
|
20127
20123
|
onChange: function (newProps, cb) {
|
|
20128
20124
|
let silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
20129
20125
|
_this._setWidgetProps(id, newProps, cb, silent);
|
|
@@ -20511,7 +20507,7 @@ class Renderer extends React__namespace.Component {
|
|
|
20511
20507
|
}
|
|
20512
20508
|
// Widgets can contain text nodes, so we don't center them with
|
|
20513
20509
|
// markdown magic here.
|
|
20514
|
-
// Instead, we center them with css magic in
|
|
20510
|
+
// Instead, we center them with css magic in styles.less
|
|
20515
20511
|
// /cry(aria)
|
|
20516
20512
|
this._foundTextNodes = true;
|
|
20517
20513
|
if (___default["default"].contains(this.widgetIds, node.id)) {
|
|
@@ -22811,7 +22807,7 @@ var sharedStyles = aphrodite.StyleSheet.create({
|
|
|
22811
22807
|
},
|
|
22812
22808
|
responsiveLabel: {
|
|
22813
22809
|
// NOTE(charlie): The values used here should be kept in sync with the
|
|
22814
|
-
// caption text sizing in Perseus'
|
|
22810
|
+
// caption text sizing in Perseus' styles.less.
|
|
22815
22811
|
// TODO(charlie): Migrate the captions over to using this style.
|
|
22816
22812
|
[mediaQueries.smOrSmaller]: {
|
|
22817
22813
|
fontSize: 14,
|
|
@@ -27186,7 +27182,7 @@ const propTransform$2 = editorProps => {
|
|
|
27186
27182
|
|
|
27187
27183
|
// Note that in addition to the standard staticTransform, in static
|
|
27188
27184
|
// mode we set static=true for the graph's handles in FunctionGrapher.
|
|
27189
|
-
const staticTransform$
|
|
27185
|
+
const staticTransform$4 = editorProps => {
|
|
27190
27186
|
return {
|
|
27191
27187
|
...propTransform$2(editorProps),
|
|
27192
27188
|
// Don't display graph type choices if we're in static mode
|
|
@@ -27200,7 +27196,7 @@ var Grapher$1 = {
|
|
|
27200
27196
|
displayName: "Grapher",
|
|
27201
27197
|
widget: Grapher,
|
|
27202
27198
|
transform: propTransform$2,
|
|
27203
|
-
staticTransform: staticTransform$
|
|
27199
|
+
staticTransform: staticTransform$4
|
|
27204
27200
|
};
|
|
27205
27201
|
|
|
27206
27202
|
// exports has no 'transform'
|
|
@@ -32195,7 +32191,6 @@ const MafsGraph = props => {
|
|
|
32195
32191
|
state,
|
|
32196
32192
|
dispatch,
|
|
32197
32193
|
labels,
|
|
32198
|
-
hintMode,
|
|
32199
32194
|
readOnly
|
|
32200
32195
|
} = props;
|
|
32201
32196
|
const [width, height] = props.box;
|
|
@@ -32212,7 +32207,7 @@ const MafsGraph = props => {
|
|
|
32212
32207
|
width,
|
|
32213
32208
|
height,
|
|
32214
32209
|
labels,
|
|
32215
|
-
disableKeyboardInteraction:
|
|
32210
|
+
disableKeyboardInteraction: readOnly || !!props.static
|
|
32216
32211
|
}
|
|
32217
32212
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
32218
32213
|
className: "mafs-graph",
|
|
@@ -32224,7 +32219,7 @@ const MafsGraph = props => {
|
|
|
32224
32219
|
boxSizing: "content-box",
|
|
32225
32220
|
marginLeft: "20px",
|
|
32226
32221
|
marginBottom: "20px",
|
|
32227
|
-
pointerEvents:
|
|
32222
|
+
pointerEvents: props.static ? "none" : "auto"
|
|
32228
32223
|
}
|
|
32229
32224
|
}, /*#__PURE__*/React__namespace.createElement(LegacyGrid, {
|
|
32230
32225
|
box: props.box,
|
|
@@ -33377,6 +33372,18 @@ const StatefulMafsGraph = /*#__PURE__*/React__namespace.forwardRef((props, ref)
|
|
|
33377
33372
|
dispatch(reinitialize(latestPropsRef.current));
|
|
33378
33373
|
}
|
|
33379
33374
|
}, [graph.type, numPoints, numSegments, numSides, snapTo, showAngles, showSides, latestPropsRef, graph.startCoords]);
|
|
33375
|
+
|
|
33376
|
+
// If the graph is static, it always displays the correct answer. This is
|
|
33377
|
+
// standard behavior for Perseus widgets (e.g. compare the Radio widget).
|
|
33378
|
+
if (props.static) {
|
|
33379
|
+
return /*#__PURE__*/React__namespace.createElement(MafsGraph, _extends({}, props, {
|
|
33380
|
+
state: initializeGraphState({
|
|
33381
|
+
...props,
|
|
33382
|
+
graph: props.correct
|
|
33383
|
+
}),
|
|
33384
|
+
dispatch: dispatch
|
|
33385
|
+
}));
|
|
33386
|
+
}
|
|
33380
33387
|
return /*#__PURE__*/React__namespace.createElement(MafsGraph, _extends({}, props, {
|
|
33381
33388
|
state: state,
|
|
33382
33389
|
dispatch: dispatch
|
|
@@ -34680,7 +34687,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
34680
34687
|
snapStep: snapStep,
|
|
34681
34688
|
box: box,
|
|
34682
34689
|
showTooltips: !!this.props.showTooltips,
|
|
34683
|
-
hintMode: this.props.hintMode,
|
|
34684
34690
|
readOnly: this.props.apiOptions?.readOnly
|
|
34685
34691
|
}));
|
|
34686
34692
|
}
|
|
@@ -35256,10 +35262,13 @@ function shouldUseMafs(mafsFlags, graph) {
|
|
|
35256
35262
|
return Boolean(mafsFlags[graph.type]);
|
|
35257
35263
|
}
|
|
35258
35264
|
}
|
|
35265
|
+
// We don't need to change any of the original props for static mode
|
|
35266
|
+
const staticTransform$3 = ___default["default"].identity;
|
|
35259
35267
|
var InteractiveGraph$1 = {
|
|
35260
35268
|
name: "interactive-graph",
|
|
35261
35269
|
displayName: "Interactive graph",
|
|
35262
|
-
widget: InteractiveGraph
|
|
35270
|
+
widget: InteractiveGraph,
|
|
35271
|
+
staticTransform: staticTransform$3
|
|
35263
35272
|
};
|
|
35264
35273
|
|
|
35265
35274
|
const black = "#000000";
|
|
@@ -44603,7 +44612,7 @@ const init = function (options) {
|
|
|
44603
44612
|
|
|
44604
44613
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44605
44614
|
const libName = "@khanacademy/perseus";
|
|
44606
|
-
const libVersion = "28.
|
|
44615
|
+
const libVersion = "28.2.0";
|
|
44607
44616
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44608
44617
|
|
|
44609
44618
|
const apiVersion = {
|
|
@@ -44851,7 +44860,6 @@ class HintRenderer extends React__namespace.Component {
|
|
|
44851
44860
|
// eslint-disable-next-line react/no-string-refs
|
|
44852
44861
|
, {
|
|
44853
44862
|
ref: "renderer",
|
|
44854
|
-
hintMode: true,
|
|
44855
44863
|
widgets: hint.widgets,
|
|
44856
44864
|
content: hint.content || "",
|
|
44857
44865
|
images: hint.images,
|