[Interactive Graph] Add tangent graph type definitions and data schema#3345
[Interactive Graph] Add tangent graph type definitions and data schema#3345
Conversation
🗄️ Schema Change: Changes Detected
|
|
Size Change: +92 B (+0.02%) Total Size: 486 kB
ℹ️ View Unchanged
|
🛠️ Item Splitting: Changes Detected
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (c093fac) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3345If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3345If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3345 |
There was a problem hiding this comment.
The changes in these files will be used in the follow-up PR. But this is added to keep knip/lint happy by having a test that references the export.
packages/perseus-core/src/utils/generators/interactive-graph-widget-generator.tspackages/perseus-core/src/utils/generators/interactive-graph-widget-generator.test.ts
packages/perseus-editor/src/widgets/interactive-graph-editor/start-coords/util.ts
Outdated
Show resolved
Hide resolved
… type definitions, this is the inital implementation for supporting Tangent graph in Interactive Graph
…ent graph type definitions and data schema
2fb5e2e to
b955534
Compare
|
Summary of the tangent implementation
|
Summary:
PR series to add tangent graph support to the Interactive Graph widget:
This is the first PR in a series to add tangent graph support to the Interactive Graph widget (LEMS-3955). It establishes the type foundation with zero runtime behavior change. The feature flag (
interactive-graph-tangent) is added in #3344.PerseusGraphTypeTangentandTangentGraphCorrecttypes to the data schema, following the sinusoid patternparsePerseusGraphTypeTangent)TangentGraphStateinterface (not yet exported or added to theInteractiveGraphStateunion — deferred to a later PR when reducer handlers are implemented)generateIGTangentGraph()test data generator with unit testscase "tangent"branches in all exhaustiveness switches affected by the newPerseusGraphTypeunion memberImplementation notes
Adding
PerseusGraphTypeTangentto thePerseusGraphTypeunion triggersUnreachableCaseErrorin several switch statements. Placeholder cases were added to keep the build green:interactive-graph-editor.tsx— graph mergingstart-coords/util.ts—shouldShowStartCoordsUIreturnsfalsefor tangent (downstream componentsStartCoordsSettingsInnerandgetDefaultGraphStartCoordsdon't handle tangent yet — returningtruewould show an empty section with a broken reset button)interactive-graph-ai-utils.ts—getGraphOptionsForProps+getUserInputinteractive-graph.tsx—getEquationString(returns"")initialize-graph-state.ts— returnstype: "none"These placeholders will be replaced with real implementations in subsequent PRs.
TangentGraphStateis intentionally not exported and not added to theInteractiveGraphStateunion in this PR. That union has its own set of exhaustiveness checks (renderGraphElements,mafsStateToInteractiveGraph,getGradableGraph), and adding to it requires reducer handlers to exist first. This happens in PR 3.References
Co-Authored by Claude Code (Opus)
Issue: LEMS-3955
Test plan:
pnpm tsc— no type errorspnpm lint— no lint errorspnpm prettier . --check— formatting cleanpnpm knip— no unused exportsgenerateIGTangentGraphdefault + all props)