@khanacademy/perseus-editor 6.5.1 → 6.7.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/locked-figure-settings.d.ts +1 -0
- package/dist/components/locked-figures-section.d.ts +1 -0
- package/dist/es/index.js +49 -16
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +46 -14
- package/dist/index.js.map +1 -1
- package/dist/widgets/categorizer-editor.d.ts +0 -2
- package/dist/widgets/graded-group-editor.d.ts +0 -2
- package/dist/widgets/graded-group-set-editor.d.ts +0 -2
- package/dist/widgets/group-editor.d.ts +0 -2
- package/dist/widgets/interactive-graph-editor.d.ts +352 -585
- package/dist/widgets/radio/editor.d.ts +0 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
|
67
67
|
|
|
68
68
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
69
69
|
const libName = "@khanacademy/perseus-editor";
|
|
70
|
-
const libVersion = "6.
|
|
70
|
+
const libVersion = "6.7.0";
|
|
71
71
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
72
72
|
|
|
73
73
|
function _extends() {
|
|
@@ -30737,7 +30737,9 @@ const LockedLineSettings = props => {
|
|
|
30737
30737
|
const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
30738
30738
|
const lineLabel = `${capitalizeKind} (${point1.coord[0]},
|
|
30739
30739
|
${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
|
|
30740
|
-
|
|
30740
|
+
|
|
30741
|
+
// Check if the line has length 0.
|
|
30742
|
+
const isInvalid = kmath.vector.equal(point1.coord, point2.coord);
|
|
30741
30743
|
function handleChangePoint(newPointProps, index) {
|
|
30742
30744
|
const newPoints = [...points];
|
|
30743
30745
|
newPoints[index] = {
|
|
@@ -31017,6 +31019,15 @@ function getDefaultFigureForType(type) {
|
|
|
31017
31019
|
showPoint1: false,
|
|
31018
31020
|
showPoint2: false
|
|
31019
31021
|
};
|
|
31022
|
+
case "circle":
|
|
31023
|
+
return {
|
|
31024
|
+
type: "circle",
|
|
31025
|
+
center: [0, 0],
|
|
31026
|
+
radius: 1,
|
|
31027
|
+
color: DEFAULT_COLOR,
|
|
31028
|
+
fillStyle: "none",
|
|
31029
|
+
strokeStyle: "solid"
|
|
31030
|
+
};
|
|
31020
31031
|
default:
|
|
31021
31032
|
throw new wonderStuffCore.UnreachableCaseError(type);
|
|
31022
31033
|
}
|
|
@@ -31073,18 +31084,27 @@ const LockedFiguresSection = props => {
|
|
|
31073
31084
|
const allCollapsed = expandedStates.every(value => !value);
|
|
31074
31085
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
31075
31086
|
const showExpandButton = !!figures?.length;
|
|
31076
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) =>
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
}
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31086
|
-
|
|
31087
|
-
|
|
31087
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => {
|
|
31088
|
+
if (figure.type === "circle") {
|
|
31089
|
+
// TODO(LEMS-1941): Implement circle locked figure settings.
|
|
31090
|
+
// Remove this block once circle locked figure settings are
|
|
31091
|
+
// implemented.
|
|
31092
|
+
return;
|
|
31093
|
+
}
|
|
31094
|
+
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
31095
|
+
showM2Features: props.showM2Features,
|
|
31096
|
+
expanded: expandedStates[index],
|
|
31097
|
+
onToggle: newValue => {
|
|
31098
|
+
const newExpanded = [...expandedStates];
|
|
31099
|
+
newExpanded[index] = newValue;
|
|
31100
|
+
setExpandedStates(newExpanded);
|
|
31101
|
+
},
|
|
31102
|
+
key: `${uniqueId}-locked-${figure}-${index}`
|
|
31103
|
+
}, figure, {
|
|
31104
|
+
onChangeProps: newProps => changeProps(index, newProps),
|
|
31105
|
+
onRemove: () => removeLockedFigure(index)
|
|
31106
|
+
}));
|
|
31107
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31088
31108
|
style: styles$c.buttonContainer
|
|
31089
31109
|
}, /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
|
|
31090
31110
|
id: `${uniqueId}-select`,
|
|
@@ -31449,6 +31469,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31449
31469
|
// Only show the "Add locked figure" dropdown if the graph
|
|
31450
31470
|
// is using Mafs.
|
|
31451
31471
|
this.props.graph && this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-m1"] && this.props.apiOptions?.flags?.mafs?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
|
|
31472
|
+
showM2Features: this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-m2"],
|
|
31452
31473
|
figures: this.props.lockedFigures,
|
|
31453
31474
|
onChange: this.props.onChange
|
|
31454
31475
|
}));
|
|
@@ -31486,6 +31507,17 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31486
31507
|
// @ts-expect-error TS2739 Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | ... 5 more ... | "range">' is missing the following properties from type 'PerseusInteractiveGraphWidgetOptions': graph, correct
|
|
31487
31508
|
return json;
|
|
31488
31509
|
}
|
|
31510
|
+
getSaveWarnings = () => {
|
|
31511
|
+
const issues = [];
|
|
31512
|
+
|
|
31513
|
+
// A locked line on the graph cannot have length 0.
|
|
31514
|
+
for (const figure of this.props.lockedFigures ?? []) {
|
|
31515
|
+
if (figure.type === "line" && kmath.vector.equal(figure.points[0].coord, figure.points[1].coord)) {
|
|
31516
|
+
issues.push("The line cannot have length 0.");
|
|
31517
|
+
}
|
|
31518
|
+
}
|
|
31519
|
+
return issues;
|
|
31520
|
+
};
|
|
31489
31521
|
}
|
|
31490
31522
|
const styles$a = aphrodite.StyleSheet.create({
|
|
31491
31523
|
singleSelectShort: {
|