Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-parrots-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-core": patch
---

Copy data that was once shared into perseus-parser
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import {enumeration} from "../general-purpose-parsers";

export const keypadKeys = enumeration(
"PLUS",
"MINUS",
"NEGATIVE",
"TIMES",
"DIVIDE",
"DECIMAL",
"PERIOD",
"PERCENT",
"CDOT",
"EQUAL",
"NEQ",
"GT",
"LT",
"GEQ",
"LEQ", // mobile native only
"FRAC_INCLUSIVE", // mobile native only
"FRAC_EXCLUSIVE", // mobile native only
"FRAC",
"EXP",
"EXP_2",
"EXP_3",
"SQRT",
"CUBE_ROOT",
"RADICAL",
"LEFT_PAREN",
"RIGHT_PAREN",
"LN",
"LOG",
"LOG_N",
"SIN",
"COS",
"TAN",
"PI",
"THETA",
"UP",
"RIGHT",
"DOWN",
"LEFT",
"BACKSPACE",
"DISMISS",
"JUMP_OUT_PARENTHESES",
"JUMP_OUT_EXPONENT",
"JUMP_OUT_BASE",
"JUMP_INTO_NUMERATOR",
"JUMP_OUT_NUMERATOR",
"JUMP_OUT_DENOMINATOR", // Multi-functional keys.
"NUM_0",
"NUM_1",
"NUM_2",
"NUM_3",
"NUM_4",
"NUM_5",
"NUM_6",
"NUM_7",
"NUM_8",
"NUM_9",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
);
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// TODO(LEMS-4224): don't import from outside of the parser
// eslint-disable-next-line import/no-restricted-paths
import {KeypadKeys} from "../../keypad";
// TODO(LEMS-4224): don't import from outside of the parser
// eslint-disable-next-line import/no-restricted-paths
import deriveExtraKeys from "../../widgets/expression/derive-extra-keys";
import {
array,
Expand All @@ -19,6 +16,7 @@ import {
import {convert} from "../general-purpose-parsers/convert";
import {defaulted} from "../general-purpose-parsers/defaulted";

import {keypadKeys} from "./expression-keys";
import {parseLegacyButtonSets} from "./legacy-button-sets";
import {versionedWidgetOptions} from "./versioned-widget-options";
import {parseWidgetWithVersion} from "./widget";
Expand Down Expand Up @@ -75,7 +73,7 @@ const parseExpressionWidgetV2 = parseWidgetWithVersion(
ariaLabel: optional(string),
buttonSets: parseLegacyButtonSets,
buttonsVisible: optional(enumeration("always", "never", "focused")),
extraKeys: optional(array(enumeration(...KeypadKeys))),
extraKeys: optional(array(keypadKeys)),
}),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// TODO(LEMS-4224): don't import from outside of the parser
// eslint-disable-next-line import/no-restricted-paths
import {plotterPlotTypes} from "../../data-schema";
import {
constant,
object,
Expand All @@ -15,12 +12,20 @@ import {defaulted} from "../general-purpose-parsers/defaulted";

import {parseWidget} from "./widget";

const plotterPlotTypes = enumeration(
"bar",
"line",
"pic",
"histogram",
"dotplot",
);

export const parsePlotterWidget = parseWidget(
constant("plotter"),
object({
labels: array(string),
categories: array(string),
type: enumeration(...plotterPlotTypes),
type: plotterPlotTypes,
maxY: number,
// The default value for scaleY comes from plotter.tsx.
// See parse-perseus-json/README.md for why we want to duplicate the
Expand Down
Loading