Skip to content

Commit

Permalink
Merge branch 'main' into sr-circle
Browse files Browse the repository at this point in the history
  • Loading branch information
nishasy committed Dec 5, 2024
2 parents 9fcc4cd + 22faad9 commit 19a34b2
Show file tree
Hide file tree
Showing 238 changed files with 10,177 additions and 5,767 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-chefs-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

TypeScript fixes
5 changes: 5 additions & 0 deletions .changeset/chilled-cameras-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Refactor internally used object mapping utilities to use ES6 exports
5 changes: 0 additions & 5 deletions .changeset/chilled-turtles-drive.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/early-phones-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

Type fixes
5 changes: 5 additions & 0 deletions .changeset/hip-pandas-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Ensure that zoomed-in images retain alt text
5 changes: 5 additions & 0 deletions .changeset/large-melons-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

Ensure links opening to style guide (Google Docs) set `rel="noreferrer"`
5 changes: 0 additions & 5 deletions .changeset/lazy-geckos-suffer.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: 5 additions & 0 deletions .changeset/mean-fans-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Minor refactoring of ServerItemRenderer's componentDidUpdate to reduce duplication
5 changes: 5 additions & 0 deletions .changeset/metal-readers-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Refactor scoring for `group` widget to follow the same pattern as all other widgets
5 changes: 5 additions & 0 deletions .changeset/odd-moons-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

[Numeric Input] - Associate format options tooltip content with input field for assistive technologies
5 changes: 0 additions & 5 deletions .changeset/rotten-peaches-move.md

This file was deleted.

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

Add global styles to reflect prod styling
5 changes: 5 additions & 0 deletions .changeset/smooth-taxis-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Internal: convert backgroundImage dimensions to numbers during parsing.
5 changes: 5 additions & 0 deletions .changeset/stupid-apricots-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

Remove debugging call in GraphSettings component
5 changes: 5 additions & 0 deletions .changeset/sweet-ligers-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

Introduces a validation function for the number line widget (extracted from the scoring function).
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/tender-planets-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

Changes the PerseusWidgetsMap to be extensible so that widgets can be registered outside of Perseus and still have full type safety.
5 changes: 5 additions & 0 deletions .changeset/tiny-feet-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Internal: add and pass regression tests for PerseusItem parser's handling of legacy data
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: 0 additions & 5 deletions .changeset/yellow-ducks-march.md

This file was deleted.

9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function banImportExtension(extension) {
module.exports = {
extends: [
"@khanacademy",
"plugin:react/recommended",
// This config includes rules from storybook to enforce story best
// practices
"plugin:storybook/recommended",
Expand Down Expand Up @@ -172,6 +173,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 Expand Up @@ -303,6 +309,9 @@ module.exports = {
/**
* react
*/
"react/no-string-refs": "off", // on in react/recommended, but we have #legacy-code
"react/no-find-dom-node": "off", // on in react/recommended, but we have #legacy-code
"react/display-name": "off", // on in react/recommended, but doesn't seem that useful to fix
// This rule results in false-positives when using some types of React
// components (such as functional components or hooks). Since
// TypeScript is already checking that components are only using props
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-*"
3 changes: 3 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ jobs:
projectToken: ${{ secrets.CHROMATIC_APP_CODE }}
autoAcceptChanges: "main"
onlyStoryFiles: "**/*regression.stories.tsx"
# NOTE: We cannot enable `onlyChanged` because it is
# incompatible with `onlyStoryFiles` which we use above.
# onlyChanged: true # Enable TurboSnap!
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
16 changes: 15 additions & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ const preview: Preview = {
(Story) => (
<RenderStateRoot>
<DependenciesContext.Provider value={storybookDependenciesV2}>
<Story />
{/* Most of our components have an expectation to be
rendered inside of a .framework-perseus container.
We want to make sure we can include it here, since it
can also affect the styling.
Inclue box-sizing-border-box-reset to reflect
the global styles from prod.
*/}
<div className="framework-perseus box-sizing-border-box-reset">
<Story />
</div>
</DependenciesContext.Provider>
</RenderStateRoot>
),
Expand Down Expand Up @@ -60,6 +70,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
26 changes: 26 additions & 0 deletions dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# @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
Expand Down
11 changes: 10 additions & 1 deletion dev/flipbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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 @@ -319,7 +320,15 @@ function GradableRenderer(props: QuestionRendererProps) {
leftContent={
<Button
onClick={() => {
setScore(rendererRef.current?.score());
if (rendererRef.current) {
const score = scorePerseusItem(
question,
rendererRef.current.getUserInputMap(),
mockStrings,
"en",
);
setScore(score);
}
clearScoreTimeout.set();
}}
>
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": "4.0.0",
"version": "4.0.3",
"private": true,
"repository": {
"type": "git",
Expand All @@ -14,13 +14,13 @@
"dev": "vite"
},
"dependencies": {
"@khanacademy/kas": "^0.4.1",
"@khanacademy/kas": "^0.4.2",
"@khanacademy/kmath": "^0.1.16",
"@khanacademy/math-input": "^21.1.5",
"@khanacademy/math-input": "^21.1.6",
"@khanacademy/perseus-core": "1.5.3",
"@khanacademy/perseus-linter": "^1.2.4",
"@khanacademy/pure-markdown": "^0.3.12",
"@khanacademy/simple-markdown": "^0.13.5",
"@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
Loading

0 comments on commit 19a34b2

Please sign in to comment.