Skip to content

feat(richtext,lab): promote RichTextEditor from lab into @astryxdesign/richtext - #4678

Open
potatowagon wants to merge 1 commit into
mainfrom
navi/feat/promote-richtext
Open

feat(richtext,lab): promote RichTextEditor from lab into @astryxdesign/richtext#4678
potatowagon wants to merge 1 commit into
mainfrom
navi/feat/promote-richtext

Conversation

@potatowagon

@potatowagon potatowagon commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Promotes the Lexical-based RichTextEditor out of @astryxdesign/lab into its own canary-only package, @astryxdesign/richtext, so it can be canaried into EPS/Nest (fbsource) independently — without dragging the rest of lab along.

This mirrors how @astryxdesign/charts was promoted: private: true + astryx.canaryOnly (published only under the @canary dist-tag, never stable latest), a flat src/ layout, and storybook-hosted examples for testing.

Where do the stories/examples show up?

In storybook (apps/storybook) — same place charts and lab examples live. charts deliberately does not surface in the docsite component registry (that registry only scans core/lab-style per-component subdirectories); it relies on storybook. richtext follows the same model:

  • apps/storybook now depends on @astryxdesign/richtext.
  • stories/RichTextEditor.stories.tsx imports from @astryxdesign/richtext (was @astryxdesign/lab).
  • Verified pnpm --filter @astryxdesign/storybook build succeeds (4034 modules, exit 0).

What moved

Git-tracked renames (history preserved) from packages/lab/src/RichTextEditor/packages/richtext/src/:
RichTextEditor.tsx, RichTextView.tsx, RichTextEditorToolbar.tsx, editorTheme.ts, editorNodes.ts, markdownSerializers.ts, RichTextEditor.doc.mjs, RichTextEditor.test.tsx, and the local barrel → packages/richtext/src/index.ts.

The source only imported from @astryxdesign/core/* + @lexical/* + local files — no lab-internal cross-refs — so the move is mechanical. Doc-comment / SYNC-path references were updated to the new home.

Package wiring (matches lab/charts)

  • packages/richtext/package.json: adds Lexical optional peer/dev deps (incl. @lexical/headless + @lexical/html, both used by the editor/serializers), @astryxdesign/cli devDep (for .doc.mjs authoring types), a build:css step, a ./richtext.css export, and a typecheck:docs script.
  • scripts/build-css.mjs: registers a richtext StyleX target (73 rules → 3.6 KB richtext.css), same core-token alias as lab/charts.
  • packages/richtext/tsconfig.docs.json: added (mirrors charts).
  • packages/lab: drops the RichTextEditor exports from its barrel and removes the now-unused Lexical peer/dev/meta deps (nothing else in lab uses Lexical).
  • vitest.config.ts: adds packages/richtext to the ui project (jsdom + StyleX transform) and excludes it from the node project.

Verification (all green)

  • richtext build — esm + d.ts + css + check-no-dev-jsx + check-fully-specified
  • lab build (without RichTextEditor)
  • richtext + lab lint
  • richtext package typecheck + docs typecheck
  • storybook typecheck + build
  • test suite — 50/50 pass (moved RichTextEditor.test.tsx)

Breaking change (lab canary consumers)

-import {RichTextEditor, RichTextView} from '@astryxdesign/lab';
+import {RichTextEditor, RichTextView} from '@astryxdesign/richtext';

Changeset included (minor bump for richtext + lab).

Next step (canary → EPS/Nest)

Once this lands, @astryxdesign/richtext@canary can be pulled into EPS Nest independently of the rest of lab, which is the whole point of the split.

Refs RFC #3899.

Rebased onto latest main (incorporates #4670 + #4671)

This branch was rebased onto main after #4670 (link support) and #4671 (RichTextView reactivity) merged into packages/lab. Those changes are now promoted into @astryxdesign/richtext as part of the move — no functionality is lost in the split:

  • Link support (feat(lab): add link support to RichTextEditor #4670) carried over: RichTextEditorToolbar link button + Cmd/Ctrl+K, RichTextEditorAutoLinkPlugin.tsx + linkUtils.ts (both git-renamed into packages/richtext/src/, history preserved), and the +379 link tests. New AutoLink/linkUtils exports added to packages/richtext/src/index.ts.
  • RichTextView reactivity (fix(lab): make RichTextView react to value prop changes #4671) carried over: the internal SyncValuePlugin re-applies value on change, plus its tests.
  • SYNC-path doc comments in the moved files updated from packages/lab/...packages/richtext/....
  • packages/lab barrel updated to point consumers at @astryxdesign/richtext (no RichTextEditor exports remain in lab).

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 4, 2026 3:18am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 3, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Aug 3, 2026
…n/richtext

Move the Lexical-based rich text editor and viewer out of @astryxdesign/lab
into its own canary-only package, @astryxdesign/richtext, so it can be
canaried independently (e.g. into EPS/Nest) without dragging the rest of lab
along. Mirrors the @astryxdesign/charts promotion model (private + canaryOnly,
flat src/ layout, storybook-hosted examples).

What moved (git-tracked renames, history preserved):
- packages/lab/src/RichTextEditor/{RichTextEditor,RichTextView,
  RichTextEditorToolbar,editorTheme,editorNodes,markdownSerializers,
  *.doc.mjs,*.test.tsx} -> packages/richtext/src/
- The local barrel becomes packages/richtext/src/index.ts (package entry).

Package wiring (matches lab/charts):
- richtext package.json: adds Lexical optional peer/dev deps (incl. headless +
  html), @astryxdesign/cli devDep for .doc.mjs authoring types, build:css step,
  ./richtext.css export, and typecheck:docs script.
- scripts/build-css.mjs: register a `richtext` StyleX target (73 rules -> 3.6KB).
- packages/richtext/tsconfig.docs.json: added (mirrors charts) for .doc.mjs
  typecheck.
- lab: drop RichTextEditor exports from the barrel and remove the now-unused
  Lexical peer/dev/meta deps (nothing else in lab uses Lexical).

Examples / testing:
- apps/storybook: add @astryxdesign/richtext dep; RichTextEditor.stories.tsx
  now imports from @astryxdesign/richtext. Storybook is where richtext examples
  are exercised (same as charts). Verified `storybook build` succeeds.
- vitest.config.ts: add packages/richtext to the `ui` project (jsdom + StyleX
  transform) and exclude it from the `node` project. All 50 tests pass.

Verified: richtext build (esm + dts + css + dev-jsx + fully-specified checks),
lab build, richtext + lab lint, package typecheck, docs typecheck, storybook
typecheck + build, and the 50-test suite — all green.

Breaking (lab canary consumers): import RichText* from @astryxdesign/richtext.
Changeset added (minor bump for richtext + lab).

Closes: RFC #3899 promotion step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant