Skip to content

[Preview NG] Export preview system hooks from @khanacademy/perseus-editor#3499

Merged
jeremywiebe merged 1 commit intomainfrom
jer/preview-ng-6-exports
May 5, 2026
Merged

[Preview NG] Export preview system hooks from @khanacademy/perseus-editor#3499
jeremywiebe merged 1 commit intomainfrom
jer/preview-ng-6-exports

Conversation

@jeremywiebe
Copy link
Copy Markdown
Collaborator

@jeremywiebe jeremywiebe commented Apr 15, 2026

Summary:

This PR is part of a series building a typed, hook-based preview system for the Perseus editor. The new system replaces the untyped window.iframeDataStore + raw postMessage(string) communication with structured, validated message passing via usePreviewController and usePreviewPresenter hooks. The new system is being built alongside the old one — no existing behavior changes until the final PR in the series flips the switch.

Previous PRs in this series:


Exports usePreviewController and usePreviewPresenter from the @khanacademy/perseus-editor package so they can be consumed by the frontend repo and other consumers. This is a small wiring PR — it adds four lines to the package's main index.ts.

Purely additive — no existing behavior is changed.

Issue: LEMS-3741

Test plan:

pnpm tsc and pnpm knip both pass. No new tests needed — the hooks are already fully tested in #3495.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

npm Snapshot: Published

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

Example:

pnpm add @khanacademy/perseus@PR3499

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

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

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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

Size Change: +1.03 kB (+0.21%)

Total Size: 504 kB

📦 View Changed
Filename Size Change
packages/perseus-editor/dist/es/index.js 104 kB +1.03 kB (+1%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.31 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 12 kB
packages/perseus-core/dist/es/index.js 25.5 kB
packages/perseus-linter/dist/es/index.js 9.41 kB
packages/perseus-score/dist/es/index.js 9.78 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 198 kB
packages/perseus/dist/es/strings.js 8.5 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 Apr 15, 2026

🛠️ Item Splitting: No Changes ✅

@jeremywiebe jeremywiebe marked this pull request as ready for review April 15, 2026 22:05
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.

@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-5-hooks branch from feb3f11 to 9b6a03d Compare April 16, 2026 22:57
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-6-exports branch from 8322a21 to e604cc6 Compare April 16, 2026 23:42
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-5-hooks branch 3 times, most recently from fafe8ac to d74ac10 Compare April 29, 2026 21:36
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-6-exports branch 2 times, most recently from aa2d120 to e4673df Compare May 1, 2026 19:10
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-5-hooks branch from 3f235ec to ec89ac8 Compare May 4, 2026 19:39
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-6-exports branch from e4673df to 53de3fa Compare May 4, 2026 23:56
Base automatically changed from jer/preview-ng-5-hooks to main May 5, 2026 20:13
@jeremywiebe jeremywiebe force-pushed the jer/preview-ng-6-exports branch from 53de3fa to 1e606e2 Compare May 5, 2026 20:17
@jeremywiebe jeremywiebe merged commit 8860d6a into main May 5, 2026
11 checks passed
@jeremywiebe jeremywiebe deleted the jer/preview-ng-6-exports branch May 5, 2026 21:06
handeyeco pushed a commit that referenced this pull request May 6, 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-editor@31.2.0

### Minor Changes

- [#3571](#3571)
[`4e0193210e`](4e01932)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Deprecate
`serialize()` function on EditorPage, ArticleEditor, and Editor
components - use `onChange` prop instead!


- [#3495](#3495)
[`0dd432126d`](0dd4321)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Add
usePreviewController and usePreviewPresenter hooks for typed iframe
preview communication


- [#3499](#3499)
[`8860d6a838`](8860d6a)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Export preview
system hooks and types from @khanacademy/perseus-editor

### Patch Changes

- [#3580](#3580)
[`e5e93e1dab`](e5e93e1)
Thanks [@ivyolamit](https://github.com/ivyolamit)! - Remove some feature
flags related to Interactive Graph Phase 2 (absolute value, tangent,
logarithm, and exponent)

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`cf2e061e24`](cf2e061),
[`e5e93e1dab`](e5e93e1),
[`138a955dfc`](138a955)]:
    -   @khanacademy/perseus@77.4.1
    -   @khanacademy/perseus-core@26.0.2
    -   @khanacademy/keypad-context@3.2.47
    -   @khanacademy/kmath@2.4.5
    -   @khanacademy/math-input@26.4.19
    -   @khanacademy/perseus-linter@5.0.2
    -   @khanacademy/perseus-score@8.8.1

## @khanacademy/keypad-context@3.2.47

### Patch Changes

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2

## @khanacademy/kmath@2.4.5

### Patch Changes

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2

## @khanacademy/math-input@26.4.19

### Patch Changes

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2
    -   @khanacademy/keypad-context@3.2.47

## @khanacademy/perseus@77.4.1

### Patch Changes

- [#3574](#3574)
[`1f4e2b5105`](1f4e2b5)
Thanks [@handeyeco](https://github.com/handeyeco)! - Make angleOffsetDeg
nullable


- [#3566](#3566)
[`cf2e061e24`](cf2e061)
Thanks [@Myranae](https://github.com/Myranae)! - Convert matcher colors
to semantic tokens


- [#3580](#3580)
[`e5e93e1dab`](e5e93e1)
Thanks [@ivyolamit](https://github.com/ivyolamit)! - Remove some feature
flags related to Interactive Graph Phase 2 (absolute value, tangent,
logarithm, and exponent)


- [#3582](#3582)
[`138a955dfc`](138a955)
Thanks [@catandthemachines](https://github.com/catandthemachines)! -
Fixing horizontal overflow issues in GIF images.

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2
    -   @khanacademy/keypad-context@3.2.47
    -   @khanacademy/kmath@2.4.5
    -   @khanacademy/math-input@26.4.19
    -   @khanacademy/perseus-linter@5.0.2
    -   @khanacademy/perseus-score@8.8.1

## @khanacademy/perseus-core@26.0.2

### Patch Changes

- [#3574](#3574)
[`1f4e2b5105`](1f4e2b5)
Thanks [@handeyeco](https://github.com/handeyeco)! - Make angleOffsetDeg
nullable


- [#3580](#3580)
[`e5e93e1dab`](e5e93e1)
Thanks [@ivyolamit](https://github.com/ivyolamit)! - Remove some feature
flags related to Interactive Graph Phase 2 (absolute value, tangent,
logarithm, and exponent)

## @khanacademy/perseus-linter@5.0.2

### Patch Changes

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2
    -   @khanacademy/kmath@2.4.5

## @khanacademy/perseus-score@8.8.1

### Patch Changes

- Updated dependencies
\[[`1f4e2b5105`](1f4e2b5),
[`e5e93e1dab`](e5e93e1)]:
    -   @khanacademy/perseus-core@26.0.2
    -   @khanacademy/kmath@2.4.5

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants