Skip to content

Commit

Permalink
Merge branch 'main' into feature/client-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremywiebe committed Jan 7, 2025
2 parents a423410 + 265a931 commit 9c3e02e
Show file tree
Hide file tree
Showing 67 changed files with 4,310 additions and 210 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-cats-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Internal: Redesign discriminated union type parser to have a simpler and more intuitive interface.
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ jobs:
# Releases are triggered by merging "Version Packages" PRs.
# So we look for instances of the release.yml workflow, with
# a title containing "Version Packages", that are in progress.
release_count=$(gh run list --workflow release.yml --json status,displayTitle --jq '[.[] | select(.status == "in_progress" and (.displayTitle | contains("Version Packages")))] | length')
release_count=$(gh run list --workflow release.yml --json status,displayTitle --jq '[.[] | select(.status == "in_progress" and ((.displayTitle | contains("Version Packages")) or (.displayTitle | contains("RELEASING:"))))] | length')
echo "release_count=$release_count" >> $GITHUB_OUTPUT
if [ "$release_count" -ne 0 ]; then
echo "Error: There are $release_count releases in progress."
Expand Down
7 changes: 7 additions & 0 deletions dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @khanacademy/perseus-dev-ui

## 5.0.10

### Patch Changes

- Updated dependencies [[`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba)]:
- @khanacademy/math-input@22.1.0

## 5.0.9

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Perseus dev UI",
"author": "Khan Academy",
"license": "MIT",
"version": "5.0.9",
"version": "5.0.10",
"private": true,
"repository": {
"type": "git",
Expand All @@ -16,7 +16,7 @@
"dependencies": {
"@khanacademy/kas": "^0.4.9",
"@khanacademy/kmath": "^0.1.24",
"@khanacademy/math-input": "^22.0.7",
"@khanacademy/math-input": "^22.1.0",
"@khanacademy/perseus-core": "3.0.5",
"@khanacademy/perseus-linter": "^1.2.11",
"@khanacademy/pure-markdown": "^0.3.20",
Expand Down
6 changes: 6 additions & 0 deletions packages/math-input/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @khanacademy/math-input

## 22.1.0

### Minor Changes

- [#1738](https://github.com/Khan/perseus/pull/1738) [`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add scientific notation button / toggle to basic keypad

## 22.0.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/math-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Khan Academy's new expression editor for the mobile web.",
"author": "Khan Academy",
"license": "MIT",
"version": "22.0.7",
"version": "22.1.0",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import type {ClickKeyCallback} from "../../../types";

type Props = {
onClickKey: ClickKeyCallback;
scientific?: boolean;
};

export default function NumbersPage(props: Props) {
const {onClickKey} = props;
export default function NumbersPage({onClickKey, scientific}: Props) {
const {strings} = useMathInputI18n();
const Keys = KeyConfigs(strings);
// These keys are arranged sequentially so that tabbing follows numerical order. This
Expand Down Expand Up @@ -92,6 +92,14 @@ export default function NumbersPage(props: Props) {
coord={[3, 0]}
secondary
/>
{scientific && (
<KeypadButton
keyConfig={Keys.EXP}
onClickKey={onClickKey}
coord={[3, 2]}
secondary
/>
)}
</>
);
}
7 changes: 6 additions & 1 deletion packages/math-input/src/components/keypad/keypad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type Props = {
basicRelations?: boolean;
advancedRelations?: boolean;
fractionsOnly?: boolean;
scientific?: boolean;

onClickKey: ClickKeyCallback;
onAnalyticsEvent: AnalyticsEventHandlerFn;
Expand Down Expand Up @@ -89,6 +90,7 @@ export default function Keypad({extraKeys = [], ...props}: Props) {
logarithms,
basicRelations,
advancedRelations,
scientific,
showDismiss,
onAnalyticsEvent,
fractionsOnly,
Expand Down Expand Up @@ -155,7 +157,10 @@ export default function Keypad({extraKeys = [], ...props}: Props) {
/>
)}
{selectedPage === "Numbers" && (
<NumbersPage onClickKey={onClickKey} />
<NumbersPage
onClickKey={onClickKey}
scientific={scientific}
/>
)}
{selectedPage === "Extras" && (
<ExtrasPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ class MobileKeypadInternals
containerWidth > expandedViewThreshold
}
showDismiss
scientific={
isExpression && keypadConfig?.scientific
}
/>
) : null}
</AphroditeCssTransitionGroup>
Expand Down
1 change: 1 addition & 0 deletions packages/math-input/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type KeypadConfiguration = {
keypadType: KeypadType;
extraKeys?: ReadonlyArray<Key>;
times?: boolean;
scientific?: boolean;
};

export type KeyHandler = (key: Key) => Cursor;
Expand Down
19 changes: 19 additions & 0 deletions packages/perseus-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# @khanacademy/perseus-editor

## 17.1.0

### Minor Changes

- [#1738](https://github.com/Khan/perseus/pull/1738) [`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add scientific notation button / toggle to basic keypad

### Patch Changes

- Updated dependencies [[`d8b2f7eaf`](https://github.com/Khan/perseus/commit/d8b2f7eaff83062516ad1e273c17fd6579716265), [`bac10129b`](https://github.com/Khan/perseus/commit/bac10129b523d61904a88ef3c7dbfcad2bd18750), [`37c642f24`](https://github.com/Khan/perseus/commit/37c642f24e645db954895510ba40bede94e09889), [`617377147`](https://github.com/Khan/perseus/commit/61737714796dfb8434fc139471d1add3c18853b3), [`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba), [`53ba9f5d1`](https://github.com/Khan/perseus/commit/53ba9f5d136f817257188ccf2696a8b91896ba72)]:
- @khanacademy/perseus@49.2.0
- @khanacademy/math-input@22.1.0

## 17.0.12

### Patch Changes

- Updated dependencies [[`f23b383e7`](https://github.com/Khan/perseus/commit/f23b383e797a522ddee064c79e582467dfc08f94)]:
- @khanacademy/perseus@49.1.7

## 17.0.11

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/perseus-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Perseus editors",
"author": "Khan Academy",
"license": "MIT",
"version": "17.0.11",
"version": "17.1.0",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -38,8 +38,8 @@
"@khanacademy/kas": "^0.4.9",
"@khanacademy/keypad-context": "^1.0.12",
"@khanacademy/kmath": "^0.1.24",
"@khanacademy/math-input": "^22.0.7",
"@khanacademy/perseus": "^49.1.6",
"@khanacademy/math-input": "^22.1.0",
"@khanacademy/perseus": "^49.2.0",
"@khanacademy/perseus-core": "3.0.5",
"@khanacademy/pure-markdown": "^0.3.20",
"mafs": "^0.19.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,23 @@ describe("expression-editor", () => {
});
});

it("should toggle scientific checkbox", async () => {
const onChangeMock = jest.fn();

render(<ExpressionEditor onChange={onChangeMock} />);
act(() => jest.runOnlyPendingTimers());

await userEvent.click(
screen.getByRole("checkbox", {
name: "scientific",
}),
);

expect(onChangeMock).toBeCalledWith({
buttonSets: ["basic", "scientific"],
});
});

it("should be possible to add an answer", async () => {
const onChangeMock = jest.fn();

Expand Down
1 change: 1 addition & 0 deletions packages/perseus-editor/src/widgets/expression-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const buttonSetsList: LegacyButtonSets = [
"trig",
"prealgebra",
"logarithms",
"scientific",
"basic relations",
"advanced relations",
];
Expand Down
27 changes: 27 additions & 0 deletions packages/perseus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# @khanacademy/perseus

## 49.2.0

### Minor Changes

- [#1990](https://github.com/Khan/perseus/pull/1990) [`37c642f24`](https://github.com/Khan/perseus/commit/37c642f24e645db954895510ba40bede94e09889) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Allow keyboards to navigate and interact with images

* [#1738](https://github.com/Khan/perseus/pull/1738) [`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - add scientific notation button / toggle to basic keypad

### Patch Changes

- [#2061](https://github.com/Khan/perseus/pull/2061) [`d8b2f7eaf`](https://github.com/Khan/perseus/commit/d8b2f7eaff83062516ad1e273c17fd6579716265) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - update terminology for angle sides

* [#2071](https://github.com/Khan/perseus/pull/2071) [`bac10129b`](https://github.com/Khan/perseus/commit/bac10129b523d61904a88ef3c7dbfcad2bd18750) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - This patch fixes our Perseus strings to ensure that they are double escaped for Lingui.

- [#1952](https://github.com/Khan/perseus/pull/1952) [`617377147`](https://github.com/Khan/perseus/commit/61737714796dfb8434fc139471d1add3c18853b3) Thanks [@benchristel](https://github.com/benchristel)! - Internal: add and pass more regression tests for PerseusItem parser

* [#2059](https://github.com/Khan/perseus/pull/2059) [`53ba9f5d1`](https://github.com/Khan/perseus/commit/53ba9f5d136f817257188ccf2696a8b91896ba72) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - [Dropdown] Bugfix - Text in dropdown was shifted up after adding TeX support via Renderer

* Updated dependencies [[`dbbc82f2d`](https://github.com/Khan/perseus/commit/dbbc82f2dd33545b12c6073174b05ebcf8d551ba)]:
- @khanacademy/math-input@22.1.0

## 49.1.7

### Patch Changes

- [#2054](https://github.com/Khan/perseus/pull/2054) [`f23b383e7`](https://github.com/Khan/perseus/commit/f23b383e797a522ddee064c79e582467dfc08f94) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - [Dropdown] Bugfix - Render options and placeholder inline

## 49.1.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Core Perseus API (includes renderers and widgets)",
"author": "Khan Academy",
"license": "MIT",
"version": "49.1.6",
"version": "49.2.0",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -44,7 +44,7 @@
"@khanacademy/kas": "^0.4.9",
"@khanacademy/keypad-context": "^1.0.12",
"@khanacademy/kmath": "^0.1.24",
"@khanacademy/math-input": "^22.0.7",
"@khanacademy/math-input": "^22.1.0",
"@khanacademy/perseus-core": "3.0.5",
"@khanacademy/perseus-linter": "^1.2.11",
"@khanacademy/pure-markdown": "^0.3.20",
Expand Down
36 changes: 21 additions & 15 deletions packages/perseus/src/__tests__/__snapshots__/renderer.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ exports[`renderer snapshots correct answer: correct answer 1`] = `
Test visible label
</label>
<div
class="default_xu2jcg-o_O-menuWrapper_wvrnr4"
class="default_xu2jcg-o_O-menuWrapper_wvrnr4 perseus-dropdown"
>
<span
aria-atomic="true"
Expand Down Expand Up @@ -383,10 +383,14 @@ exports[`renderer snapshots correct answer: correct answer 1`] = `
class="perseus-renderer perseus-renderer-responsive"
>
<div
class=""
class="paragraph"
data-perseus-paragraph-index="0"
>
less than or equal to
<div
class="paragraph"
>
less than or equal to
</div>
</div>
</div>
</span>
Expand Down Expand Up @@ -443,7 +447,7 @@ exports[`renderer snapshots incorrect answer: incorrect answer 1`] = `
Test visible label
</label>
<div
class="default_xu2jcg-o_O-menuWrapper_wvrnr4"
class="default_xu2jcg-o_O-menuWrapper_wvrnr4 perseus-dropdown"
>
<span
aria-atomic="true"
Expand Down Expand Up @@ -471,10 +475,14 @@ exports[`renderer snapshots incorrect answer: incorrect answer 1`] = `
class="perseus-renderer perseus-renderer-responsive"
>
<div
class=""
class="paragraph"
data-perseus-paragraph-index="0"
>
greater than or equal to
<div
class="paragraph"
>
greater than or equal to
</div>
</div>
</div>
</span>
Expand Down Expand Up @@ -531,7 +539,7 @@ exports[`renderer snapshots initial render: initial render 1`] = `
Test visible label
</label>
<div
class="default_xu2jcg-o_O-menuWrapper_wvrnr4"
class="default_xu2jcg-o_O-menuWrapper_wvrnr4 perseus-dropdown"
>
<span
aria-atomic="true"
Expand Down Expand Up @@ -559,16 +567,14 @@ exports[`renderer snapshots initial render: initial render 1`] = `
class="perseus-renderer perseus-renderer-responsive"
>
<div
class=""
class="paragraph"
data-perseus-paragraph-index="0"
>
greater
</div>
<div
class=""
data-perseus-paragraph-index="1"
>
/less than or equal to
<div
class="paragraph"
>
greater/less than or equal to
</div>
</div>
</div>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const meta: Meta = {
logarithms: true,
preAlgebra: true,
trigonometry: true,
scientific: true,
},
convertDotToTimes: false,
value: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`SvgImage should load and render a localized graphie svg 1`] = `
<img
alt="svg image"
src="mockStaticUrl(https://ka-perseus-graphie.s3.amazonaws.com/ccefe63aa1bd05f1d11123f72790a49378d2e42b.svg)"
tabindex="0"
/>
</div>
</div>
Expand All @@ -21,6 +22,7 @@ exports[`SvgImage should load and render a normal graphie svg 1`] = `
<img
alt="svg image"
src="mockStaticUrl(https://ka-perseus-graphie.s3.amazonaws.com/ccefe63aa1bd05f1d11123f72790a49378d2e42b.svg)"
tabindex="0"
/>
</div>
</div>
Expand All @@ -31,6 +33,7 @@ exports[`SvgImage should load and render a png 1`] = `
<img
alt="png image"
src="mockStaticUrl(http://localhost/sample.png)"
tabindex="0"
/>
</div>
`;
Expand Down
Loading

0 comments on commit 9c3e02e

Please sign in to comment.