Skip to content

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

Merged
potatowagon merged 1 commit into
mainfrom
navi/feat/promote-richtext
Aug 14, 2026
Merged

potatowagon merged 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';

No changeset: both @astryxdesign/richtext and @astryxdesign/lab are private (canary-only, never published to latest), so this move touches no releasable package. Per scripts/check-changesets.mjs, private packages cannot appear in a changeset — so none is included.

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).

Rebased onto latest main (incorporates #4818 visual polish)

Rebased onto main after #4818 ("[lab] Visual polish for RichTextEditor and toolbar") merged. #4818 edited the same RichTextEditor files this PR moves out of packages/lab, so its polish is now promoted into @astryxdesign/richtext — nothing is lost in the split:

  • The RichTextEditor + toolbar visual refresh (flush top toolbar slot, IconButton/Selector/ToggleButton/Divider/Dialog/TextInput toolbar, configurable editable-surface min-height, editorTheme.ts tweaks) carried over into packages/richtext/src/ (files git-renamed, history preserved).
  • The expanded RichTextEditor test suite from [lab] Visual polish for RichTextEditor and toolbar #4818 carried over unchanged.
  • Doc-header (@input/@output/@position) and .doc.mjs descriptions reconciled: kept [lab] Visual polish for RichTextEditor and toolbar #4818's accurate feature/visual wording, updated package refs @astryxdesign/lab → @astryxdesign/richtext.
  • pnpm-lock.yaml reconciled against current main: Lexical dev deps moved packages/lab → packages/richtext, @astryxdesign/richtext linked into the storybook importer, and @astryxdesign/core picks up main's current 0.4.0 (no stale version pins).

CI follow-ups (this rebase)

Two fixes on top of the #4818 rebase to green CI:

  • apps/storybook/tsconfig.json: added @astryxdesign/richtext path mappings (mirroring the existing @astryxdesign/lab ones). The story import was updated to @astryxdesign/richtext but the tsconfig paths weren't, so storybook typecheck failed with TS2307: Cannot find module '@astryxdesign/richtext' (and cascading implicit-any on story args).
  • Removed .changeset/promote-richtext-to-own-package.md: it bumped two private packages, which check:changesets rejects ("private/ignored and cannot be released"). Private/canary-only packages carry no changeset in this repo.

@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 14, 2026 6:07am

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
@potatowagon
potatowagon force-pushed the navi/feat/promote-richtext branch from a2d9a98 to 4d0ac9e Compare August 4, 2026 03:15

@imdreamrunner imdreamrunner left a comment •

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.

(Sorry this is accidentally posted by agent)

@imdreamrunner
imdreamrunner self-requested a review August 6, 2026 22:14
@potatowagon
potatowagon force-pushed the navi/feat/promote-richtext branch from 4d0ac9e to d2735be Compare August 14, 2026 05:40
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Aug 14, 2026
@potatowagon
potatowagon dismissed imdreamrunner’s stale review August 14, 2026 06:00

imdreamrunner's comment was accidentally posted by an agent: (Sorry this is accidentally posted by agent)

…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
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/lab N/A 3.7KB 1.5KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 14, 2026
@potatowagon
potatowagon merged commit 401e16f into main Aug 14, 2026
19 checks passed
@github-actions
github-actions Bot deleted the navi/feat/promote-richtext branch August 15, 2026 06:10
AKnassa added a commit to AKnassa/astryx that referenced this pull request Aug 16, 2026
Resolves the PR meta#5025 conflict. Upstream promoted RichTextEditor out of
packages/lab into the new @astryxdesign/richtext package (meta#4678), which is
what GitHub reported as conflicting; git rename detection carried the
--color-text-red counter change to packages/richtext/src/RichTextEditor.tsx
along with its test. No hand edits were needed - the only lines the merge
dropped were unrelated prettier reflow.
@cixzhang cixzhang mentioned this pull request Aug 24, 2026
sangwook-dev added a commit to sangwook-dev/astryx that referenced this pull request Sep 19, 2026
meta#4380 pinned bare lexical imports issued from @astryxdesign modules to
lexical's built ESM: lab's RichTextEditor imported lexical, and withAstryx's
`source` condition sent it to lexical's raw TS. meta#4678 moved the editor into
@astryxdesign/richtext, which the sandbox does not depend on, and left the
alias behind.

Nothing the sandbox compiles imports lexical, @lexical/* or richtext, and the
build output contains no lexical code with or without the alias. Remove it,
along with the lexical devDependency the earlier commit declared for it.

This branch was successfully deployed

1 active deployment
Preview — be767cdf Deployed Aug 14, 2026 by vercel[bot]
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants