@khanacademy/perseus-editor 14.8.1 → 14.9.1
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/checkbox.d.ts +2 -1
- package/dist/components/dropdown-option.d.ts +0 -4
- package/dist/editor-page.d.ts +0 -2
- package/dist/es/index.js +35 -27
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +37 -27
- package/dist/index.js.map +1 -1
- package/dist/widgets/input-number-editor.d.ts +7 -8
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +488 -183
- package/dist/widgets/interactive-graph-editor/locked-figures/line-stroke-select.d.ts +1 -1
- package/dist/widgets/interactive-graph-editor/locked-figures/util.d.ts +2 -1
- package/dist/widgets/label-image/behavior.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -98,7 +98,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
|
|
|
98
98
|
|
|
99
99
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
100
100
|
const libName = "@khanacademy/perseus-editor";
|
|
101
|
-
const libVersion = "14.
|
|
101
|
+
const libVersion = "14.9.1";
|
|
102
102
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
103
103
|
|
|
104
104
|
function _extends() {
|
|
@@ -24297,13 +24297,6 @@ class EditorPage extends React__namespace.Component {
|
|
|
24297
24297
|
});
|
|
24298
24298
|
this.props.onChange(newJson);
|
|
24299
24299
|
};
|
|
24300
|
-
scorePreview() {
|
|
24301
|
-
// Do we actually ever set this.renderer anywhere in the codebase?
|
|
24302
|
-
if (this.renderer) {
|
|
24303
|
-
return this.renderer.scoreInput();
|
|
24304
|
-
}
|
|
24305
|
-
return null;
|
|
24306
|
-
}
|
|
24307
24300
|
render() {
|
|
24308
24301
|
let className = "framework-perseus";
|
|
24309
24302
|
const touch = this.props.previewDevice === "phone" || this.props.previewDevice === "tablet";
|
|
@@ -25617,10 +25610,6 @@ const StatefulEditorPage = createReactClass__default["default"]({
|
|
|
25617
25610
|
this.setState(newState, cb);
|
|
25618
25611
|
}
|
|
25619
25612
|
},
|
|
25620
|
-
scorePreview: function () {
|
|
25621
|
-
// eslint-disable-next-line react/no-string-refs
|
|
25622
|
-
return this.refs.editor.scorePreview();
|
|
25623
|
-
},
|
|
25624
25613
|
render: function () {
|
|
25625
25614
|
const Component = this.props.componentClass;
|
|
25626
25615
|
return /*#__PURE__*/React__namespace.createElement(Component, this.state);
|
|
@@ -31079,6 +31068,24 @@ function getDefaultFigureForType(type) {
|
|
|
31079
31068
|
throw new wonderStuffCore.UnreachableCaseError(type);
|
|
31080
31069
|
}
|
|
31081
31070
|
}
|
|
31071
|
+
function generateLockedFigureAppearanceDescription(color) {
|
|
31072
|
+
let strokeStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "solid";
|
|
31073
|
+
let fill = arguments.length > 2 ? arguments[2] : undefined;
|
|
31074
|
+
const convertedColor = color === "grayH" ? "gray" : color;
|
|
31075
|
+
switch (fill) {
|
|
31076
|
+
case "none":
|
|
31077
|
+
return `. Appearance ${strokeStyle} ${convertedColor} border, with no fill.`;
|
|
31078
|
+
case "white":
|
|
31079
|
+
return `. Appearance ${strokeStyle} ${convertedColor} border, with a white fill.`;
|
|
31080
|
+
case "solid":
|
|
31081
|
+
case "translucent":
|
|
31082
|
+
return `. Appearance ${strokeStyle} ${convertedColor} border, with a ${fill} ${convertedColor} fill.`;
|
|
31083
|
+
case undefined:
|
|
31084
|
+
return `. Appearance ${strokeStyle} ${convertedColor}.`;
|
|
31085
|
+
default:
|
|
31086
|
+
throw new wonderStuffCore.UnreachableCaseError(fill);
|
|
31087
|
+
}
|
|
31088
|
+
}
|
|
31082
31089
|
|
|
31083
31090
|
const {
|
|
31084
31091
|
InfoTip: InfoTip$c
|
|
@@ -31103,7 +31110,7 @@ const LockedEllipseSettings = props => {
|
|
|
31103
31110
|
function getPrepopulatedAriaLabel() {
|
|
31104
31111
|
let visiblelabel = "";
|
|
31105
31112
|
if (labels && labels.length > 0) {
|
|
31106
|
-
visiblelabel += ` ${labels.map(l => l.text).join(" ")}`;
|
|
31113
|
+
visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
|
|
31107
31114
|
}
|
|
31108
31115
|
const isCircle = radius[0] === radius[1];
|
|
31109
31116
|
let str = "";
|
|
@@ -31116,6 +31123,8 @@ const LockedEllipseSettings = props => {
|
|
|
31116
31123
|
if (!isCircle && angle !== 0) {
|
|
31117
31124
|
str += `, rotated by ${radianToDegree(angle)} degrees`;
|
|
31118
31125
|
}
|
|
31126
|
+
const ellipseAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
|
|
31127
|
+
str += ellipseAppearance;
|
|
31119
31128
|
return str;
|
|
31120
31129
|
}
|
|
31121
31130
|
function handleCenterChange(newCoord) {
|
|
@@ -31376,6 +31385,8 @@ const LockedFunctionSettings = props => {
|
|
|
31376
31385
|
if (domain && !(domain[0] === -Infinity && domain[1] === Infinity)) {
|
|
31377
31386
|
str += `, domain from ${domain[0]} to ${domain[1]}`;
|
|
31378
31387
|
}
|
|
31388
|
+
const functionAppearance = generateLockedFigureAppearanceDescription(lineColor, strokeStyle);
|
|
31389
|
+
str += functionAppearance;
|
|
31379
31390
|
return str;
|
|
31380
31391
|
}
|
|
31381
31392
|
|
|
@@ -31805,7 +31816,9 @@ const LockedPointSettings = props => {
|
|
|
31805
31816
|
if (labels && labels.length > 0) {
|
|
31806
31817
|
visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
|
|
31807
31818
|
}
|
|
31808
|
-
|
|
31819
|
+
let str = `Point${visiblelabel} at (${coord[0]}, ${coord[1]})`;
|
|
31820
|
+
const pointAppearance = generateLockedFigureAppearanceDescription(pointColor);
|
|
31821
|
+
str += pointAppearance;
|
|
31809
31822
|
return str;
|
|
31810
31823
|
}
|
|
31811
31824
|
function handleColorChange(newValue) {
|
|
@@ -32010,7 +32023,9 @@ const LockedLineSettings = props => {
|
|
|
32010
32023
|
if (labels && labels.length > 0) {
|
|
32011
32024
|
visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
|
|
32012
32025
|
}
|
|
32013
|
-
|
|
32026
|
+
let str = `${capitalizeKind}${visiblelabel} from (${point1.coord[0]}, ${point1.coord[1]}) to (${point2.coord[0]}, ${point2.coord[1]})`;
|
|
32027
|
+
const lineAppearance = generateLockedFigureAppearanceDescription(lineColor, lineStyle);
|
|
32028
|
+
str += lineAppearance;
|
|
32014
32029
|
return str;
|
|
32015
32030
|
}
|
|
32016
32031
|
function handleChangePoint(newPointProps, index) {
|
|
@@ -32289,6 +32304,8 @@ const LockedPolygonSettings = props => {
|
|
|
32289
32304
|
let [x, y] = _ref;
|
|
32290
32305
|
return `(${x}, ${y})`;
|
|
32291
32306
|
}).join(", ");
|
|
32307
|
+
const polygonAppearance = generateLockedFigureAppearanceDescription(color, strokeStyle, fillStyle);
|
|
32308
|
+
str += polygonAppearance;
|
|
32292
32309
|
return str;
|
|
32293
32310
|
}
|
|
32294
32311
|
function handleColorChange(newValue) {
|
|
@@ -32623,7 +32640,9 @@ const LockedVectorSettings = props => {
|
|
|
32623
32640
|
if (labels && labels.length > 0) {
|
|
32624
32641
|
visiblelabel += ` ${labels.map(l => l.text).join(", ")}`;
|
|
32625
32642
|
}
|
|
32626
|
-
|
|
32643
|
+
let str = `Vector${visiblelabel} from (${tail[0]}, ${tail[1]}) to (${tip[0]}, ${tip[1]})`;
|
|
32644
|
+
const vectorAppearance = generateLockedFigureAppearanceDescription(lineColor);
|
|
32645
|
+
str += vectorAppearance;
|
|
32627
32646
|
return str;
|
|
32628
32647
|
}
|
|
32629
32648
|
function handleChangePoint(newCoord, index) {
|
|
@@ -34945,7 +34964,6 @@ class Option extends React__namespace.Component {
|
|
|
34945
34964
|
value,
|
|
34946
34965
|
onClick,
|
|
34947
34966
|
children,
|
|
34948
|
-
optionRenderer,
|
|
34949
34967
|
disabled,
|
|
34950
34968
|
hideFocusState,
|
|
34951
34969
|
testId,
|
|
@@ -34972,14 +34990,7 @@ class Option extends React__namespace.Component {
|
|
|
34972
34990
|
"aria-disabled": disabled,
|
|
34973
34991
|
"aria-label": ariaLabel,
|
|
34974
34992
|
"data-testid": testId
|
|
34975
|
-
},
|
|
34976
|
-
/*#__PURE__*/
|
|
34977
|
-
/**
|
|
34978
|
-
* This expects a `React.Element<>` but `children` is a
|
|
34979
|
-
* `React.Node`. We can convert a `React.Node` to a
|
|
34980
|
-
* `React.Element<>` by wrapping it in a fragment.
|
|
34981
|
-
*/
|
|
34982
|
-
React__namespace.createElement(React__namespace.Fragment, null, children), value || "", selected || false, disabled), !optionRenderer && /*#__PURE__*/React__namespace.createElement("span", {
|
|
34993
|
+
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
34983
34994
|
className: aphrodite.css(styles$4.option, selected && styles$4.optionSelected, disabled && styles$4.optionDisabled)
|
|
34984
34995
|
}, children, selected && /*#__PURE__*/React__namespace.createElement("span", {
|
|
34985
34996
|
className: aphrodite.css(styles$4.check)
|
|
@@ -35006,7 +35017,6 @@ class OptionGroup extends React__namespace.Component {
|
|
|
35006
35017
|
children,
|
|
35007
35018
|
onSelected,
|
|
35008
35019
|
selectedValues,
|
|
35009
|
-
optionRenderer,
|
|
35010
35020
|
noMargin,
|
|
35011
35021
|
onDropdownClose,
|
|
35012
35022
|
hideFocusState
|
|
@@ -35030,7 +35040,6 @@ class OptionGroup extends React__namespace.Component {
|
|
|
35030
35040
|
selected: selected,
|
|
35031
35041
|
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
35032
35042
|
onClick: () => onSelected(child.props.value),
|
|
35033
|
-
optionRenderer: optionRenderer,
|
|
35034
35043
|
ref: reference,
|
|
35035
35044
|
onDropdownClose: onDropdownClose,
|
|
35036
35045
|
hideFocusState: hideFocusState
|
|
@@ -37735,6 +37744,7 @@ class RadioEditor extends React__namespace.Component {
|
|
|
37735
37744
|
editMode: true,
|
|
37736
37745
|
labelWrap: false,
|
|
37737
37746
|
apiOptions: this.props.apiOptions,
|
|
37747
|
+
reviewMode: false,
|
|
37738
37748
|
choices: this.props.choices.map((choice, i) => {
|
|
37739
37749
|
return {
|
|
37740
37750
|
content: /*#__PURE__*/React__namespace.createElement(ChoiceEditor, {
|