@khanacademy/perseus 27.1.0 → 27.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/es/index.js CHANGED
@@ -31323,8 +31323,16 @@ function getGradableGraph(state, initialGraph) {
31323
31323
  });
31324
31324
  }
31325
31325
  if (state.type === "angle" && initialGraph.type === "angle") {
31326
+ // We're going to reverse the coords for scoring if the angle is clockwise and
31327
+ // we don't allow reflex angles. This is because the angle is largely defined
31328
+ // by the order of the points in the coords array, and we want to maintain
31329
+ // the same angle scoring with the legacy graph (which had a bug).
31330
+ // (LEMS-2190): When we remove the legacy graph, move this logic to the scoring function.
31331
+ const areClockwise = clockwise$1([state.coords[0], state.coords[2], state.coords[1]]);
31332
+ const shouldReverseCoords = areClockwise && !state.allowReflexAngles;
31333
+ const coords = shouldReverseCoords ? state.coords.slice().reverse() : state.coords;
31326
31334
  return _extends({}, initialGraph, {
31327
- coords: state.coords,
31335
+ coords,
31328
31336
  allowReflexAngles: state.allowReflexAngles
31329
31337
  });
31330
31338
  }
@@ -32987,6 +32995,10 @@ const makeInvalidTypeError = (functionName, graphType) => {
32987
32995
 
32988
32996
  // There's no transform function in exports
32989
32997
 
32998
+ // (LEMS-2190): Move the Mafs Angle Graph coordinate reversal logic in interactive-graph-state.ts
32999
+ // to this file when we remove the legacy graph. This logic allows us to support bi-directional angles
33000
+ // for the new (non-reflexive) Mafs graphs, while maintaining the same scoring behaviour as the legacy graph.
33001
+ // Once the legacy graph is removed, we should move this logic directly into the validate function below.
32990
33002
  class LegacyInteractiveGraph extends React.Component {
32991
33003
  constructor(...args) {
32992
33004
  super(...args);
@@ -44158,7 +44170,7 @@ const init = function init(options) {
44158
44170
 
44159
44171
  // This file is processed by a Rollup plugin (replace) to inject the production
44160
44172
  const libName = "@khanacademy/perseus";
44161
- const libVersion = "27.1.0";
44173
+ const libVersion = "27.2.0";
44162
44174
  addLibraryVersionToPerseusDebug(libName, libVersion);
44163
44175
 
44164
44176
  const apiVersion = {
@@ -47738,5 +47750,5 @@ const EditorJsonify = {
47738
47750
  }
47739
47751
  };
47740
47752
 
47741
- export { ApiOptions, ArrowPicker, ArticleRenderer, BaseRadio, Categorizer$1 as Categorizer, changeable as Changeable, ClassNames, ColorPicker, DashPicker, dependencies as Dependencies, EditorJsonify, ElementContainer, Expression, util as GrapherUtil, Grapher$1 as GrapherWidget, HintRenderer, HintsRenderer, InputNumber$1 as InputNumber, InteractiveGraph$1 as InteractiveGraphWidget, ItemExtras, JiptParagraphs, KhanColors, KhanMath, context as LoadingContext, Log, Matrix$1 as MatrixWidget, MultiItems, NumericInput$1 as NumericInput, PerseusExpressionAnswerFormConsidered, PerseusI18nContext, PerseusI18nContextProvider, PerseusMarkdown, Plotter$1 as PlotterWidget, QUESTION_WIDGETS, Radio, Renderer, ref as ServerItemRenderer, sizingUtils as SizingUtils, Table$1 as TableWidget, Util, denylist as WIDGET_PROP_DENYLIST, WidgetJsonifyDeprecated, widgets$1 as Widgets, addWidget, apiVersion, buildEmptyItemTreeForShape, buildMapper, components, constants, contentHasWidgetType, convertWidgetNameToEnum, displaySigFigs, generateTestCategorizerWidget, generateTestExpressionWidget, generateTestInteractiveGraphWidget, generateTestNumericInputWidget, generateTestPerseusItem, generateTestRadioWidget, genericPerseusItemData, getAnswerFromUserInput, getAnswersFromWidgets, getCircleCoords, getCorrectAnswerForWidgetId, getLineCoords, getLinearSystemCoords, getSegmentCoords, getValidWidgetIds, getWidgetFromWidgetMap, getWidgetIdsFromContent, getWidgetIdsFromContentByType, getWidgetTypeByWidgetId, getWidgetsFromWidgetMap, getWidgetsMapFromItemData, globalConstants, globalStyles, iconPaths as icons, init, injectWidgets, interactiveSizes$1 as interactiveSizes, isItemRenderableByVersion, isWidgetIdInContent, isWrongAnswerSupported, itemDataVersion, itemToTree, ItemVersion as itemVersion, libVersion, lockedFigureColors, lockedFigureFillStyles, mediaQueries, parsePerseusItem, plotterPlotTypes, preprocessTex, registerAllWidgetsForTesting, shapes, shouldHaveIndividualAnswer, traverse, usePerseusI18n, violatingWidgets, allWidgets as widgets };
47753
+ export { ApiOptions, ArrowPicker, ArticleRenderer, BaseRadio, Categorizer$1 as Categorizer, changeable as Changeable, ClassNames, ColorPicker, DashPicker, dependencies as Dependencies, EditorJsonify, ElementContainer, Expression, util as GrapherUtil, Grapher$1 as GrapherWidget, HintRenderer, HintsRenderer, InputNumber$1 as InputNumber, InteractiveGraph$1 as InteractiveGraphWidget, ItemExtras, JiptParagraphs, KhanColors, KhanMath, context as LoadingContext, Log, Matrix$1 as MatrixWidget, MultiItems, NumericInput$1 as NumericInput, PerseusExpressionAnswerFormConsidered, PerseusI18nContext, PerseusI18nContextProvider, PerseusMarkdown, Plotter$1 as PlotterWidget, QUESTION_WIDGETS, Radio, Renderer, ref as ServerItemRenderer, sizingUtils as SizingUtils, Table$1 as TableWidget, Util, denylist as WIDGET_PROP_DENYLIST, WidgetJsonifyDeprecated, widgets$1 as Widgets, addWidget, apiVersion, buildEmptyItemTreeForShape, buildMapper, components, constants, contentHasWidgetType, convertWidgetNameToEnum, displaySigFigs, generateTestCategorizerWidget, generateTestExpressionWidget, generateTestInteractiveGraphWidget, generateTestNumericInputWidget, generateTestPerseusItem, generateTestRadioWidget, genericPerseusItemData, getAnswerFromUserInput, getAnswersFromWidgets, getCircleCoords, getCorrectAnswerForWidgetId, getLineCoords, getLinearSystemCoords, getQuadraticCoords, getSegmentCoords, getSinusoidCoords, getValidWidgetIds, getWidgetFromWidgetMap, getWidgetIdsFromContent, getWidgetIdsFromContentByType, getWidgetTypeByWidgetId, getWidgetsFromWidgetMap, getWidgetsMapFromItemData, globalConstants, globalStyles, iconPaths as icons, init, injectWidgets, interactiveSizes$1 as interactiveSizes, isItemRenderableByVersion, isWidgetIdInContent, isWrongAnswerSupported, itemDataVersion, itemToTree, ItemVersion as itemVersion, libVersion, lockedFigureColors, lockedFigureFillStyles, mediaQueries, parsePerseusItem, plotterPlotTypes, preprocessTex, registerAllWidgetsForTesting, shapes, shouldHaveIndividualAnswer, traverse, usePerseusI18n, violatingWidgets, allWidgets as widgets };
47742
47754
  //# sourceMappingURL=index.js.map