docs(storybook): build out Code Editors pattern pages - #1111
Conversation
Exporting the workbench component directly from LayoutPatterns.stories.tsx caused Storybook's CSF auto-detection to treat it as an implicit story (any named export from a .stories.tsx file is picked up), creating a duplicate "Error And Validation Workbench" entry in the sidebar alongside the real "UX Error and Validation" story. Moving it to a plain .tsx module lets it stay importable by both LayoutPatterns and the new Code Editors pattern pages without being auto-registered as a story.
…theme apolloFutureDarkCodeMirror and apolloFutureLightCodeMirror used a background one shade darker than Monaco's editor.background for the same theme (zinc-900 vs zinc-800, zinc-100 vs zinc-200), while every other token (foreground, cursor, selection, lineHighlight, line numbers, matching bracket) already matched exactly. The mismatched background made CodeMirror and Monaco editors look inconsistent side by side. Align both backgrounds to Monaco's value, since the surrounding tokens were clearly derived assuming that lighter background.
Renamed "Editor Full" / "Editor Compact" / "Editor Inline" to "Panel — Full Editor" / "Panel — Compact Editor" / "Panel — Inline Editor". These names collided with the new Apollo Wind > Patterns > Code Editors pages of the same names, which document a different, unrelated set of Monaco/CodeMirror examples — the collision made both sets of stories hard to tell apart in search and the sidebar.
Adds a full "Apollo Wind > Patterns > Code Editors" documentation section covering how to compose Monaco and CodeMirror across the app, and fixes several real bugs surfaced while building it out: - New pages: Editor Full, Editor Compact, Editor Input, Editor Variables, and a canvas-panel Layout Pattern example, alongside the existing Overview / Reference Monaco / Reference CodeMirror / Themes pages. - Editor Variables demonstrates inserting a variable both ways: through a VariablePicker "Insert" dropdown and by typing `$` in the editor — covering both PromptEditor (ref-based insertVariableToken) and Monaco (cursor-position insert via editor.executeEdits, the same pattern already used in NodePropertyPanel's panel composition stories). - Layout Pattern's expression takeover now opens straight into fullscreen instead of the smaller windowed view. - Fixed: Monaco's TS diagnostics were flagging undeclared identifiers in these illustrative snippets as real errors (red squigglies); disabled semantic/syntax validation for these demo editors. - Fixed: the lockable-field expression editor had a fixed 84px height inside a 36px input row, so it visually overflowed and covered the field label above it; sized it to match the row instead. - Fixed: that same editor's wrapper was missing flex sizing, collapsing it to a 5px sliver; and its placeholder text was never wired up, so a cleared field showed nothing instead of matching Input's placeholder styling. - Fixed: CodeMirror's own base styles were silently overriding our theme font-family on `.cm-content`, so CodeMirror editors rendered in the browser's generic monospace font (visibly larger) instead of Apollo's font stack — affects every CodeMirror instance in this file, not just one page. - Fixed: Monaco and CodeMirror examples (Editor Full/Compact, Themes) used mismatched heights since CodeMirror auto-sizes to its content; both now share an explicit height so side-by-side comparisons line up. - Storybook sidebar: added "Patterns" > ["Layout Patterns", "Code Editors"] to storySort so the new section has a stable position.
|
Apollo Coded App preview deployments finished with failures.
|
Dependency License Review
License distribution
Excluded packages
|
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed issues in Storybook content (em-dash usage) and a LiveMonacoEditor control bug (defaultValue vs value) that can desync demos relying on external state.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Builds out a new Storybook “Patterns > Code Editors” documentation section in apollo-wind, aligns CodeMirror theme tokens with Monaco for Future themes, and refactors a large workbench composition out of a *.stories.tsx file to avoid Storybook CSF auto-detection collisions.
Changes:
- Added/expanded Storybook pattern pages for Monaco + CodeMirror usage, variable insertion, and a canvas-panel “Layout Pattern” example.
- Updated CodeMirror Future theme background tokens to match Monaco’s
editor.background. - Extracted
ErrorAndValidationWorkbenchinto a standalone.tsxmodule and updated Storybook sorting to include the new Patterns section.
File summaries
| File | Description |
|---|---|
| packages/apollo-wind/src/editor-themes/codemirror.ts | Aligns Future dark/light CodeMirror background tokens to match Monaco. |
| packages/apollo-wind/src/components/ui/code-editors.stories.tsx | Adds the new “Patterns/Code Editors” documentation pages, demos, and theme previews. |
| packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx | Renames panel editor stories to avoid collisions with the new Code Editors pages. |
| apps/storybook/src/patterns/LayoutPatterns.stories.tsx | Removes the inlined workbench implementation and consumes the extracted component. |
| apps/storybook/src/patterns/ErrorAndValidationWorkbench.tsx | New extracted workbench component used by multiple pattern pages. |
| apps/storybook/.storybook/preview.tsx | Stabilizes sidebar ordering for the new Patterns section. |
Review details
Suppressed comments (2)
packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1313
- The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const CompactEditor: Story = {
name: 'Panel — Compact Editor',
render: () => <CompactEditorStory />,
packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1525
- The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const InputEditor: Story = {
name: 'Panel — Inline Editor',
render: () => <InputEditorStory />,
- Files reviewed: 6/6 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Storybook visual diff⏭️ Skipped: the apollo-design preview deployment did not succeed, so no comparison ran. Logs Updated (PT): Sep 01, 2026, 04:01:23 PM |
📊 Coverage + size by packagePer-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.
"Coverage" is each package's own |
…terns - Only disable Monaco's semantic TS validation, not syntax validation, so genuinely malformed code still surfaces in these demos. - LiveMonacoEditor is used everywhere as a controlled component (callers pass value + onChange), but it forwarded value via defaultValue, so external value updates on an already-mounted instance were silently ignored. Pass value through directly instead. - CodeMirror's .cm-content rule duplicated the font stack already set on the parent `&` rule; use `inherit` so there's one source of truth. - Replace em dashes in two renamed Storybook story names and one doc paragraph with a colon / period, per this repo's no-em-dash rule for Storybook content.
There was a problem hiding this comment.
🔵 Needs a closer look
There are new cross-workspace imports in code-editors.stories.tsx (deep apollo-react source imports and a package→app dependency) that should be corrected/avoided to match repo conventions and reduce coupling.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
packages/apollo-wind/src/components/ui/code-editors.stories.tsx:10
- This story file in
packages/apollo-windimports a component fromapps/storybook, creating a package→app dependency that makes the story harder to reuse and can break isolated package typechecks/builds. Consider movingErrorAndValidationWorkbenchinto a shared location (e.g., an apollo-react canvas story template) or duplicating the minimal workbench composition locally within this storybook section.
This issue also appears on line 11 of the same file.
packages/apollo-wind/src/components/ui/code-editors.stories.tsx:13
- These imports reach into apollo-react’s source tree via a relative path. Prefer consuming the public canvas entrypoints (as other Storybook code does) so refactors inside apollo-react don’t silently break this story and to avoid cross-workspace relative coupling.
import { CanvasTakeoverModal } from '../../../../apollo-react/src/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal';
import { NodePropertyPanel } from '../../../../apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel';
import { withCanvasProviders } from '../../../../apollo-react/src/canvas/storybook-utils';
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
Summary
Builds out a full "Apollo Wind > Patterns > Code Editors" documentation section covering how to compose Monaco and CodeMirror across the app, plus several real bugs found and fixed while building it.
New pages
VariablePicker"Insert" dropdown, or typing$in the editor. Covers bothPromptEditor(ref-basedinsertVariableToken) and Monaco (cursor-position insert viaeditor.executeEdits, the same pattern already used inNodePropertyPanel's panel composition stories).Bugs fixed along the way
Input's placeholder styling) — both fixed..cm-content, so CodeMirror editors rendered in the browser's generic monospace font (visibly larger than Monaco) instead of Apollo's font stack — fixes every CodeMirror instance in this file, not just one page.apolloFutureDarkCodeMirror/apolloFutureLightCodeMirrorused a background one shade darker than Monaco's for the same theme, while every other token already matched — aligned both to Monaco's value.Other changes
ErrorAndValidationWorkbenchout ofLayoutPatterns.stories.tsxinto its own plain.tsxfile — exporting it directly from a.stories.tsxfile caused Storybook's CSF auto-detection to register it as a duplicate implicit story.Patterns > [Layout Patterns, Code Editors]to Storybook'sstorySortso the new section has a stable sidebar position.Test plan
biome checkclean on all changed filestsc --noEmitclean forapollo-wind,apollo-reactturbo run typecheckclean forapollo-wind,apollo-react,storybook-app🤖 Generated with Claude Code