@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/es/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/es/index.js
CHANGED
|
@@ -766,7 +766,7 @@ const denylist = [
|
|
|
766
766
|
// (technically the renderer still adds them)
|
|
767
767
|
"key", "ref",
|
|
768
768
|
// added by src/renderer.jsx
|
|
769
|
-
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets",
|
|
769
|
+
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets",
|
|
770
770
|
// added by src/editor.jsx, for widgets removing themselves
|
|
771
771
|
// this is soooo not the right place for this, but alas.
|
|
772
772
|
"onRemove",
|
|
@@ -18972,7 +18972,7 @@ const {
|
|
|
18972
18972
|
// Note: these size cutoffs represent content-width cutoffs as specified in
|
|
18973
18973
|
// http://zpl.io/1mVmvU (broken link - we no longer use Zeplin)
|
|
18974
18974
|
// TODO(benkomalo): these values aren't used in JS outside of this file, but
|
|
18975
|
-
// are coupled to the values in styles/
|
|
18975
|
+
// are coupled to the values in styles/styles.less - DRY it up at some point
|
|
18976
18976
|
const smMax = articleMaxWidthTableInPx;
|
|
18977
18977
|
const mdMax = articleMaxWidthInPx;
|
|
18978
18978
|
const containerSizeClass = {
|
|
@@ -19763,9 +19763,7 @@ class Renderer extends React.Component {
|
|
|
19763
19763
|
return _extends({}, widgetProps, {
|
|
19764
19764
|
widgetId: id,
|
|
19765
19765
|
alignment: widgetInfo && widgetInfo.alignment,
|
|
19766
|
-
|
|
19767
|
-
// exercise question by verifying that it has no problem number.
|
|
19768
|
-
static: widgetInfo && widgetInfo.static && !this.props.problemNum,
|
|
19766
|
+
static: widgetInfo == null ? void 0 : widgetInfo.static,
|
|
19769
19767
|
problemNum: this.props.problemNum,
|
|
19770
19768
|
apiOptions: this.getApiOptions(),
|
|
19771
19769
|
keypadElement: this.props.keypadElement,
|
|
@@ -19775,7 +19773,6 @@ class Renderer extends React.Component {
|
|
|
19775
19773
|
onBlur: _.partial(this._onWidgetBlur, id),
|
|
19776
19774
|
findWidgets: this.findWidgets,
|
|
19777
19775
|
reviewModeRubric: reviewModeRubric,
|
|
19778
|
-
hintMode: this.props.hintMode,
|
|
19779
19776
|
onChange: (newProps, cb, silent = false) => {
|
|
19780
19777
|
this._setWidgetProps(id, newProps, cb, silent);
|
|
19781
19778
|
},
|
|
@@ -20150,7 +20147,7 @@ class Renderer extends React.Component {
|
|
|
20150
20147
|
}
|
|
20151
20148
|
// Widgets can contain text nodes, so we don't center them with
|
|
20152
20149
|
// markdown magic here.
|
|
20153
|
-
// Instead, we center them with css magic in
|
|
20150
|
+
// Instead, we center them with css magic in styles.less
|
|
20154
20151
|
// /cry(aria)
|
|
20155
20152
|
this._foundTextNodes = true;
|
|
20156
20153
|
if (_.contains(this.widgetIds, node.id)) {
|
|
@@ -20978,7 +20975,6 @@ Renderer.defaultProps = {
|
|
|
20978
20975
|
findExternalWidgets: () => [],
|
|
20979
20976
|
alwaysUpdate: false,
|
|
20980
20977
|
reviewMode: false,
|
|
20981
|
-
hintMode: false,
|
|
20982
20978
|
serializedState: null,
|
|
20983
20979
|
onSerializedStateUpdated: () => {},
|
|
20984
20980
|
linterContext: PerseusLinter.linterContextDefault
|
|
@@ -22596,7 +22592,7 @@ var sharedStyles = StyleSheet.create({
|
|
|
22596
22592
|
},
|
|
22597
22593
|
responsiveLabel: {
|
|
22598
22594
|
// NOTE(charlie): The values used here should be kept in sync with the
|
|
22599
|
-
// caption text sizing in Perseus'
|
|
22595
|
+
// caption text sizing in Perseus' styles.less.
|
|
22600
22596
|
// TODO(charlie): Migrate the captions over to using this style.
|
|
22601
22597
|
[mediaQueries.smOrSmaller]: {
|
|
22602
22598
|
fontSize: 14,
|
|
@@ -26915,7 +26911,7 @@ const propTransform$2 = editorProps => {
|
|
|
26915
26911
|
|
|
26916
26912
|
// Note that in addition to the standard staticTransform, in static
|
|
26917
26913
|
// mode we set static=true for the graph's handles in FunctionGrapher.
|
|
26918
|
-
const staticTransform$
|
|
26914
|
+
const staticTransform$4 = editorProps => {
|
|
26919
26915
|
return _extends({}, propTransform$2(editorProps), {
|
|
26920
26916
|
// Don't display graph type choices if we're in static mode
|
|
26921
26917
|
availableTypes: [editorProps.correct.type],
|
|
@@ -26928,7 +26924,7 @@ var Grapher$1 = {
|
|
|
26928
26924
|
displayName: "Grapher",
|
|
26929
26925
|
widget: Grapher,
|
|
26930
26926
|
transform: propTransform$2,
|
|
26931
|
-
staticTransform: staticTransform$
|
|
26927
|
+
staticTransform: staticTransform$4
|
|
26932
26928
|
};
|
|
26933
26929
|
|
|
26934
26930
|
// exports has no 'transform'
|
|
@@ -31868,7 +31864,6 @@ const MafsGraph = props => {
|
|
|
31868
31864
|
state,
|
|
31869
31865
|
dispatch,
|
|
31870
31866
|
labels,
|
|
31871
|
-
hintMode,
|
|
31872
31867
|
readOnly
|
|
31873
31868
|
} = props;
|
|
31874
31869
|
const [width, height] = props.box;
|
|
@@ -31885,7 +31880,7 @@ const MafsGraph = props => {
|
|
|
31885
31880
|
width,
|
|
31886
31881
|
height,
|
|
31887
31882
|
labels,
|
|
31888
|
-
disableKeyboardInteraction:
|
|
31883
|
+
disableKeyboardInteraction: readOnly || !!props.static
|
|
31889
31884
|
}
|
|
31890
31885
|
}, /*#__PURE__*/React.createElement(View, {
|
|
31891
31886
|
className: "mafs-graph",
|
|
@@ -31897,7 +31892,7 @@ const MafsGraph = props => {
|
|
|
31897
31892
|
boxSizing: "content-box",
|
|
31898
31893
|
marginLeft: "20px",
|
|
31899
31894
|
marginBottom: "20px",
|
|
31900
|
-
pointerEvents:
|
|
31895
|
+
pointerEvents: props.static ? "none" : "auto"
|
|
31901
31896
|
}
|
|
31902
31897
|
}, /*#__PURE__*/React.createElement(LegacyGrid, {
|
|
31903
31898
|
box: props.box,
|
|
@@ -33013,6 +33008,17 @@ const StatefulMafsGraph = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33013
33008
|
dispatch(reinitialize(latestPropsRef.current));
|
|
33014
33009
|
}
|
|
33015
33010
|
}, [graph.type, numPoints, numSegments, numSides, snapTo, showAngles, showSides, latestPropsRef, graph.startCoords]);
|
|
33011
|
+
|
|
33012
|
+
// If the graph is static, it always displays the correct answer. This is
|
|
33013
|
+
// standard behavior for Perseus widgets (e.g. compare the Radio widget).
|
|
33014
|
+
if (props.static) {
|
|
33015
|
+
return /*#__PURE__*/React.createElement(MafsGraph, _extends({}, props, {
|
|
33016
|
+
state: initializeGraphState(_extends({}, props, {
|
|
33017
|
+
graph: props.correct
|
|
33018
|
+
})),
|
|
33019
|
+
dispatch: dispatch
|
|
33020
|
+
}));
|
|
33021
|
+
}
|
|
33016
33022
|
return /*#__PURE__*/React.createElement(MafsGraph, _extends({}, props, {
|
|
33017
33023
|
state: state,
|
|
33018
33024
|
dispatch: dispatch
|
|
@@ -34332,7 +34338,6 @@ class InteractiveGraph extends React.Component {
|
|
|
34332
34338
|
snapStep: snapStep,
|
|
34333
34339
|
box: box,
|
|
34334
34340
|
showTooltips: !!this.props.showTooltips,
|
|
34335
|
-
hintMode: this.props.hintMode,
|
|
34336
34341
|
readOnly: (_this$props$apiOption2 = this.props.apiOptions) == null ? void 0 : _this$props$apiOption2.readOnly
|
|
34337
34342
|
}));
|
|
34338
34343
|
}
|
|
@@ -34922,10 +34927,13 @@ function shouldUseMafs(mafsFlags, graph) {
|
|
|
34922
34927
|
return Boolean(mafsFlags[graph.type]);
|
|
34923
34928
|
}
|
|
34924
34929
|
}
|
|
34930
|
+
// We don't need to change any of the original props for static mode
|
|
34931
|
+
const staticTransform$3 = _.identity;
|
|
34925
34932
|
var InteractiveGraph$1 = {
|
|
34926
34933
|
name: "interactive-graph",
|
|
34927
34934
|
displayName: "Interactive graph",
|
|
34928
|
-
widget: InteractiveGraph
|
|
34935
|
+
widget: InteractiveGraph,
|
|
34936
|
+
staticTransform: staticTransform$3
|
|
34929
34937
|
};
|
|
34930
34938
|
|
|
34931
34939
|
const black = "#000000";
|
|
@@ -44252,7 +44260,7 @@ const init = function init(options) {
|
|
|
44252
44260
|
|
|
44253
44261
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44254
44262
|
const libName = "@khanacademy/perseus";
|
|
44255
|
-
const libVersion = "28.
|
|
44263
|
+
const libVersion = "28.2.0";
|
|
44256
44264
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44257
44265
|
|
|
44258
44266
|
const apiVersion = {
|
|
@@ -44494,7 +44502,6 @@ class HintRenderer extends React.Component {
|
|
|
44494
44502
|
// eslint-disable-next-line react/no-string-refs
|
|
44495
44503
|
, {
|
|
44496
44504
|
ref: "renderer",
|
|
44497
|
-
hintMode: true,
|
|
44498
44505
|
widgets: hint.widgets,
|
|
44499
44506
|
content: hint.content || "",
|
|
44500
44507
|
images: hint.images,
|