@khanacademy/perseus-editor 7.0.2 → 8.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.
@@ -1,10 +1,11 @@
1
- import type { LockedFigure, LockedFigureType, LockedPointType, LockedLineType, LockedEllipseType, LockedVectorType, LockedPolygonType } from "@khanacademy/perseus";
1
+ import type { LockedFigure, LockedFigureType, LockedPointType, LockedLineType, LockedEllipseType, LockedVectorType, LockedPolygonType, LockedFunctionType } from "@khanacademy/perseus";
2
2
  export declare function focusWithChromeStickyFocusBugWorkaround(element: Element): void;
3
3
  export declare function getDefaultFigureForType(type: "point"): LockedPointType;
4
4
  export declare function getDefaultFigureForType(type: "line"): LockedLineType;
5
5
  export declare function getDefaultFigureForType(type: "vector"): LockedVectorType;
6
6
  export declare function getDefaultFigureForType(type: "ellipse"): LockedEllipseType;
7
7
  export declare function getDefaultFigureForType(type: "polygon"): LockedPolygonType;
8
+ export declare function getDefaultFigureForType(type: "function"): LockedFunctionType;
8
9
  export declare function getDefaultFigureForType(type: LockedFigureType): LockedFigure;
9
10
  export declare function degreeToRadian(degrees: number): number;
10
11
  export declare function radianToDegree(radians: number): number;
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
2
- import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusError, Errors, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, lockedFigureFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
1
+ import { addLibraryVersionToPerseusDebug, PerseusError, Errors } from '@khanacademy/perseus-core';
2
+ import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, lockedFigureFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
3
3
  import * as React from 'react';
4
4
  import { useRef, useEffect } from 'react';
5
5
  import _ from 'underscore';
@@ -36,7 +36,7 @@ import Banner from '@khanacademy/wonder-blocks-banner';
36
36
 
37
37
  // This file is processed by a Rollup plugin (replace) to inject the production
38
38
  const libName = "@khanacademy/perseus-editor";
39
- const libVersion = "7.0.2";
39
+ const libVersion = "8.0.0";
40
40
  addLibraryVersionToPerseusDebug(libName, libVersion);
41
41
 
42
42
  function _extends() {
@@ -29679,6 +29679,14 @@ function getDefaultFigureForType(type) {
29679
29679
  fillStyle: "none",
29680
29680
  strokeStyle: "solid"
29681
29681
  };
29682
+ case "function":
29683
+ return {
29684
+ type: "function",
29685
+ color: DEFAULT_COLOR,
29686
+ strokeStyle: "solid",
29687
+ equation: "x^2",
29688
+ directionalAxis: "x"
29689
+ };
29682
29690
  default:
29683
29691
  throw new UnreachableCaseError(type);
29684
29692
  }
@@ -30957,6 +30965,12 @@ const LockedFiguresSection = props => {
30957
30965
  const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
30958
30966
  const showExpandButton = !!(figures != null && figures.length);
30959
30967
  return /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
30968
+ if (figure.type === "function") {
30969
+ // TODO(LEMS-1947): Add locked function settings.
30970
+ // Remove this block once function locked figure settings are
30971
+ // implemented.
30972
+ return;
30973
+ }
30960
30974
  return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
30961
30975
  key: `${uniqueId}-locked-${figure}-${index}`,
30962
30976
  showM2Features: props.showM2Features,
@@ -34457,9 +34471,14 @@ class NumericInputEditor extends React.Component {
34457
34471
  onChange: this.props.onChange
34458
34472
  }), /*#__PURE__*/React.createElement(InfoTip$7, null, /*#__PURE__*/React.createElement("p", null, "A coefficient style number allows the student to use - for -1 and an empty string to mean 1."))));
34459
34473
  const addAnswerButton = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
34460
- href: "javascript:void(0)",
34474
+ href: "#",
34461
34475
  className: "simple-button orange",
34462
- onClick: () => this.addAnswer(),
34476
+ onClick: e => {
34477
+ // preventDefault ensures that href="#"
34478
+ // doesn't scroll to the top of the page
34479
+ e.preventDefault();
34480
+ this.addAnswer();
34481
+ },
34463
34482
  onKeyDown: e => this.onSpace(e, this.addAnswer)
34464
34483
  }, /*#__PURE__*/React.createElement("span", null, "Add new answer")));
34465
34484
  const instructions = {
@@ -34541,21 +34560,36 @@ class NumericInputEditor extends React.Component {
34541
34560
  })) : null, /*#__PURE__*/React.createElement("div", {
34542
34561
  className: "value-divider"
34543
34562
  }), /*#__PURE__*/React.createElement("a", {
34544
- href: "javascript:void(0)",
34563
+ href: "#",
34545
34564
  className: "answer-status " + answer.status,
34546
- onClick: () => this.onStatusChange(i),
34565
+ onClick: e => {
34566
+ // preventDefault ensures that href="#"
34567
+ // doesn't scroll to the top of the page
34568
+ e.preventDefault();
34569
+ this.onStatusChange(i);
34570
+ },
34547
34571
  onKeyDown: e => this.onSpace(e, this.onStatusChange)
34548
34572
  }, answer.status), /*#__PURE__*/React.createElement("a", {
34549
- href: "javascript:void(0)",
34573
+ href: "#",
34550
34574
  className: "answer-trash",
34551
34575
  "aria-label": "Delete answer",
34552
- onClick: () => this.onTrashAnswer(i),
34576
+ onClick: e => {
34577
+ // preventDefault ensures that href="#"
34578
+ // doesn't scroll to the top of the page
34579
+ e.preventDefault();
34580
+ this.onTrashAnswer(i);
34581
+ },
34553
34582
  onKeyDown: e => this.onSpace(e, this.onTrashAnswer)
34554
34583
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconTrash$1)), /*#__PURE__*/React.createElement("a", {
34555
- href: "javascript:void(0)",
34584
+ href: "#",
34556
34585
  className: "options-toggle",
34557
34586
  "aria-label": "Toggle options",
34558
- onClick: () => this.onToggleOptions(i),
34587
+ onClick: e => {
34588
+ // preventDefault ensures that href="#"
34589
+ // doesn't scroll to the top of the page
34590
+ e.preventDefault();
34591
+ this.onToggleOptions(i);
34592
+ },
34559
34593
  onKeyDown: e => this.onSpace(e, this.onToggleOptions)
34560
34594
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconGear))), /*#__PURE__*/React.createElement("div", {
34561
34595
  className: "input-answer-editor-message"