Skip to content

Commit

Permalink
Merge latest changes from main.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fitzgerald committed Dec 2, 2024
2 parents 35a5605 + 819184c commit 837b56f
Show file tree
Hide file tree
Showing 265 changed files with 9,050 additions and 4,534 deletions.
6 changes: 6 additions & 0 deletions .changeset/hot-chairs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": minor
"@khanacademy/perseus-editor": minor
---

Add labels to Dropdown widget
5 changes: 5 additions & 0 deletions .changeset/khaki-keys-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

Removing usage of createReactClass from several component files.
5 changes: 0 additions & 5 deletions .changeset/mighty-cobras-kick.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/strong-flies-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": major
---

Remove PerseusExampleWidgetOptions, PerseusSimpleMarkdownTesterWidgetOptions, and PerseusExampleWidgetOptions types - widgets no longer exist
5 changes: 5 additions & 0 deletions .changeset/strong-rocks-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Remove some uses of findDOMNode
5 changes: 0 additions & 5 deletions .changeset/twenty-baboons-shave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/warm-llamas-tease.md

This file was deleted.

5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ module.exports = {
"no-invalid-this": "off",
"@typescript-eslint/no-this-alias": "off",
"no-unused-expressions": "off",
"no-restricted-imports": [
"error",
"@khanacademy/wonder-blocks-color",
"@khanacademy/wonder-blocks-spacing",
],
"object-curly-spacing": "off",
semi: "off",

Expand Down
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ updates:
allow:
- dependency-name: "@khanacademy/eslint-config"
- dependency-name: "@khanacademy/eslint-plugin"
- dependency-name: "@khanacademy/wonder-blocks-*"
- dependency-name: "@khanacademy/wonder-stuff-*"
assignees:
- "@Khan/perseus"

# Grouped updates for Wonder Blocks and Wonder Stuff releases.
# This helps us to stay in sync with the latest releases of these packages.
groups:
wonder-stuff:
patterns:
- "@khanacademy/wonder-stuff-*"
wonder-blocks:
patterns:
- "@khanacademy/wonder-blocks-*"
1 change: 0 additions & 1 deletion config/test/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ if (typeof window !== "undefined") {
// Override the window.location implementation to mock out assign()
// We need to access window.location.assign to verify that we're
// redirecting to the right place.
/* eslint-disable no-restricted-syntax */
const oldLocation = window.location;
// @ts-expect-error - TS2790 - The operand of a 'delete' operator must be optional.
delete window.location;
Expand Down
23 changes: 23 additions & 0 deletions dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# @khanacademy/perseus-dev-ui

## 4.0.1

### Patch Changes

- Updated dependencies [[`88ba71bef`](https://github.com/Khan/perseus/commit/88ba71bef0cdd75fa0c8b467dcea2cccc637d034)]:
- @khanacademy/kas@0.4.2
- @khanacademy/simple-markdown@0.13.6
- @khanacademy/pure-markdown@0.3.13

## 4.0.0

### Major Changes

- [#1905](https://github.com/Khan/perseus/pull/1905) [`9c225f936`](https://github.com/Khan/perseus/commit/9c225f9365cbb2e92bba3bd67b1abde724809367) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - We're reverting work done for the Server Side Scoring and Input Number Conversion projects.

### Patch Changes

- Updated dependencies [[`55a532175`](https://github.com/Khan/perseus/commit/55a532175192bfee3dc550c7eb7ce74d4a6542a9)]:
- @khanacademy/kas@0.4.1
- @khanacademy/math-input@21.1.5
- @khanacademy/simple-markdown@0.13.5
- @khanacademy/pure-markdown@0.3.12

## 3.1.3

### Patch Changes
Expand Down
11 changes: 1 addition & 10 deletions dev/flipbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {useEffect, useMemo, useReducer, useRef, useState} from "react";

import {Renderer} from "../packages/perseus/src";
import {SvgImage} from "../packages/perseus/src/components";
import {scorePerseusItem} from "../packages/perseus/src/renderer-util";
import {mockStrings} from "../packages/perseus/src/strings";
import {isCorrect} from "../packages/perseus/src/util";
import {trueForAllMafsSupportedGraphTypes} from "../packages/perseus/src/widgets/interactive-graphs/mafs-supported-graph-types";
Expand Down Expand Up @@ -320,15 +319,7 @@ function GradableRenderer(props: QuestionRendererProps) {
leftContent={
<Button
onClick={() => {
if (rendererRef.current) {
const score = scorePerseusItem(
question,
rendererRef.current.getUserInputMap(),
mockStrings,
"en",
);
setScore(score);
}
setScore(rendererRef.current?.score());
clearScoreTimeout.set();
}}
>
Expand Down
10 changes: 5 additions & 5 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": "3.1.3",
"version": "4.0.1",
"private": true,
"repository": {
"type": "git",
Expand All @@ -14,13 +14,13 @@
"dev": "vite"
},
"dependencies": {
"@khanacademy/kas": "^0.4.0",
"@khanacademy/kas": "^0.4.2",
"@khanacademy/kmath": "^0.1.16",
"@khanacademy/math-input": "^21.1.4",
"@khanacademy/math-input": "^21.1.5",
"@khanacademy/perseus-core": "1.5.3",
"@khanacademy/perseus-linter": "^1.2.4",
"@khanacademy/pure-markdown": "^0.3.11",
"@khanacademy/simple-markdown": "^0.13.4",
"@khanacademy/pure-markdown": "^0.3.13",
"@khanacademy/simple-markdown": "^0.13.6",
"@khanacademy/wonder-blocks-banner": "3.1.7",
"@khanacademy/wonder-blocks-icon": "4.1.3",
"@khanacademy/wonder-blocks-icon-button": "5.3.4",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"storybook": "^8.4.5",
"style-loader": "^3.3.3",
"tiny-invariant": "^1.3.1",
"typescript": "^5.4.2",
"typescript": "5.7.2",
"typescript-coverage-report": "^0.7.0",
"vite-plugin-istanbul": "^5.0.0",
"winston": "^3.7.2"
Expand Down
12 changes: 12 additions & 0 deletions packages/kas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @khanacademy/kas

## 0.4.2

### Patch Changes

- [#1920](https://github.com/Khan/perseus/pull/1920) [`88ba71bef`](https://github.com/Khan/perseus/commit/88ba71bef0cdd75fa0c8b467dcea2cccc637d034) Thanks [@handeyeco](https://github.com/handeyeco)! - Fix some file-wide error suppressions

## 0.4.1

### Patch Changes

- [#1889](https://github.com/Khan/perseus/pull/1889) [`55a532175`](https://github.com/Khan/perseus/commit/55a532175192bfee3dc550c7eb7ce74d4a6542a9) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters

## 0.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/kas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A lightweight JavaScript CAS for comparing expressions and equations.",
"author": "Khan Academy",
"license": "MIT",
"version": "0.4.0",
"version": "0.4.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/kas/src/__tests__/units.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ expect.extend({
return {pass: false, message: () => `could not parse ${x}`};
}

// @ts-expect-error: Type 'Expression' is not assignable to type 'Expr'.
const equal = KAS.compare(parsedX.unit, parsedY.unit).equal;

return equal
Expand Down Expand Up @@ -167,6 +168,7 @@ describe("units", () => {

expect(
KAS.compare(
// @ts-expect-error: Type 'Expression' is not assignable to type 'Expr'.
new KAS.Mul(new KAS.Int(50), new KAS.Unit("m")),
new KAS.Int(50),
).equal,
Expand Down
9 changes: 7 additions & 2 deletions packages/kas/src/nodes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable prettier/prettier */
/* eslint-disable import/order */
/* TODO(charlie): fix these lint errors (http://eslint.org/docs/rules): */
/* eslint-disable indent, no-undef, no-var, one-var, no-dupe-keys, no-new-func, no-redeclare, @typescript-eslint/no-unused-vars, comma-dangle, max-len, prefer-spread, space-infix-ops, space-unary-ops */
/* eslint-disable indent, no-undef, no-var, no-dupe-keys, no-new-func, no-redeclare, comma-dangle, max-len, prefer-spread, space-infix-ops, space-unary-ops */
import _ from "underscore";

import {unitParser} from "./__genfiles__/unitparser";
Expand Down Expand Up @@ -313,6 +313,7 @@ abstract class Expr {

// return the child nodes of this node
exprArgs(): Expr[] {
// @ts-expect-error: Type 'string | number | Expr | undefined' is not assignable to type 'string | Expr'.
return this.args().filter(isExpr);
}

Expand Down Expand Up @@ -817,6 +818,7 @@ export class Add extends Seq {
reduce(options?: Options): Expr {
return _.reduce(
this.terms,
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
(memo, term) => {
return memo.add(term, options);
},
Expand Down Expand Up @@ -1300,6 +1302,7 @@ export class Mul extends Seq {
reduce(options?: {preciseFloats: boolean}) {
return _.reduce(
this.terms,
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
(memo, term) => {
return memo.mul(term, options);
},
Expand Down Expand Up @@ -1411,7 +1414,6 @@ export class Mul extends Seq {
rational = rational.addHint("fraction");
}

var result;
if (num.n < 0 && right.n < 0) {
rational.d = -rational.d;
return left.replace(num, [NumNeg, rational]);
Expand Down Expand Up @@ -1557,12 +1559,15 @@ export class Mul extends Seq {
return pos(num) || neg(num);
};

// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
const posNum = numbers.find(pos);
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
const negNum = numbers.find(neg);
if (
numbers.length > 1 &&
negNum &&
posNum &&
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
_.every(numbers, posOrNeg)
) {
var firstNeg = _.indexOf(expr.terms, negNum);
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

## 21.1.5

### Patch Changes

- [#1889](https://github.com/Khan/perseus/pull/1889) [`55a532175`](https://github.com/Khan/perseus/commit/55a532175192bfee3dc550c7eb7ce74d4a6542a9) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters

## 21.1.4

### 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": "21.1.4",
"version": "21.1.5",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/math-input/src/components/input/math-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,8 @@ class MathInput extends React.Component<Props, State> {
}}
onTouchMove={this.handleTouchMove}
onTouchEnd={this.handleTouchEnd}
// TODO(LEMS-2656): remove TS suppression
// @ts-expect-error: Type '(e: React.MouseEvent<HTMLDivElement>) => void' is not assignable to type '(arg1: SyntheticEvent<HTMLDivElement, Event>) => void'.
onClick={(e: React.MouseEvent<HTMLDivElement>) => {
this.handleClick(e, keypadActive, setKeypadActive);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export function V2KeypadWithMathquill() {
mathFieldWrapperRef.current,
"en",
mockStrings,
// TODO(LEMS-2656): remove TS suppression
// @ts-expect-error: Type 'EditableMathQuill' is not assignable to type 'MathFieldInterface'.
(baseConfig) => ({
...baseConfig,
handlers: {
Expand Down
42 changes: 42 additions & 0 deletions packages/perseus-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# @khanacademy/perseus-editor

## 15.0.2

### Patch Changes

- [#1920](https://github.com/Khan/perseus/pull/1920) [`88ba71bef`](https://github.com/Khan/perseus/commit/88ba71bef0cdd75fa0c8b467dcea2cccc637d034) Thanks [@handeyeco](https://github.com/handeyeco)! - Fix some file-wide error suppressions

* [#1863](https://github.com/Khan/perseus/pull/1863) [`584153588`](https://github.com/Khan/perseus/commit/584153588be04c6deb7b5d76ed2b258d0f75a3e1) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Switch two corner usages of deprecated @khanacademy/wonder-blocks-spacing to @khanacademy/wonder-blocks-tokens

* Updated dependencies [[`3dbca965a`](https://github.com/Khan/perseus/commit/3dbca965a2bbaa2d980c1cc4c439469157e0bd33), [`ee09e9fc0`](https://github.com/Khan/perseus/commit/ee09e9fc0ad5eb65340d0f1cbe240741ebfcd3c3), [`3a9b5921b`](https://github.com/Khan/perseus/commit/3a9b5921bff7ae038f59ecb6817babd2b21df0bb), [`88ba71bef`](https://github.com/Khan/perseus/commit/88ba71bef0cdd75fa0c8b467dcea2cccc637d034), [`64ea2ee86`](https://github.com/Khan/perseus/commit/64ea2ee86264a20f1d0e34968831945fea8ed36b), [`451de899f`](https://github.com/Khan/perseus/commit/451de899fd3d40bf415cb2318048e90fb1e6670f), [`40d2ebb75`](https://github.com/Khan/perseus/commit/40d2ebb75fdadfb361330236e0fb9e54a32d0fc2), [`799ffe4a5`](https://github.com/Khan/perseus/commit/799ffe4a50e3e3bc435d0ef96388c1e8fae2167d), [`2437ce61b`](https://github.com/Khan/perseus/commit/2437ce61bae1aef2db28e89956aa73463ada16cc), [`841551a65`](https://github.com/Khan/perseus/commit/841551a65732a276266690ddaaa51a3810398d03), [`8ec06f444`](https://github.com/Khan/perseus/commit/8ec06f444d8f4559eda5c3dbf189e5183b1c5b42), [`f43edd42c`](https://github.com/Khan/perseus/commit/f43edd42ccfacd1500d2f73ccb0d3f8dce777173), [`0cec7628c`](https://github.com/Khan/perseus/commit/0cec7628c4a061f14b126fd1e3dab6df45fc0178), [`0bd4270ad`](https://github.com/Khan/perseus/commit/0bd4270ade576bec1ac0c86b251f972a2c354056), [`3e98b7cd3`](https://github.com/Khan/perseus/commit/3e98b7cd300052eeacbe9fcdbd312091c678107b), [`7f2866cf4`](https://github.com/Khan/perseus/commit/7f2866cf401aa4fc7a3b2b15d8cdc247a953e9f8)]:
- @khanacademy/perseus@43.1.0
- @khanacademy/kas@0.4.2
- @khanacademy/pure-markdown@0.3.13

## 15.0.1

### Patch Changes

- [#1874](https://github.com/Khan/perseus/pull/1874) [`42d25c2d2`](https://github.com/Khan/perseus/commit/42d25c2d2d844d6408d76b07794f171d962b91a7) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Figure Aria] Fix \$ edge cases for spoken math aria labels

* [#1912](https://github.com/Khan/perseus/pull/1912) [`44e78a95d`](https://github.com/Khan/perseus/commit/44e78a95dc1f0d2d4a16794feb590d05df0f2e0a) Thanks [@nishasy](https://github.com/nishasy)! - [Interactive Graph Editor] Stop cursor jumps in number input fields

- [#1875](https://github.com/Khan/perseus/pull/1875) [`28cae9d2a`](https://github.com/Khan/perseus/commit/28cae9d2afe65e1345906de8106d349c93ddb97c) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Labels] Count lone unescaped \$ as regular dollar signs in TeX

- Updated dependencies [[`56fd44806`](https://github.com/Khan/perseus/commit/56fd448063b2e13c5e9cb9e1874c12494c6f0e34), [`01edfb8be`](https://github.com/Khan/perseus/commit/01edfb8be849f869c26ada923e275648780d36f3), [`28cae9d2a`](https://github.com/Khan/perseus/commit/28cae9d2afe65e1345906de8106d349c93ddb97c)]:
- @khanacademy/perseus@43.0.1

## 15.0.0

### Major Changes

- [#1905](https://github.com/Khan/perseus/pull/1905) [`9c225f936`](https://github.com/Khan/perseus/commit/9c225f9365cbb2e92bba3bd67b1abde724809367) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - We're reverting work done for the Server Side Scoring and Input Number Conversion projects.

### Patch Changes

- [#1889](https://github.com/Khan/perseus/pull/1889) [`55a532175`](https://github.com/Khan/perseus/commit/55a532175192bfee3dc550c7eb7ce74d4a6542a9) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters

- Updated dependencies [[`adad642ab`](https://github.com/Khan/perseus/commit/adad642ab0ae95de6600e7018f0aff836acc5911), [`0afb1a4f7`](https://github.com/Khan/perseus/commit/0afb1a4f70e35de7e2b04ee1af835a0ebe84bbe5), [`55a532175`](https://github.com/Khan/perseus/commit/55a532175192bfee3dc550c7eb7ce74d4a6542a9), [`9c225f936`](https://github.com/Khan/perseus/commit/9c225f9365cbb2e92bba3bd67b1abde724809367), [`4b8836b84`](https://github.com/Khan/perseus/commit/4b8836b846c4f6adc6f4bb9c204deedb019c9f51), [`a27f23bb4`](https://github.com/Khan/perseus/commit/a27f23bb48e585aa2229975b1779161b921cbd9d)]:
- @khanacademy/perseus@43.0.0
- @khanacademy/kas@0.4.1
- @khanacademy/math-input@21.1.5
- @khanacademy/pure-markdown@0.3.12

## 14.12.4

### Patch Changes
Expand Down
10 changes: 5 additions & 5 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": "14.12.4",
"version": "15.0.2",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -34,13 +34,13 @@
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
},
"dependencies": {
"@khanacademy/kas": "^0.4.0",
"@khanacademy/kas": "^0.4.2",
"@khanacademy/keypad-context": "^1.0.4",
"@khanacademy/kmath": "^0.1.16",
"@khanacademy/math-input": "^21.1.4",
"@khanacademy/perseus": "^42.0.3",
"@khanacademy/math-input": "^21.1.5",
"@khanacademy/perseus": "^43.1.0",
"@khanacademy/perseus-core": "1.5.3",
"@khanacademy/pure-markdown": "^0.3.11",
"@khanacademy/pure-markdown": "^0.3.13",
"mafs": "^0.19.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 837b56f

Please sign in to comment.