Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into tb/LEMS-2175/keyboard-cant-contro…
Browse files Browse the repository at this point in the history
…l-static-graphs
  • Loading branch information
Myranae committed Aug 8, 2024
2 parents f415144 + de13fd3 commit 5685692
Show file tree
Hide file tree
Showing 111 changed files with 2,509 additions and 762 deletions.
6 changes: 6 additions & 0 deletions .changeset/chilly-apples-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus-editor": minor
"@khanacademy/perseus": patch
---

Add/Edit/Delete Locked Function in Interactive Graph Editor
5 changes: 5 additions & 0 deletions .changeset/clean-glasses-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

[Hint Mode: Start Coords] Correct flag logic for polygon graph start coords UI
6 changes: 6 additions & 0 deletions .changeset/eleven-paws-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": minor
"@khanacademy/perseus-editor": minor
---

[Hint Mode: Start Coords] Build the foundation for adding start coords UI for angle graphs
5 changes: 5 additions & 0 deletions .changeset/flat-badgers-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/math-input": patch
---

Remove old buttons that we weren't using anymore
6 changes: 6 additions & 0 deletions .changeset/four-laws-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

Miscellaneous type improvements
6 changes: 6 additions & 0 deletions .changeset/four-windows-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": major
"@khanacademy/perseus-editor": patch
---

Remove PropCheckBox component from Perseus; use WB instead
5 changes: 5 additions & 0 deletions .changeset/fresh-tips-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/math-input": patch
---

update wonder blocks popover versions
6 changes: 6 additions & 0 deletions .changeset/gentle-planes-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

Correct `hints` type on ItemRenderer
6 changes: 6 additions & 0 deletions .changeset/grumpy-sheep-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

[Interactive Graph Editor: Storybook] Add a story for Point graph type start coords
5 changes: 5 additions & 0 deletions .changeset/purple-dots-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

[Interactive Graph Editor] Stop page scrolling on number text field focused scroll
5 changes: 5 additions & 0 deletions .changeset/strange-trains-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/math-input": patch
---

Remove unused buttons from MathInput; add Lato
6 changes: 6 additions & 0 deletions .changeset/tasty-eggs-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": minor
"@khanacademy/perseus-editor": minor
---

[Hint Mode: Start Coords] Add start coords UI for point graphs
5 changes: 5 additions & 0 deletions .changeset/tender-tools-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

add non-visual text as a description for expression widget
6 changes: 6 additions & 0 deletions .changeset/unlucky-lamps-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": minor
"@khanacademy/perseus-editor": minor
---

[Hint Mode: Start Coords] Add start coords UI for polygon graphs (snap to grid only)
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const config: StorybookConfig = {
docs: {
autodocs: true,
},
staticDirs: ["../static"],
};

export default config;
59 changes: 59 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!-- Preload WB fonts to prevent layout shifting due to font rendering -->
<link
rel="preload"
href="fonts/pre/Lato-Regular.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/Lato-Bold.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/Lato-Black.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/Lato-Italic.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/LatoLatin-Regular.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/LatoLatin-Bold.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/LatoLatin-Black.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="preload"
href="fonts/lato/LatoLatin-Italic.woff2"
as="font"
type="font/woff2"
crossorigin
/>

<link rel="stylesheet" href="./lato.css" />
4 changes: 2 additions & 2 deletions packages/math-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@khanacademy/mathjax-renderer": "^2.0.1",
"@khanacademy/wonder-blocks-clickable": "4.2.1",
"@khanacademy/wonder-blocks-core": "6.4.0",
"@khanacademy/wonder-blocks-popover": "3.2.9",
"@khanacademy/wonder-blocks-popover": "3.2.11",
"@khanacademy/wonder-blocks-timing": "5.0.0",
"@khanacademy/wonder-blocks-tokens": "1.3.0",
"@khanacademy/wonder-stuff-core": "1.5.2",
Expand All @@ -64,7 +64,7 @@
"@khanacademy/mathjax-renderer": "^2.0.1",
"@khanacademy/wonder-blocks-clickable": "4.2.1",
"@khanacademy/wonder-blocks-core": "6.4.0",
"@khanacademy/wonder-blocks-popover": "3.2.9",
"@khanacademy/wonder-blocks-popover": "3.2.11",
"@khanacademy/wonder-blocks-timing": "5.0.0",
"@khanacademy/wonder-blocks-tokens": "1.3.0",
"@khanacademy/wonder-stuff-core": "1.5.2",
Expand Down
28 changes: 0 additions & 28 deletions packages/math-input/src/components/key-handlers/key-translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export const getKeyTranslator = (
LEFT_PAREN: buildGenericCallback("(", ActionType.CMD),
RIGHT_PAREN: buildGenericCallback(")", ActionType.CMD),
SQRT: buildGenericCallback("sqrt", ActionType.CMD),
PHI: buildGenericCallback("\\phi", ActionType.CMD),
PI: buildGenericCallback("pi", ActionType.CMD),
THETA: buildGenericCallback("theta", ActionType.CMD),
RADICAL: buildGenericCallback("nthroot", ActionType.CMD),
Expand All @@ -119,43 +118,16 @@ export const getKeyTranslator = (
}
},

LOG_B: (mathQuill) => {
mathQuill.typedText("log_");
mathQuill.keystroke("Right");
mathQuill.typedText("(");
mathQuill.keystroke("Left");
mathQuill.keystroke("Left");
},

LOG_N: (mathQuill) => {
mathQuill.write("log_{ }\\left(\\right)");
mathQuill.keystroke("Left"); // into parentheses
mathQuill.keystroke("Left"); // out of parentheses
mathQuill.keystroke("Left"); // into index
},

NTHROOT3: (mathQuill) => {
mathQuill.typedText("nthroot3");
mathQuill.keystroke("Right");
},

POW: (mathQuill) => {
const contents = mathQuill.latex();
mathQuill.typedText("^");

// If the input hasn't changed (for example, if we're
// attempting to add an exponent on an empty input or an empty
// denominator), insert our own "a^b"
if (mathQuill.latex() === contents) {
mathQuill.typedText("a^b");
}
},

// These need to be overwritten by the consumer
// if they're going to be used
DISMISS: () => {},
NOOP: () => {},
MANY: () => {},

NUM_0: buildGenericCallback("0"),
NUM_1: buildGenericCallback("1"),
Expand Down
36 changes: 0 additions & 36 deletions packages/math-input/src/components/keypad/button-assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1837,42 +1837,6 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
</g>
</svg>
);

/**
* ANYTHING BELOW IS NOT YET HANDLED
*/
case "MANY":
case "NOOP":
case "PHI":
case "NTHROOT3":
case "POW":
case "LOG_B":
// placeholder
return (
<svg
width="40"
height="40"
viewBox="0 0 40 40"
fill="black"
xmlns="http://www.w3.org/2000/svg"
>
<text
y="20"
textLength="100%"
lengthAdjust="spacingAndGlyphs"
>
{id}
</text>
<text
y="35"
textLength="100%"
lengthAdjust="spacingAndGlyphs"
fill="red"
>
placeholder
</text>
</svg>
);
default:
// this line forces an exhaustive check of all keys;
// if a key is not handled, the compiler will complain.
Expand Down
34 changes: 0 additions & 34 deletions packages/math-input/src/data/key-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,6 @@ const KeyConfigs = (
ariaLabel: strings.theta,
}),
},
NOOP: {
...getDefaultOperatorFields({
key: "NOOP",
keyType: "EMPTY",
}),
},
// Input navigation
UP: {
...getDefaultOperatorFields({
Expand Down Expand Up @@ -366,14 +360,6 @@ const KeyConfigs = (
}),
},

// TODO(charlie): Use the numeral color for the 'Many' key.
MANY: {
...getDefaultOperatorFields({
key: "MANY",
keyType: "MANY",
}),
},

// NUMBERS
NUM_0: {
...getDefaultNumberFields({
Expand Down Expand Up @@ -687,26 +673,6 @@ const KeyConfigs = (
key: "z",
}),
},
PHI: {
...getDefaultValueFields({
key: "PHI",
}),
},
NTHROOT3: {
...getDefaultValueFields({
key: "NTHROOT3",
}),
},
POW: {
...getDefaultValueFields({
key: "POW",
}),
},
LOG_B: {
...getDefaultValueFields({
key: "LOG_B",
}),
},
});

export default KeyConfigs;
9 changes: 0 additions & 9 deletions packages/math-input/src/data/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export const KeyArray = [
"JUMP_INTO_NUMERATOR",
"JUMP_OUT_NUMERATOR",
"JUMP_OUT_DENOMINATOR", // Multi-functional keys.
"NOOP", // mobile native only
"MANY", // A custom key that captures an arbitrary number of symbols but has no 'default' symbol or action.
"NUM_0",
"NUM_1",
"NUM_2",
Expand Down Expand Up @@ -109,13 +107,6 @@ export const KeyArray = [
"X",
"Y",
"Z",

// Currently only used by
// Perseus' Expression MathInput
"PHI",
"NTHROOT3",
"POW",
"LOG_B",
] as const;

type Key = (typeof KeyArray)[number];
Expand Down
3 changes: 0 additions & 3 deletions packages/math-input/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ export const KeyTypes = [
// For buttons that modify the broader keypad state (e.g., by changing
// the visible pane).
"KEYPAD_NAVIGATION",
// For buttons that house multiple buttons and have no action
// themselves.
"MANY",
];
export type KeyType = (typeof KeyTypes)[number];
11 changes: 2 additions & 9 deletions packages/math-input/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ export type IconConfig = {
data: string;
};

export type NonManyKeyConfig = {
export type KeyConfig = {
id: Key;
type: Exclude<KeyType, "MANY">;
type: KeyType;
icon: IconConfig;
ariaLabel: string;
};

export type ManyKeyConfig = Omit<NonManyKeyConfig, "type"> & {
type: Extract<KeyType, "MANY">;
childKeyIds: ReadonlyArray<string>;
};

export type KeyConfig = NonManyKeyConfig | ManyKeyConfig;

export type KeypadConfiguration = {
keypadType: KeypadType;
extraKeys?: ReadonlyArray<Key>;
Expand Down
Loading

0 comments on commit 5685692

Please sign in to comment.