@khanacademy/perseus-editor 8.1.0 → 9.0.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/angle-input.d.ts +2 -2
- package/dist/components/coordinate-pair-input.d.ts +2 -2
- package/dist/components/graph-locked-figures/color-select.d.ts +2 -2
- package/dist/components/graph-locked-figures/color-swatch.d.ts +2 -2
- package/dist/components/graph-locked-figures/defining-point-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/ellipse-swatch.d.ts +2 -2
- package/dist/components/graph-locked-figures/labeled-row.d.ts +1 -1
- package/dist/components/graph-locked-figures/labeled-switch.d.ts +2 -2
- package/dist/components/graph-locked-figures/line-swatch.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-ellipse-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-figure-select.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-figure-settings-actions.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-figure-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-figures-section.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-line-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-point-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-polygon-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/locked-vector-settings.d.ts +2 -2
- package/dist/components/graph-locked-figures/polygon-swatch.d.ts +2 -2
- package/dist/components/graph-points-count-selector.d.ts +2 -2
- package/dist/components/graph-type-selector.d.ts +2 -2
- package/dist/components/heading.d.ts +4 -3
- package/dist/components/interactive-graph-correct-answer.d.ts +7 -0
- package/dist/components/interactive-graph-settings.d.ts +1 -1
- package/dist/components/perseus-editor-accordion.d.ts +1 -1
- package/dist/components/segment-count-selector.d.ts +2 -2
- package/dist/components/start-coord-settings.d.ts +2 -2
- package/dist/components/toggleable-caret.d.ts +2 -2
- package/dist/components/viewport-resizer.d.ts +2 -2
- package/dist/components/widget-editor.d.ts +1 -1
- package/dist/es/index.js +77 -48
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +77 -48
- package/dist/index.js.map +1 -1
- package/dist/widgets/image-editor.d.ts +2 -2
- package/dist/widgets/interaction-editor/mathquill-input.d.ts +2 -2
- package/dist/widgets/interactive-graph-editor.d.ts +153 -531
- package/dist/widgets/numeric-input-editor.d.ts +1 -1
- package/package.json +7 -7
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 = "
|
|
86
|
+
const libVersion = "9.0.0";
|
|
87
87
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
88
88
|
|
|
89
89
|
function _extends() {
|
|
@@ -29245,7 +29245,7 @@ class InteractionEditor extends React__namespace.Component {
|
|
|
29245
29245
|
gridStep: this.props.graph.gridStep,
|
|
29246
29246
|
markings: this.props.graph.markings,
|
|
29247
29247
|
onChange: this._updateGraphProps
|
|
29248
|
-
}), this.props.graph.valid !== true && /*#__PURE__*/React__namespace.createElement("div", null, this.props.graph.valid)), ___default["default"].map(this.props.elements, function (element, n) {
|
|
29248
|
+
}), /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, this.props.graph.valid !== true && /*#__PURE__*/React__namespace.createElement("div", null, this.props.graph.valid))), ___default["default"].map(this.props.elements, function (element, n) {
|
|
29249
29249
|
if (element.type === "movable-point") {
|
|
29250
29250
|
return /*#__PURE__*/React__namespace.createElement(perseus.ElementContainer, {
|
|
29251
29251
|
title: /*#__PURE__*/React__namespace.createElement("span", null, "Movable point", " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_{" + element.options.varSubscript + "}, y_{" + element.options.varSubscript + "})"))
|
|
@@ -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
|
//
|
|
@@ -29808,7 +29841,7 @@ const LockedFigureSelect = props => {
|
|
|
29808
29841
|
key: `${id}-${figureType}`,
|
|
29809
29842
|
label: figureType,
|
|
29810
29843
|
onClick: () => onChange(figureType)
|
|
29811
|
-
}
|
|
29844
|
+
}))));
|
|
29812
29845
|
};
|
|
29813
29846
|
const styles$x = aphrodite.StyleSheet.create({
|
|
29814
29847
|
container: {
|
|
@@ -30043,7 +30076,7 @@ const ColorSelect = props => {
|
|
|
30043
30076
|
color: colorName,
|
|
30044
30077
|
decorative: true
|
|
30045
30078
|
})
|
|
30046
|
-
}
|
|
30079
|
+
})))));
|
|
30047
30080
|
};
|
|
30048
30081
|
const styles$s = aphrodite.StyleSheet.create({
|
|
30049
30082
|
row: {
|
|
@@ -30238,7 +30271,7 @@ const LockedEllipseSettings = props => {
|
|
|
30238
30271
|
key: option,
|
|
30239
30272
|
value: option,
|
|
30240
30273
|
label: option
|
|
30241
|
-
}
|
|
30274
|
+
}))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30242
30275
|
tag: "label",
|
|
30243
30276
|
style: styles$p.row
|
|
30244
30277
|
}, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
@@ -30254,10 +30287,10 @@ const LockedEllipseSettings = props => {
|
|
|
30254
30287
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30255
30288
|
value: "solid",
|
|
30256
30289
|
label: "solid"
|
|
30257
|
-
}
|
|
30290
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30258
30291
|
value: "dashed",
|
|
30259
30292
|
label: "dashed"
|
|
30260
|
-
}
|
|
30293
|
+
}))), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
|
|
30261
30294
|
showM2Features: props.showM2Features,
|
|
30262
30295
|
figureType: props.type,
|
|
30263
30296
|
onMove: onMove,
|
|
@@ -30730,7 +30763,7 @@ const LockedPolygonSettings = props => {
|
|
|
30730
30763
|
key: option,
|
|
30731
30764
|
value: option,
|
|
30732
30765
|
label: option
|
|
30733
|
-
}
|
|
30766
|
+
}))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30734
30767
|
tag: "label",
|
|
30735
30768
|
style: [styles$i.row, styles$i.spaceUnder]
|
|
30736
30769
|
}, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
@@ -30746,10 +30779,10 @@ const LockedPolygonSettings = props => {
|
|
|
30746
30779
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30747
30780
|
value: "solid",
|
|
30748
30781
|
label: "solid"
|
|
30749
|
-
}
|
|
30782
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30750
30783
|
value: "dashed",
|
|
30751
30784
|
label: "dashed"
|
|
30752
|
-
}
|
|
30785
|
+
}))), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30753
30786
|
label: "show vertices",
|
|
30754
30787
|
checked: showVertices,
|
|
30755
30788
|
onChange: newValue => onChangeProps({
|
|
@@ -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, {
|