@khanacademy/perseus-editor 8.1.0 → 8.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/components/heading.d.ts +2 -1
- package/dist/components/interactive-graph-correct-answer.d.ts +7 -0
- package/dist/es/index.js +68 -39
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +68 -39
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +86 -456
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
|
|
|
83
83
|
|
|
84
84
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
85
85
|
const libName = "@khanacademy/perseus-editor";
|
|
86
|
-
const libVersion = "8.
|
|
86
|
+
const libVersion = "8.2.0";
|
|
87
87
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
88
88
|
|
|
89
89
|
function _extends() {
|
|
@@ -29679,6 +29679,39 @@ const strutStyle = size => {
|
|
|
29679
29679
|
};
|
|
29680
29680
|
};
|
|
29681
29681
|
|
|
29682
|
+
function Heading(_ref) {
|
|
29683
|
+
let {
|
|
29684
|
+
title,
|
|
29685
|
+
isOpen,
|
|
29686
|
+
isCollapsible,
|
|
29687
|
+
onToggle
|
|
29688
|
+
} = _ref;
|
|
29689
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29690
|
+
style: {
|
|
29691
|
+
flexDirection: "row",
|
|
29692
|
+
justifyContent: "space-between",
|
|
29693
|
+
backgroundColor: wonderBlocksTokens.color.offBlack8,
|
|
29694
|
+
padding: wonderBlocksTokens.spacing.xSmall_8,
|
|
29695
|
+
marginTop: wonderBlocksTokens.spacing.small_12,
|
|
29696
|
+
// NOTE(jeremy): This is the inverse of the @editorPadding CSS
|
|
29697
|
+
// variable found in perseus-editor.less. For now, it must
|
|
29698
|
+
// match otherwise there's a gap from this header to the edge
|
|
29699
|
+
// of the editor borders.
|
|
29700
|
+
marginInline: -10,
|
|
29701
|
+
cursor: isCollapsible ? "pointer" : "default",
|
|
29702
|
+
userSelect: "none"
|
|
29703
|
+
},
|
|
29704
|
+
onClick: () => isCollapsible && onToggle?.(!isOpen)
|
|
29705
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
|
|
29706
|
+
style: {
|
|
29707
|
+
fontSize: 14,
|
|
29708
|
+
fontWeight: 600
|
|
29709
|
+
}
|
|
29710
|
+
}, title), isCollapsible && /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
|
|
29711
|
+
isExpanded: isOpen
|
|
29712
|
+
}));
|
|
29713
|
+
}
|
|
29714
|
+
|
|
29682
29715
|
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
29683
29716
|
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
29684
29717
|
//
|
|
@@ -30976,6 +31009,7 @@ const LockedFiguresSection = props => {
|
|
|
30976
31009
|
// expand/collapse all button. Set the whole array to false initially.
|
|
30977
31010
|
const collapsedStateArray = Array((props.figures ?? []).length).fill(false);
|
|
30978
31011
|
const [expandedStates, setExpandedStates] = React__namespace.useState(collapsedStateArray);
|
|
31012
|
+
const [isExpanded, setIsExpanded] = React__namespace.useState(true);
|
|
30979
31013
|
const uniqueId = wonderBlocksCore.useUniqueIdWithMock().get("locked-figures-section");
|
|
30980
31014
|
const {
|
|
30981
31015
|
figures,
|
|
@@ -31065,7 +31099,12 @@ const LockedFiguresSection = props => {
|
|
|
31065
31099
|
const allCollapsed = expandedStates.every(value => !value);
|
|
31066
31100
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
31067
31101
|
const showExpandButton = !!figures?.length;
|
|
31068
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
31102
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31103
|
+
title: "Locked Figures",
|
|
31104
|
+
isOpen: isExpanded,
|
|
31105
|
+
onToggle: () => setIsExpanded(!isExpanded),
|
|
31106
|
+
isCollapsible: true
|
|
31107
|
+
}), isExpanded && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => {
|
|
31069
31108
|
if (figure.type === "function") {
|
|
31070
31109
|
// TODO(LEMS-1947): Add locked function settings.
|
|
31071
31110
|
// Remove this block once function locked figure settings are
|
|
@@ -31100,7 +31139,7 @@ const LockedFiguresSection = props => {
|
|
|
31100
31139
|
kind: "secondary",
|
|
31101
31140
|
onClick: () => toggleExpanded(allCollapsed),
|
|
31102
31141
|
style: styles$g.button
|
|
31103
|
-
}, buttonLabel)));
|
|
31142
|
+
}, buttonLabel))));
|
|
31104
31143
|
};
|
|
31105
31144
|
const styles$g = aphrodite.StyleSheet.create({
|
|
31106
31145
|
buttonContainer: {
|
|
@@ -31203,30 +31242,27 @@ const styles$e = aphrodite.StyleSheet.create({
|
|
|
31203
31242
|
}
|
|
31204
31243
|
});
|
|
31205
31244
|
|
|
31206
|
-
function
|
|
31207
|
-
|
|
31208
|
-
title,
|
|
31209
|
-
isOpen,
|
|
31210
|
-
|
|
31211
|
-
}
|
|
31212
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31245
|
+
function InteractiveGraphCorrectAnswer(props) {
|
|
31246
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31247
|
+
title: "Correct Answer",
|
|
31248
|
+
isOpen: true,
|
|
31249
|
+
isCollapsible: false
|
|
31250
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelXSmall, {
|
|
31213
31251
|
style: {
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
|
|
31227
|
-
},
|
|
31228
|
-
isExpanded: isOpen
|
|
31229
|
-
}));
|
|
31252
|
+
paddingTop: wonderBlocksTokens.spacing.xxSmall_6,
|
|
31253
|
+
paddingBottom: wonderBlocksTokens.spacing.xxSmall_6,
|
|
31254
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
31255
|
+
}
|
|
31256
|
+
}, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.BodyMonospace, {
|
|
31257
|
+
style: {
|
|
31258
|
+
fontSize: 12,
|
|
31259
|
+
backgroundColor: "#eee",
|
|
31260
|
+
paddingInline: wonderBlocksTokens.spacing.xxSmall_6,
|
|
31261
|
+
borderColor: "#ccc",
|
|
31262
|
+
borderStyle: "solid",
|
|
31263
|
+
borderWidth: 1
|
|
31264
|
+
}
|
|
31265
|
+
}, props.equationString)), props.children));
|
|
31230
31266
|
}
|
|
31231
31267
|
|
|
31232
31268
|
/* eslint-disable react/forbid-prop-types, react/no-unsafe */
|
|
@@ -31548,6 +31584,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
31548
31584
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31549
31585
|
title: "Common Graph Settings",
|
|
31550
31586
|
isOpen: this.state.isExpanded,
|
|
31587
|
+
isCollapsible: true,
|
|
31551
31588
|
onToggle: () => this.setState({
|
|
31552
31589
|
isExpanded: !this.state.isExpanded
|
|
31553
31590
|
})
|
|
@@ -31846,6 +31883,7 @@ const StartCoordSettings = props => {
|
|
|
31846
31883
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31847
31884
|
style: styles$b.container
|
|
31848
31885
|
}, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31886
|
+
isCollapsible: true,
|
|
31849
31887
|
title: "Start coordinates",
|
|
31850
31888
|
isOpen: isOpen,
|
|
31851
31889
|
onToggle: () => setIsOpen(!isOpen)
|
|
@@ -32009,7 +32047,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32009
32047
|
}
|
|
32010
32048
|
});
|
|
32011
32049
|
}
|
|
32012
|
-
})),
|
|
32050
|
+
})), /*#__PURE__*/React__namespace.createElement(InteractiveGraphCorrectAnswer, {
|
|
32051
|
+
equationString: equationString
|
|
32052
|
+
}, graph), this.props.correct?.type === "point" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
32013
32053
|
label: "Number of Points:"
|
|
32014
32054
|
}, /*#__PURE__*/React__namespace.createElement(GraphPointsCountSelector, {
|
|
32015
32055
|
numPoints: this.props.correct?.numPoints,
|
|
@@ -32193,18 +32233,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32193
32233
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
32194
32234
|
value: "congruent",
|
|
32195
32235
|
label: "be congruent"
|
|
32196
|
-
})), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Congruency requires only that the angle measures are the same. An exact match implies congruency, but also requires that the angles have the same orientation and that the vertices are in the same position."))),
|
|
32197
|
-
label: "Correct answer:"
|
|
32198
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.BodyMonospace, {
|
|
32199
|
-
style: {
|
|
32200
|
-
fontSize: 12,
|
|
32201
|
-
backgroundColor: "#eee",
|
|
32202
|
-
paddingInline: wonderBlocksTokens.spacing.xxSmall_6,
|
|
32203
|
-
borderColor: "#ccc",
|
|
32204
|
-
borderStyle: "solid",
|
|
32205
|
-
borderWidth: 1
|
|
32206
|
-
}
|
|
32207
|
-
}, equationString), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
|
|
32236
|
+
})), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Congruency requires only that the angle measures are the same. An exact match implies congruency, but also requires that the angles have the same orientation and that the vertices are in the same position."))),
|
|
32208
32237
|
// Only show the "Add locked figure" dropdown if the graph
|
|
32209
32238
|
// is using Mafs.
|
|
32210
32239
|
this.props.graph && this.props.apiOptions?.flags?.mafs?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
|