@khanacademy/perseus-core 5.0.0 → 5.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.
@@ -12,15 +12,6 @@ export type PerseusAnalyticsEvent = {
12
12
  } | {
13
13
  type: "perseus:expression-focused";
14
14
  payload: null;
15
- } | {
16
- type: "perseus:widget-rendering-error";
17
- payload: {
18
- widgetSubType: string;
19
- widgetType: string;
20
- widgetId: string;
21
- message: string;
22
- userAgent: string;
23
- };
24
15
  } | {
25
16
  type: "perseus:widget-rendering-error:ti";
26
17
  payload: {
@@ -323,6 +323,7 @@ export type PerseusImageBackground = {
323
323
  * - none: shows no markings
324
324
  */
325
325
  export type MarkingsType = "axes" | "graph" | "grid" | "none";
326
+ export type AxisLabelLocation = "onAxis" | "alongEdge";
326
327
  export type PerseusCategorizerWidgetOptions = {
327
328
  items: ReadonlyArray<string>;
328
329
  categories: ReadonlyArray<string>;
@@ -476,6 +477,13 @@ export type PerseusInteractiveGraphWidgetOptions = {
476
477
  */
477
478
  markings: MarkingsType;
478
479
  labels?: ReadonlyArray<string>;
480
+ /**
481
+ * Specifies the location of the labels on the graph. default: "onAxis".
482
+ * - "onAxis": Labels are positioned on the axis at the right (x) and top (y) of the graph.
483
+ * - "alongEdge": Labels are centered along the bottom (x) and left (y) edges of the graph.
484
+ * The y label is rotated. Typically used when the range min is near 0 with longer labels.
485
+ */
486
+ labelLocation?: AxisLabelLocation;
479
487
  showProtractor: boolean;
480
488
  /**
481
489
  * Whether to show the Ruler tool overlayed on top of the graph.
package/dist/es/index.js CHANGED
@@ -1022,7 +1022,7 @@ function parseWidgetWithVersion(parseVersion, parseType, parseOptions) {
1022
1022
  graded: optional(boolean),
1023
1023
  alignment: optional(string),
1024
1024
  options: parseOptions,
1025
- key: optional(number),
1025
+ key: optional(nullable(number)),
1026
1026
  version: parseVersion
1027
1027
  });
1028
1028
  }
@@ -2844,7 +2844,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
2844
2844
 
2845
2845
  // This file is processed by a Rollup plugin (replace) to inject the production
2846
2846
  const libName = "@khanacademy/perseus-core";
2847
- const libVersion = "5.0.0";
2847
+ const libVersion = "5.2.0";
2848
2848
  addLibraryVersionToPerseusDebug(libName, libVersion);
2849
2849
 
2850
2850
  /**
@@ -4024,6 +4024,10 @@ function getUpgradedWidgetOptions(oldWidgetOptions) {
4024
4024
  });
4025
4025
  }
4026
4026
 
4027
+ /**
4028
+ * Upgrades widget options and removes answerful data for all the widgets in a
4029
+ * Perseus item.
4030
+ */
4027
4031
  function splitPerseusItem(originalItem) {
4028
4032
  var _item$widgets;
4029
4033
  const item = _.clone(originalItem);