Skip to content

[ Interactive Graph | Vector Graph ] PR1: Type Definitions and Schema#3433

Merged
SonicScrewdriver merged 4 commits intomainfrom
LEMS-3971/vector-pr1
Apr 27, 2026
Merged

[ Interactive Graph | Vector Graph ] PR1: Type Definitions and Schema#3433
SonicScrewdriver merged 4 commits intomainfrom
LEMS-3971/vector-pr1

Conversation

@SonicScrewdriver
Copy link
Copy Markdown
Contributor

@SonicScrewdriver SonicScrewdriver commented Mar 31, 2026

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 (this PR)
PR2 – state management
PR3 – rendering & accessibility
PR4 – scoring
PR5 – editor support

Issue: LEMS-3971

  • Added type definitions and schema for the vector graph type
  • Added the foundational type scaffolding needed to support a vector graph in the Interactive Graph widget. This is a pure additive change — no runtime behavior is altered and all existing tests continue to pass.

Changes:

  • data-schema.ts — Adds PerseusGraphTypeVector (type: "vector", coords: CollinearTuple | null, startCoords: CollinearTuple) and VectorGraphCorrect, and includes both in the PerseusGraphType and PerseusGraphCorrectType unions. The shape matches PerseusGraphTypeRay — two coordinates representing tail and tip.
  • interactive-graph-widget.ts — Adds parsePerseusGraphTypeVector and registers it with parsePerseusGraphType so the new type round-trips through the parser.
  • types.ts — Adds VectorGraphState (type: "vector", coords: PairOfPoints) and adds it to the InteractiveGraphState union.
  • Stubs out "vector" cases with throw new Error("Not implemented") in renderGraphElements (mafs-graph.tsx) and initializeGraphState (initialize-graph-state.ts), and returns "" in getEquationString (interactive-graph.tsx) to keep TypeScript exhaustiveness errors clear until subsequent PRs fill in the implementation.
  • Adds "vector" to the mergeGraphs switch (interactive-graph-editor.tsx) and shouldShowStartCoordsUI (util.ts) to satisfy exhaustiveness checks in the editor.
  • Adds "vector" cases in interactive-graph-ai-utils.ts (getGraphOptionsForProps and getUserInput), mafs-state-to-interactive-graph.ts (serialization), and interactive-graph-reducer.ts (movePointInFigure guard) for exhaustiveness.

Test plan:

  • pnpm tsc — no new type errors
  • pnpm lint — no lint errors
  • No existing interactive graph tests regress

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the schema-change Attached to PRs when we detect Perseus Schema changes in it label Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

🗄️ Schema Change: Changes Detected ⚠️

Usually this means you need to update the Go parser
that Content Platform maintains!!!

Follow these steps on how to release.
See this list of post-mortems for more information.

This PR contains critical changes to Perseus that affect published data.
Please review the changes and note that you may need to
coordinate deployment of these changes with other teams
at Khan Academy, especially with #cp-eng to publish a
content update.

diff --unified /home/github/work/_temp/branch-compare/base/schema.d.ts /home/github/work/_temp/branch-compare/pr/schema.d.ts
--- /home/github/work/_temp/branch-compare/base/schema.d.ts	2026-04-16 22:14:01.877603699 +0000
+++ /home/github/work/_temp/branch-compare/pr/schema.d.ts	2026-04-16 22:13:46.497604295 +0000
@@ -649,7 +649,8 @@
     | PerseusGraphTypeSinusoid
     | PerseusGraphTypeExponential
     | PerseusGraphTypeTangent
-    | PerseusGraphTypeLogarithm;
+    | PerseusGraphTypeLogarithm
+    | PerseusGraphTypeVector;
   export type PerseusGraphTypeAngle = {
     type: "angle";
     showAngles?: boolean;
@@ -748,6 +749,12 @@
     coords?: CollinearTuple | null;
     startCoords?: CollinearTuple;
   };
+  export type PerseusGraphTypeVector = {
+    type: "vector";
+    coords?: CollinearTuple | null;
+    startCoords?: CollinearTuple;
+    match?: "exact" | "congruent";
+  };
   type AbsoluteValueGraphCorrect = {
     type: "absolute-value";
     coords: [Coord, Coord];
@@ -813,6 +820,11 @@
     type: "ray";
     coords: CollinearTuple;
   };
+  type VectorGraphCorrect = {
+    type: "vector";
+    coords: CollinearTuple;
+    match?: "exact" | "congruent";
+  };
   export type PerseusGraphCorrectType =
     | AbsoluteValueGraphCorrect
     | AngleGraphCorrect
@@ -828,7 +840,8 @@
     | SinusoidGraphCorrect
     | ExponentialGraphCorrect
     | TangentGraphCorrect
-    | LogarithmGraphCorrect;
+    | LogarithmGraphCorrect
+    | VectorGraphCorrect;
   export type PerseusLabelImageWidgetOptions = {
     choices: string[];
     imageUrl: string;

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

Size Change: +155 B (+0.03%)

Total Size: 499 kB

📦 View Changed
Filename Size Change
packages/perseus-core/dist/es/index.item-splitting.js 12 kB +40 B (+0.34%)
packages/perseus-core/dist/es/index.js 25.2 kB +40 B (+0.16%)
packages/perseus-editor/dist/es/index.js 102 kB +10 B (+0.01%)
packages/perseus/dist/es/index.js 196 kB +65 B (+0.03%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.5 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.36 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-linter/dist/es/index.js 9.3 kB
packages/perseus-score/dist/es/index.js 9.7 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 8.27 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

🛠️ Item Splitting: Changes Detected ⚠️

Usually this means you need to update the Go parser
that Content Platform maintains!!!

Follow these steps on how to release.
See this list of post-mortems for more information.

This PR contains critical changes to Perseus that affect published data.
Please review the changes and note that you may need to
coordinate deployment of these changes with other teams
at Khan Academy, especially with #cp-eng to publish a
content update.

diff --unified /home/github/work/_temp/branch-compare/base/index.item-splitting.js /home/github/work/_temp/branch-compare/pr/index.item-splitting.js
--- /home/github/work/_temp/branch-compare/base/index.item-splitting.js	2026-04-16 22:14:26.514014569 +0000
+++ /home/github/work/_temp/branch-compare/pr/index.item-splitting.js	2026-04-16 22:13:58.386013975 +0000
@@ -100,7 +100,7 @@
 
 const lockedFigureColorNames=["blue","green","grayH","purple","pink","orange","red"];const plotterPlotTypes=["bar","line","pic","histogram","dotplot"];
 
-const pairOfNumbers=pair(number,number);const parsePerseusGraphTypeAngle=object({type:constant("angle"),showAngles:optional(boolean),allowReflexAngles:optional(boolean),angleOffsetDeg:optional(number),snapDegrees:optional(number),match:optional(constant("congruent")),coords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeCircle=object({type:constant("circle"),center:optional(pairOfNumbers),radius:optional(number),startCoords:optional(object({center:pairOfNumbers,radius:number}))});const parsePerseusGraphTypeLinear=object({type:constant("linear"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeLinearSystem=object({type:constant("linear-system"),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeNone=object({type:constant("none")});const parsePerseusGraphTypePoint=object({type:constant("point"),numPoints:optional(union(number).or(constant("unlimited")).parser),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),coord:optional(pairOfNumbers)});const parsePerseusGraphTypePolygon=object({type:constant("polygon"),numSides:optional(union(number).or(constant("unlimited")).parser),showAngles:optional(boolean),showSides:optional(boolean),snapTo:optional(enumeration("grid","angles","sides")),match:optional(enumeration("similar","congruent","approx","exact")),startCoords:optional(array(pairOfNumbers)),coords:optional(nullable(array(pairOfNumbers)))});const parsePerseusGraphTypeQuadratic=object({type:constant("quadratic"),coords:optional(nullable(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeRay=object({type:constant("ray"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeSegment=object({type:constant("segment"),numSegments:optional(number),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeSinusoid=object({type:constant("sinusoid"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeExponential=object({type:constant("exponential"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphTypeAbsoluteValue=object({type:constant("absolute-value"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeTangent=object({type:constant("tangent"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeLogarithm=object({type:constant("logarithm"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphType=discriminatedUnionOn("type").withBranch("absolute-value",parsePerseusGraphTypeAbsoluteValue).withBranch("angle",parsePerseusGraphTypeAngle).withBranch("circle",parsePerseusGraphTypeCircle).withBranch("exponential",parsePerseusGraphTypeExponential).withBranch("linear",parsePerseusGraphTypeLinear).withBranch("linear-system",parsePerseusGraphTypeLinearSystem).withBranch("none",parsePerseusGraphTypeNone).withBranch("point",parsePerseusGraphTypePoint).withBranch("polygon",parsePerseusGraphTypePolygon).withBranch("quadratic",parsePerseusGraphTypeQuadratic).withBranch("ray",parsePerseusGraphTypeRay).withBranch("segment",parsePerseusGraphTypeSegment).withBranch("sinusoid",parsePerseusGraphTypeSinusoid).withBranch("tangent",parsePerseusGraphTypeTangent).withBranch("logarithm",parsePerseusGraphTypeLogarithm).parser;const parseLockedFigureColor=enumeration(...lockedFigureColorNames);const parseLockedFigureFillType=enumeration("none","white","translucent","solid");const parseLockedLineStyle=enumeration("solid","dashed");const parseStrokeWeight=defaulted(enumeration("medium","thin","thick"),()=>"medium");const parseLockedLabelType=object({type:constant("label"),coord:pairOfNumbers,text:string,color:parseLockedFigureColor,size:enumeration("small","medium","large")});const parseLockedPointType=object({type:constant("point"),coord:pairOfNumbers,color:parseLockedFigureColor,filled:boolean,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedLineType=object({type:constant("line"),kind:enumeration("line","ray","segment"),points:pair(parseLockedPointType,parseLockedPointType),color:parseLockedFigureColor,lineStyle:parseLockedLineStyle,showPoint1:defaulted(boolean,()=>false),showPoint2:defaulted(boolean,()=>false),weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedVectorType=object({type:constant("vector"),points:pair(pairOfNumbers,pairOfNumbers),color:parseLockedFigureColor,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedEllipseType=object({type:constant("ellipse"),center:pairOfNumbers,radius:pairOfNumbers,angle:number,color:parseLockedFigureColor,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedPolygonType=object({type:constant("polygon"),points:array(pairOfNumbers),color:parseLockedFigureColor,showVertices:boolean,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFunctionDomain=defaulted(pair(defaulted(number,()=>-Infinity),defaulted(number,()=>Infinity)),()=>[-Infinity,Infinity]);const parseLockedFunctionType=object({type:constant("function"),color:parseLockedFigureColor,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,equation:string,directionalAxis:enumeration("x","y"),domain:parseLockedFunctionDomain,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFigure=discriminatedUnionOn("type").withBranch("point",parseLockedPointType).withBranch("line",parseLockedLineType).withBranch("vector",parseLockedVectorType).withBranch("ellipse",parseLockedEllipseType).withBranch("polygon",parseLockedPolygonType).withBranch("function",parseLockedFunctionType).withBranch("label",parseLockedLabelType).parser;const parseLabelLocation=union(enumeration("onAxis","alongEdge")).or(pipeParsers(constant("")).then(convert(()=>"onAxis")).parser).parser;const parseInteractiveGraphWidget=parseWidget(constant("interactive-graph"),object({step:pairOfNumbers,gridStep:optional(pairOfNumbers),snapStep:optional(pairOfNumbers),backgroundImage:optional(parsePerseusImageBackground),markings:enumeration("graph","grid","none","axes"),labels:optional(array(string)),labelLocation:optional(parseLabelLocation),showProtractor:boolean,showRuler:optional(boolean),showTooltips:optional(boolean),rulerLabel:optional(string),rulerTicks:optional(number),range:pair(pairOfNumbers,pairOfNumbers),showAxisArrows:defaulted(object({xMin:boolean,xMax:boolean,yMin:boolean,yMax:boolean}),()=>({xMin:true,xMax:true,yMin:true,yMax:true})),graph:defaulted(parsePerseusGraphType,()=>({type:"linear"})),correct:defaulted(parsePerseusGraphType,()=>({type:"linear"})),lockedFigures:defaulted(array(parseLockedFigure),()=>[]),fullGraphAriaLabel:optional(string),fullGraphAriaDescription:optional(string)}));
+const pairOfNumbers=pair(number,number);const parsePerseusGraphTypeAngle=object({type:constant("angle"),showAngles:optional(boolean),allowReflexAngles:optional(boolean),angleOffsetDeg:optional(number),snapDegrees:optional(number),match:optional(constant("congruent")),coords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers)),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeCircle=object({type:constant("circle"),center:optional(pairOfNumbers),radius:optional(number),startCoords:optional(object({center:pairOfNumbers,radius:number}))});const parsePerseusGraphTypeLinear=object({type:constant("linear"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeLinearSystem=object({type:constant("linear-system"),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeNone=object({type:constant("none")});const parsePerseusGraphTypePoint=object({type:constant("point"),numPoints:optional(union(number).or(constant("unlimited")).parser),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers)),coord:optional(pairOfNumbers)});const parsePerseusGraphTypePolygon=object({type:constant("polygon"),numSides:optional(union(number).or(constant("unlimited")).parser),showAngles:optional(boolean),showSides:optional(boolean),snapTo:optional(enumeration("grid","angles","sides")),match:optional(enumeration("similar","congruent","approx","exact")),startCoords:optional(array(pairOfNumbers)),coords:optional(nullable(array(pairOfNumbers)))});const parsePerseusGraphTypeQuadratic=object({type:constant("quadratic"),coords:optional(nullable(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))),startCoords:optional(trio(pairOfNumbers,pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeRay=object({type:constant("ray"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeSegment=object({type:constant("segment"),numSegments:optional(number),coords:optional(nullable(array(pair(pairOfNumbers,pairOfNumbers)))),startCoords:optional(array(pair(pairOfNumbers,pairOfNumbers)))});const parsePerseusGraphTypeSinusoid=object({type:constant("sinusoid"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeExponential=object({type:constant("exponential"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphTypeAbsoluteValue=object({type:constant("absolute-value"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers))});const parsePerseusGraphTypeTangent=object({type:constant("tangent"),coords:optional(nullable(array(pairOfNumbers))),startCoords:optional(array(pairOfNumbers))});const parsePerseusGraphTypeLogarithm=object({type:constant("logarithm"),coords:optional(nullable(array(pairOfNumbers))),asymptote:optional(nullable(number)),startCoords:optional(object({coords:pair(pairOfNumbers,pairOfNumbers),asymptote:number}))});const parsePerseusGraphTypeVector=object({type:constant("vector"),coords:optional(nullable(pair(pairOfNumbers,pairOfNumbers))),startCoords:optional(pair(pairOfNumbers,pairOfNumbers)),match:optional(enumeration("exact","congruent"))});const parsePerseusGraphType=discriminatedUnionOn("type").withBranch("absolute-value",parsePerseusGraphTypeAbsoluteValue).withBranch("angle",parsePerseusGraphTypeAngle).withBranch("circle",parsePerseusGraphTypeCircle).withBranch("exponential",parsePerseusGraphTypeExponential).withBranch("linear",parsePerseusGraphTypeLinear).withBranch("linear-system",parsePerseusGraphTypeLinearSystem).withBranch("none",parsePerseusGraphTypeNone).withBranch("point",parsePerseusGraphTypePoint).withBranch("polygon",parsePerseusGraphTypePolygon).withBranch("quadratic",parsePerseusGraphTypeQuadratic).withBranch("ray",parsePerseusGraphTypeRay).withBranch("segment",parsePerseusGraphTypeSegment).withBranch("sinusoid",parsePerseusGraphTypeSinusoid).withBranch("tangent",parsePerseusGraphTypeTangent).withBranch("logarithm",parsePerseusGraphTypeLogarithm).withBranch("vector",parsePerseusGraphTypeVector).parser;const parseLockedFigureColor=enumeration(...lockedFigureColorNames);const parseLockedFigureFillType=enumeration("none","white","translucent","solid");const parseLockedLineStyle=enumeration("solid","dashed");const parseStrokeWeight=defaulted(enumeration("medium","thin","thick"),()=>"medium");const parseLockedLabelType=object({type:constant("label"),coord:pairOfNumbers,text:string,color:parseLockedFigureColor,size:enumeration("small","medium","large")});const parseLockedPointType=object({type:constant("point"),coord:pairOfNumbers,color:parseLockedFigureColor,filled:boolean,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedLineType=object({type:constant("line"),kind:enumeration("line","ray","segment"),points:pair(parseLockedPointType,parseLockedPointType),color:parseLockedFigureColor,lineStyle:parseLockedLineStyle,showPoint1:defaulted(boolean,()=>false),showPoint2:defaulted(boolean,()=>false),weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedVectorType=object({type:constant("vector"),points:pair(pairOfNumbers,pairOfNumbers),color:parseLockedFigureColor,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedEllipseType=object({type:constant("ellipse"),center:pairOfNumbers,radius:pairOfNumbers,angle:number,color:parseLockedFigureColor,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedPolygonType=object({type:constant("polygon"),points:array(pairOfNumbers),color:parseLockedFigureColor,showVertices:boolean,fillStyle:parseLockedFigureFillType,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFunctionDomain=defaulted(pair(defaulted(number,()=>-Infinity),defaulted(number,()=>Infinity)),()=>[-Infinity,Infinity]);const parseLockedFunctionType=object({type:constant("function"),color:parseLockedFigureColor,strokeStyle:parseLockedLineStyle,weight:parseStrokeWeight,equation:string,directionalAxis:enumeration("x","y"),domain:parseLockedFunctionDomain,labels:defaulted(array(parseLockedLabelType),()=>[]),ariaLabel:optional(string)});const parseLockedFigure=discriminatedUnionOn("type").withBranch("point",parseLockedPointType).withBranch("line",parseLockedLineType).withBranch("vector",parseLockedVectorType).withBranch("ellipse",parseLockedEllipseType).withBranch("polygon",parseLockedPolygonType).withBranch("function",parseLockedFunctionType).withBranch("label",parseLockedLabelType).parser;const parseLabelLocation=union(enumeration("onAxis","alongEdge")).or(pipeParsers(constant("")).then(convert(()=>"onAxis")).parser).parser;const parseInteractiveGraphWidget=parseWidget(constant("interactive-graph"),object({step:pairOfNumbers,gridStep:optional(pairOfNumbers),snapStep:optional(pairOfNumbers),backgroundImage:optional(parsePerseusImageBackground),markings:enumeration("graph","grid","none","axes"),labels:optional(array(string)),labelLocation:optional(parseLabelLocation),showProtractor:boolean,showRuler:optional(boolean),showTooltips:optional(boolean),rulerLabel:optional(string),rulerTicks:optional(number),range:pair(pairOfNumbers,pairOfNumbers),showAxisArrows:defaulted(object({xMin:boolean,xMax:boolean,yMin:boolean,yMax:boolean}),()=>({xMin:true,xMax:true,yMin:true,yMax:true})),graph:defaulted(parsePerseusGraphType,()=>({type:"linear"})),correct:defaulted(parsePerseusGraphType,()=>({type:"linear"})),lockedFigures:defaulted(array(parseLockedFigure),()=>[]),fullGraphAriaLabel:optional(string),fullGraphAriaDescription:optional(string)}));
 
 const parseLabelImageWidget=parseWidget(constant("label-image"),object({choices:array(string),imageUrl:string,imageAlt:string,imageHeight:number,imageWidth:number,markers:array(object({answers:defaulted(array(string),()=>[]),label:string,x:number,y:number})),hideChoicesFromInstructions:boolean,multipleAnswers:boolean,static:defaulted(boolean,()=>false)}));
 

@SonicScrewdriver SonicScrewdriver changed the title docs(changeset): Creation of initial types and stubs for Vector graph [ Interactive Graph | Vector Graph ] PR1: Type Definitions and Schema Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (ea67f91) and published it to npm. You
can install it using the tag PR3433.

Example:

pnpm add @khanacademy/perseus@PR3433

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3433

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3433

Copy link
Copy Markdown
Contributor

@ivyolamit ivyolamit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! LGTM 👍🏼

case "absolute-value":
case "logarithm":
case "vector":
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: At this point of the PR this is ideally false, but since this is a stacked PRs and will be merging it soon, this will be okay.

@SonicScrewdriver SonicScrewdriver merged commit b4bb6e2 into main Apr 27, 2026
11 checks passed
SonicScrewdriver added a commit that referenced this pull request Apr 28, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

item-splitting-change olc-5.0.c4fcb schema-change Attached to PRs when we detect Perseus Schema changes in it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants