Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fitzgerald committed Dec 3, 2024
2 parents d08b48d + 763a4ba commit 98c5038
Show file tree
Hide file tree
Showing 285 changed files with 10,761 additions and 6,568 deletions.
5 changes: 0 additions & 5 deletions .changeset/late-sheep-rush.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/many-keys-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

[Numeric Input] - Show format options as a list
5 changes: 0 additions & 5 deletions .changeset/mean-pens-grow.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/modern-boats-wash.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/tall-pianos-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Improve comments on some Perseus types
5 changes: 5 additions & 0 deletions .changeset/two-turtles-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

[Numeric Input] - Update the UI to match Expression widget
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-*"
17 changes: 0 additions & 17 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import turbosnap from "vite-plugin-turbosnap";
import viteConfig from "../dev/vite.config";
import {mergeConfig} from "vite";

Expand Down Expand Up @@ -54,24 +53,8 @@ const config: StorybookConfig = {
},
// Fix from: https://github.com/storybookjs/storybook/issues/25256#issuecomment-1866441206
assetsInclude: ["/sb-preview/runtime.js"],
plugins:
configType === "PRODUCTION"
? [
turbosnap({
// This should be the base path of your storybook. In monorepos, you may only need process.cwd().
rootDir: config.root ?? process.cwd(),
}),
]
: [],
});
},

typescript: {
reactDocgen: "react-docgen",
},
docs: {
autodocs: true,
},
staticDirs: ["../static"],
};

Expand Down
4 changes: 4 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ const preview: Preview = {
})),
},
},
tags: [
//👇 Enables auto-generated documentation for all stories
"autodocs",
],
};

export default preview;
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
40 changes: 40 additions & 0 deletions dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# @khanacademy/perseus-dev-ui

## 4.0.3

### Patch Changes

- [#1910](https://github.com/Khan/perseus/pull/1910) [`0a44d468d`](https://github.com/Khan/perseus/commit/0a44d468dd127bf15dc32e720b9b0301af41a572) Thanks [@handeyeco](https://github.com/handeyeco)! - Change ServerItemRenderer scoring APIs to externalize scoring

## 4.0.2

### Patch Changes

- [#1904](https://github.com/Khan/perseus/pull/1904) [`83b1beab8`](https://github.com/Khan/perseus/commit/83b1beab86dd9e7ee1e1760c4fad4be9f2ff5a71) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - Upgrade Storybook to v8.x

* [#1904](https://github.com/Khan/perseus/pull/1904) [`83b1beab8`](https://github.com/Khan/perseus/commit/83b1beab86dd9e7ee1e1760c4fad4be9f2ff5a71) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - Upgrade Storybook to v8.x

* Updated dependencies [[`83b1beab8`](https://github.com/Khan/perseus/commit/83b1beab86dd9e7ee1e1760c4fad4be9f2ff5a71)]:
- @khanacademy/math-input@21.1.6

## 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
13 changes: 7 additions & 6 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.3",
"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.6",
"@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 All @@ -34,6 +34,7 @@
"@phosphor-icons/core": "^2.0.2"
},
"devDependencies": {
"vite": "^5.1.0"
"vite": "^5.1.0",
"@vitejs/plugin-react": "^4.3.3"
}
}
2 changes: 2 additions & 0 deletions dev/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from "node:fs";
import {resolve, dirname, join} from "node:path";

import react from "@vitejs/plugin-react";
import glob from "fast-glob";
import {defineConfig} from "vite";

Expand All @@ -20,6 +21,7 @@ export default defineConfig({
// Dev/Storybook environment.
"process.env.STORYBOOK": JSON.stringify(true),
},
plugins: [react({jsxRuntime: "automatic"})],
resolve: {
alias: {
hubble: resolve(__dirname, "../vendor/hubble/hubble.js"),
Expand Down
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"engines": {
"node": ">=20"
},
"dependencies": {
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/eslint-parser": "^7.22.15",
"@babel/eslint-plugin": "^7.22.10",
Expand All @@ -40,14 +40,14 @@
"@rollup/plugin-node-resolve": "^13.2.1",
"@rollup/plugin-replace": "^4.0.0",
"@sheerun/mutationobserver-shim": "^0.3.3",
"@storybook/addon-a11y": "^7.6.17",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-controls": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-links": "^7.6.17",
"@storybook/addon-viewport": "^7.6.17",
"@storybook/react": "^7.6.17",
"@storybook/react-vite": "^7.6.17",
"@storybook/addon-a11y": "^8.4.5",
"@storybook/addon-actions": "^8.4.5",
"@storybook/addon-controls": "^8.4.5",
"@storybook/addon-essentials": "^8.4.5",
"@storybook/addon-links": "^8.4.5",
"@storybook/addon-viewport": "^8.4.5",
"@storybook/react": "^8.4.5",
"@storybook/react-vite": "^8.4.5",
"@swc-node/register": "^1.6.6",
"@swc/core": "^1.3.68",
"@testing-library/dom": "^10.3.1",
Expand Down Expand Up @@ -117,13 +117,12 @@
"rollup-plugin-preserve-shebangs": "^0.2.0",
"rollup-plugin-styles": "^4.0.0",
"sloc": "^0.2.1",
"storybook": "^7.6.17",
"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",
"vite-plugin-turbosnap": "^1.0.3",
"winston": "^3.7.2"
},
"scripts": {
Expand All @@ -143,7 +142,7 @@
"test": "jest",
"storybook": "storybook dev -p 6006",
"start": "storybook dev -p 6006",
"build-storybook": "storybook build",
"build-storybook": "storybook build --stats-json",
"cypress": "cypress open --component",
"cypress:ci": "cross-env cypress run --component",
"format": "prettier --write .",
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
12 changes: 12 additions & 0 deletions packages/math-input/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @khanacademy/math-input

## 21.1.6

### Patch Changes

- [#1904](https://github.com/Khan/perseus/pull/1904) [`83b1beab8`](https://github.com/Khan/perseus/commit/83b1beab86dd9e7ee1e1760c4fad4be9f2ff5a71) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - Upgrade Storybook to v8.x

## 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.6",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 98c5038

Please sign in to comment.