@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare function Heading({ title, isOpen, onToggle, }: {
|
|
2
|
+
declare function Heading({ title, isOpen, isCollapsible, onToggle, }: {
|
|
3
3
|
title: string;
|
|
4
4
|
isOpen: boolean;
|
|
5
|
+
isCollapsible: boolean;
|
|
5
6
|
onToggle?: (isOpen: boolean) => void;
|
|
6
7
|
}): JSX.Element;
|
|
7
8
|
export default Heading;
|
package/dist/es/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { isTruthy, UnreachableCaseError } from '@khanacademy/wonder-stuff-core';
|
|
|
20
20
|
import { useMathInputI18n, createMathField } from '@khanacademy/math-input';
|
|
21
21
|
import { ActionMenu, ActionItem, SingleSelect, OptionItem } from '@khanacademy/wonder-blocks-dropdown';
|
|
22
22
|
import { TextField, Checkbox as Checkbox$1 } from '@khanacademy/wonder-blocks-form';
|
|
23
|
-
import { LabelSmall, LabelMedium,
|
|
23
|
+
import { LabelSmall, LabelLarge, LabelMedium, LabelXSmall, BodyMonospace } from '@khanacademy/wonder-blocks-typography';
|
|
24
24
|
import Button from '@khanacademy/wonder-blocks-button';
|
|
25
25
|
import { AccordionSection } from '@khanacademy/wonder-blocks-accordion';
|
|
26
26
|
import IconButton from '@khanacademy/wonder-blocks-icon-button';
|
|
@@ -37,7 +37,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
|
|
|
37
37
|
|
|
38
38
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
39
39
|
const libName = "@khanacademy/perseus-editor";
|
|
40
|
-
const libVersion = "8.
|
|
40
|
+
const libVersion = "8.2.0";
|
|
41
41
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
42
42
|
|
|
43
43
|
function _extends() {
|
|
@@ -29593,6 +29593,38 @@ const strutStyle = size => {
|
|
|
29593
29593
|
};
|
|
29594
29594
|
};
|
|
29595
29595
|
|
|
29596
|
+
function Heading({
|
|
29597
|
+
title,
|
|
29598
|
+
isOpen,
|
|
29599
|
+
isCollapsible,
|
|
29600
|
+
onToggle
|
|
29601
|
+
}) {
|
|
29602
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
29603
|
+
style: {
|
|
29604
|
+
flexDirection: "row",
|
|
29605
|
+
justifyContent: "space-between",
|
|
29606
|
+
backgroundColor: color.offBlack8,
|
|
29607
|
+
padding: spacing.xSmall_8,
|
|
29608
|
+
marginTop: spacing.small_12,
|
|
29609
|
+
// NOTE(jeremy): This is the inverse of the @editorPadding CSS
|
|
29610
|
+
// variable found in perseus-editor.less. For now, it must
|
|
29611
|
+
// match otherwise there's a gap from this header to the edge
|
|
29612
|
+
// of the editor borders.
|
|
29613
|
+
marginInline: -10,
|
|
29614
|
+
cursor: isCollapsible ? "pointer" : "default",
|
|
29615
|
+
userSelect: "none"
|
|
29616
|
+
},
|
|
29617
|
+
onClick: () => isCollapsible && (onToggle == null ? void 0 : onToggle(!isOpen))
|
|
29618
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, {
|
|
29619
|
+
style: {
|
|
29620
|
+
fontSize: 14,
|
|
29621
|
+
fontWeight: 600
|
|
29622
|
+
}
|
|
29623
|
+
}, title), isCollapsible && /*#__PURE__*/React.createElement(ToggleableCaret, {
|
|
29624
|
+
isExpanded: isOpen
|
|
29625
|
+
}));
|
|
29626
|
+
}
|
|
29627
|
+
|
|
29596
29628
|
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
29597
29629
|
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
29598
29630
|
//
|
|
@@ -30885,6 +30917,7 @@ const LockedFiguresSection = props => {
|
|
|
30885
30917
|
// expand/collapse all button. Set the whole array to false initially.
|
|
30886
30918
|
const collapsedStateArray = Array(((_props$figures = props.figures) != null ? _props$figures : []).length).fill(false);
|
|
30887
30919
|
const [expandedStates, setExpandedStates] = React.useState(collapsedStateArray);
|
|
30920
|
+
const [isExpanded, setIsExpanded] = React.useState(true);
|
|
30888
30921
|
const uniqueId = useUniqueIdWithMock().get("locked-figures-section");
|
|
30889
30922
|
const {
|
|
30890
30923
|
figures,
|
|
@@ -30971,7 +31004,12 @@ const LockedFiguresSection = props => {
|
|
|
30971
31004
|
const allCollapsed = expandedStates.every(value => !value);
|
|
30972
31005
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
30973
31006
|
const showExpandButton = !!(figures != null && figures.length);
|
|
30974
|
-
return /*#__PURE__*/React.createElement(
|
|
31007
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Heading, {
|
|
31008
|
+
title: "Locked Figures",
|
|
31009
|
+
isOpen: isExpanded,
|
|
31010
|
+
onToggle: () => setIsExpanded(!isExpanded),
|
|
31011
|
+
isCollapsible: true
|
|
31012
|
+
}), isExpanded && /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
|
|
30975
31013
|
if (figure.type === "function") {
|
|
30976
31014
|
// TODO(LEMS-1947): Add locked function settings.
|
|
30977
31015
|
// Remove this block once function locked figure settings are
|
|
@@ -31006,7 +31044,7 @@ const LockedFiguresSection = props => {
|
|
|
31006
31044
|
kind: "secondary",
|
|
31007
31045
|
onClick: () => toggleExpanded(allCollapsed),
|
|
31008
31046
|
style: styles$g.button
|
|
31009
|
-
}, buttonLabel)));
|
|
31047
|
+
}, buttonLabel))));
|
|
31010
31048
|
};
|
|
31011
31049
|
const styles$g = StyleSheet.create({
|
|
31012
31050
|
buttonContainer: {
|
|
@@ -31108,29 +31146,27 @@ const styles$e = StyleSheet.create({
|
|
|
31108
31146
|
}
|
|
31109
31147
|
});
|
|
31110
31148
|
|
|
31111
|
-
function
|
|
31112
|
-
|
|
31113
|
-
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
|
|
31149
|
+
function InteractiveGraphCorrectAnswer(props) {
|
|
31150
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Heading, {
|
|
31151
|
+
title: "Correct Answer",
|
|
31152
|
+
isOpen: true,
|
|
31153
|
+
isCollapsible: false
|
|
31154
|
+
}), /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(LabelXSmall, {
|
|
31117
31155
|
style: {
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
|
|
31127
|
-
|
|
31128
|
-
|
|
31129
|
-
|
|
31130
|
-
|
|
31131
|
-
},
|
|
31132
|
-
isExpanded: isOpen
|
|
31133
|
-
}));
|
|
31156
|
+
paddingTop: spacing.xxSmall_6,
|
|
31157
|
+
paddingBottom: spacing.xxSmall_6,
|
|
31158
|
+
color: color.offBlack64
|
|
31159
|
+
}
|
|
31160
|
+
}, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."), /*#__PURE__*/React.createElement(BodyMonospace, {
|
|
31161
|
+
style: {
|
|
31162
|
+
fontSize: 12,
|
|
31163
|
+
backgroundColor: "#eee",
|
|
31164
|
+
paddingInline: spacing.xxSmall_6,
|
|
31165
|
+
borderColor: "#ccc",
|
|
31166
|
+
borderStyle: "solid",
|
|
31167
|
+
borderWidth: 1
|
|
31168
|
+
}
|
|
31169
|
+
}, props.equationString)), props.children));
|
|
31134
31170
|
}
|
|
31135
31171
|
|
|
31136
31172
|
const {
|
|
@@ -31423,6 +31459,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
31423
31459
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Heading, {
|
|
31424
31460
|
title: "Common Graph Settings",
|
|
31425
31461
|
isOpen: this.state.isExpanded,
|
|
31462
|
+
isCollapsible: true,
|
|
31426
31463
|
onToggle: () => this.setState({
|
|
31427
31464
|
isExpanded: !this.state.isExpanded
|
|
31428
31465
|
})
|
|
@@ -31733,6 +31770,7 @@ const StartCoordSettings = props => {
|
|
|
31733
31770
|
return /*#__PURE__*/React.createElement(View, {
|
|
31734
31771
|
style: styles$b.container
|
|
31735
31772
|
}, /*#__PURE__*/React.createElement(Heading, {
|
|
31773
|
+
isCollapsible: true,
|
|
31736
31774
|
title: "Start coordinates",
|
|
31737
31775
|
isOpen: isOpen,
|
|
31738
31776
|
onToggle: () => setIsOpen(!isOpen)
|
|
@@ -31915,7 +31953,9 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
31915
31953
|
}
|
|
31916
31954
|
});
|
|
31917
31955
|
}
|
|
31918
|
-
})),
|
|
31956
|
+
})), /*#__PURE__*/React.createElement(InteractiveGraphCorrectAnswer, {
|
|
31957
|
+
equationString: equationString
|
|
31958
|
+
}, graph), ((_this$props$correct = this.props.correct) == null ? void 0 : _this$props$correct.type) === "point" && /*#__PURE__*/React.createElement(LabeledRow, {
|
|
31919
31959
|
label: "Number of Points:"
|
|
31920
31960
|
}, /*#__PURE__*/React.createElement(GraphPointsCountSelector, {
|
|
31921
31961
|
numPoints: (_this$props$correct2 = this.props.correct) == null ? void 0 : _this$props$correct2.numPoints,
|
|
@@ -32095,18 +32135,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32095
32135
|
}), /*#__PURE__*/React.createElement(OptionItem, {
|
|
32096
32136
|
value: "congruent",
|
|
32097
32137
|
label: "be congruent"
|
|
32098
|
-
})), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.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."))),
|
|
32099
|
-
label: "Correct answer:"
|
|
32100
|
-
}, /*#__PURE__*/React.createElement(BodyMonospace, {
|
|
32101
|
-
style: {
|
|
32102
|
-
fontSize: 12,
|
|
32103
|
-
backgroundColor: "#eee",
|
|
32104
|
-
paddingInline: spacing.xxSmall_6,
|
|
32105
|
-
borderColor: "#ccc",
|
|
32106
|
-
borderStyle: "solid",
|
|
32107
|
-
borderWidth: 1
|
|
32108
|
-
}
|
|
32109
|
-
}, equationString), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
|
|
32138
|
+
})), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.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."))),
|
|
32110
32139
|
// Only show the "Add locked figure" dropdown if the graph
|
|
32111
32140
|
// is using Mafs.
|
|
32112
32141
|
this.props.graph && ((_this$props$apiOption2 = this.props.apiOptions) == null || (_this$props$apiOption2 = _this$props$apiOption2.flags) == null || (_this$props$apiOption2 = _this$props$apiOption2.mafs) == null ? void 0 : _this$props$apiOption2[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
|