[ Interactive Graph | Vector Graph ] PR2: State Management#3434
[ Interactive Graph | Vector Graph ] PR2: State Management#3434SonicScrewdriver merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
🗄️ Schema Change: No Changes ✅ |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (046eb1c) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3434If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3434If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3434 |
🛠️ Item Splitting: No Changes ✅ |
|
Size Change: +88 B (+0.02%) Total Size: 499 kB 📦 View Changed
ℹ️ View Unchanged
|
cd4b7ce to
68ae5c4
Compare
fbb7178 to
705a8e0
Compare
5726e2e to
de186e6
Compare
705a8e0 to
86a5da9
Compare
86a5da9 to
da4b606
Compare
There was a problem hiding this comment.
Wow this file is really getting longer 😢 I almost got confused on the diff 🙈
No action required here for now. I'm just thinking if we want to move the functions to a reducer-utils/doMoveLine.ts and reducer-utiles/* 🤔
There was a problem hiding this comment.
That'd be a great ticket imo! Maybe we can do a holistic review after we've made all the graphs, and do a little refactoring / re-organization. :)
de186e6 to
ea67f91
Compare
c6ebc40 to
ad02a65
Compare
ad02a65 to
724d32f
Compare
724d32f to
046eb1c
Compare
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/perseus-core@25.0.0 ### Major Changes - [#3511](#3511) [`15b0193db5`](15b0193) Thanks [@benchristel](https://github.com/benchristel)! - Remove unused `static` field from PerseusCSProgramWidgetOptions. Callers should update test data that constructs `PerseusCSProgramWidgetOptions` to remove the static field. ### Minor Changes - [#3441](#3441) [`de45286302`](de45286) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new Vector graph and subcomponents. - [#3433](#3433) [`b4bb6e2f42`](b4bb6e2) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of initial types and stubs for Vector graph ### Patch Changes - [#3434](#3434) [`de2dda0258`](de2dda0) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Implementation of state management logic for new Vector graph - Updated dependencies \[[`a5b9105c28`](a5b9105)]: - @khanacademy/kas@2.2.2 ## @khanacademy/perseus@77.3.0 ### Minor Changes - [#3441](#3441) [`de45286302`](de45286) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new Vector graph and subcomponents. - [#3433](#3433) [`b4bb6e2f42`](b4bb6e2) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of initial types and stubs for Vector graph - [#3494](#3494) [`8fb79829d0`](8fb7982) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Interactive Graph: change asymptote line to dashed for both exponential and logarithm based on user feedback ### Patch Changes - [#3523](#3523) [`c89cdbe2aa`](c89cdbe) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Ensure the default coords for Exponential and Logarithm are slightly further away from the asymptote. - [#3508](#3508) [`16f7f77ba1`](16f7f77) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (CX) | Give explore modal launcher a label saying it has description - [#3496](#3496) [`4d923417cd`](4d92341) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Add fallback label to Numeric Inputs and a linter warning for missing labels in the editor. - [#3511](#3511) [`15b0193db5`](15b0193) Thanks [@benchristel](https://github.com/benchristel)! - Remove unused `static` field from PerseusCSProgramWidgetOptions. Callers should update test data that constructs `PerseusCSProgramWidgetOptions` to remove the static field. - [#3504](#3504) [`b8178b52e7`](b8178b5) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (a11y) | Add aria-describedby to Explore Image modal - [#3488](#3488) [`3abc5e8277`](3abc5e8) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - [Free Response] Add visual regression tests - [#3493](#3493) [`11742c2cff`](11742c2) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Implementing bug fix for jumping MovableLines in the Correct Answer graph in the editor - [#3483](#3483) [`7794943ec7`](7794943) Thanks [@nishasy](https://github.com/nishasy)! - [ColorSync] Numeric Input - update visual regression tests - [#3434](#3434) [`de2dda0258`](de2dda0) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Implementation of state management logic for new Vector graph - Updated dependencies \[[`de45286302`](de45286), [`4d923417cd`](4d92341), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`d3ef4dbcc2`](d3ef4db), [`a5b9105c28`](a5b9105), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 - @khanacademy/perseus-linter@4.9.5 - @khanacademy/perseus-score@8.7.0 - @khanacademy/kas@2.2.2 - @khanacademy/keypad-context@3.2.44 - @khanacademy/kmath@2.4.2 - @khanacademy/math-input@26.4.15 ## @khanacademy/perseus-editor@30.4.0 ### Minor Changes - [#3441](#3441) [`de45286302`](de45286) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new Vector graph and subcomponents. - [#3443](#3443) [`a3396604a7`](a339660) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new Vector Graph Editor - [#3433](#3433) [`b4bb6e2f42`](b4bb6e2) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of initial types and stubs for Vector graph - [#3492](#3492) [`883133a28f`](883133a) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Add preview data sanitizer to strip non-serializable values before postMessage ### Patch Changes - [#3522](#3522) [`19911cc966`](19911cc) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Label absolute-value graph start coordinates as "Vertex" and "Arm" in the editor instead of "Point 1" and "Point 2". - [#3505](#3505) [`1ab914fc41`](1ab914f) Thanks [@nishasy](https://github.com/nishasy)! - [Image] | (CX) | Add warning for large images - [#3530](#3530) [`b5e918e8b3`](b5e918e) Thanks [@nishasy](https://github.com/nishasy)! - [Image] Update copy of recalculate button in editor - [#3434](#3434) [`de2dda0258`](de2dda0) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Implementation of state management logic for new Vector graph - Updated dependencies \[[`de45286302`](de45286), [`c89cdbe2aa`](c89cdbe), [`16f7f77ba1`](16f7f77), [`4d923417cd`](4d92341), [`15b0193db5`](15b0193), [`b8178b52e7`](b8178b5), [`b4bb6e2f42`](b4bb6e2), [`d3ef4dbcc2`](d3ef4db), [`3abc5e8277`](3abc5e8), [`a5b9105c28`](a5b9105), [`11742c2cff`](11742c2), [`7794943ec7`](7794943), [`de2dda0258`](de2dda0), [`8fb79829d0`](8fb7982)]: - @khanacademy/perseus@77.3.0 - @khanacademy/perseus-core@25.0.0 - @khanacademy/perseus-linter@4.9.5 - @khanacademy/perseus-score@8.7.0 - @khanacademy/kas@2.2.2 - @khanacademy/keypad-context@3.2.44 - @khanacademy/kmath@2.4.2 - @khanacademy/math-input@26.4.15 ## @khanacademy/perseus-score@8.7.0 ### Minor Changes - [#3442](#3442) [`d3ef4dbcc2`](d3ef4db) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Added ability to score Vector Interactive Graphs ### Patch Changes - Updated dependencies \[[`de45286302`](de45286), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`a5b9105c28`](a5b9105), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 - @khanacademy/kas@2.2.2 - @khanacademy/kmath@2.4.2 ## @khanacademy/kas@2.2.2 ### Patch Changes - [#3503](#3503) [`a5b9105c28`](a5b9105) Thanks [@benchristel](https://github.com/benchristel)! - Expressions are now compared more thoroughly. Now we always check that the expressions evaluate the same with all variables bound to -1, 0, and 1. We also check more randomly-chosen values: 28 instead of 12. ## @khanacademy/keypad-context@3.2.44 ### Patch Changes - Updated dependencies \[[`de45286302`](de45286), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 ## @khanacademy/kmath@2.4.2 ### Patch Changes - Updated dependencies \[[`de45286302`](de45286), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 ## @khanacademy/math-input@26.4.15 ### Patch Changes - Updated dependencies \[[`de45286302`](de45286), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 - @khanacademy/keypad-context@3.2.44 ## @khanacademy/perseus-linter@4.9.5 ### Patch Changes - [#3496](#3496) [`4d923417cd`](4d92341) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Add fallback label to Numeric Inputs and a linter warning for missing labels in the editor. - Updated dependencies \[[`de45286302`](de45286), [`15b0193db5`](15b0193), [`b4bb6e2f42`](b4bb6e2), [`a5b9105c28`](a5b9105), [`de2dda0258`](de2dda0)]: - @khanacademy/perseus-core@25.0.0 - @khanacademy/kas@2.2.2 - @khanacademy/kmath@2.4.2
Summary
This PR was created with the help of AI, albeit with heavy oversight and review.
This is part of a series of PRs implementing the vector graph type for the Interactive Graph widget:
PR1 – type definitions and schema
▶️ PR2 – state management (this PR)
PR3 – rendering & accessibility
PR4 – scoring
PR5 – editor support
Issue: LEMS-3971
Changes:
vector: { moveTip, moveVector }to the actions object.moveTipdispatchesmovePoint(1, destination)for the tip (the only draggable point).moveVectordispatchesmoveLine(0, delta)for body translation.case "vector". Adds and exportsgetVectorCoords()with the standard three-path fallback: explicit coords → startCoords → normalized defaults. Default is a horizontal vector from [-5, 0] to [5, 0].doMovePoint(snap to grid, enforce bounds, reject if tip would overlap with tail). Adds"vector"to the existingdoMoveLinecase alongside"linear"/"ray"for body translation.getGradableGraph()branch for vector (coords passthrough, same shape as ray).withVector()builder method andVectorGraphConfigclass (matchesRayGraphConfigpattern).generateIGVectorGraph()generator function (new pattern, replacing builder long-term).generateIGVectorGraph.getVectorCoords.vectorQuestionandvectorQuestionWithDefaultCorrecttest fixtures.Test plan:
pnpm tsc— no new type errorspnpm test packages/perseus/src/widgets/interactive-graphs/reducer/— 143 tests pass, including 9 new vector tests: