Commit e6b36ca
authored
docs(byo-ui): Bring Your Own UI section + cross-links from built-in modules (SD-2669) (#3034)
* docs(byo-ui): add Build Your Own UI section nav and stub pages (SD-2669)
Adds a new top-level "Build Your Own UI" group between Modules and
Solutions in docs.json, plus 10 stub pages mapping one-to-one to
controller domains: overview, react-setup, toolbar-and-commands,
custom-commands, comments, review, selection-and-viewport,
document-control, reference-demo, api-reference.
The stub pages include frontmatter, a one-line value statement, and
a Note callout pointing at SD-2669 for status. Stubs land first so
cross-doc callouts on the existing Modules pages can link to stable
URLs while the content is being written.
Overview is filled in to anchor the layer model (Document API /
superdoc/ui / built-in modules) and link to every page in the section.
* docs(byo-ui): align overview and stubs with brand voice (SD-2669)
Rewrites the overview to lead with one sentence, the layer model
table, and a 15-line code snippet showing useSuperDocCommand bound
to a button. Adds icons to the CardGroup so the section index reads
at a glance.
Sweeps em dashes from every stub. Brand voice rules ban them in
favor of hyphens, periods, or split sentences.
Adds superdoc/ui and superdoc/ui/react to the docs import allowlist
so future pages in this section pass the import validator.
Mintlify validate passes.
* docs(byo-ui): write 8 BYO-UI section pages (SD-2669)
Fills in:
- React setup: provider, onReady, hooks table, common pitfalls
- Toolbar and commands: per-button binding, payloads, built-in id table
- Custom commands: register, getState, execute, override, namespacing
- Comments: list, add from selection, capture-based composer, threads
- Selection and viewport: selection slice, capture, scrollIntoView, getRect
- Document control: setMode (Edit/Suggest), export, replaceFile
- Reference demo: what it covers, how to read it, what it deliberately doesn't do
- API reference: handwritten skeleton mirroring page order
review.mdx and api-reference.mdx will be revisited after the
ui.review → ui.trackChanges rename lands as a separate PR.
All pages follow brand voice rules: code-first, short sentences,
no em dashes, public APIs only. Trade-offs called out per page.
Mintlify validate passes; import validator green.
* docs(byo-ui): rename Review page to Track changes, drop merged-feed surface
Mirrors the controller-side rename in #3029 / superdoc 1.30.1:
'ui.review' is gone and 'ui.trackChanges' takes its place.
- Rename review.mdx → track-changes.mdx and rewrite for the
tracked-changes-only surface (items, total, activeId).
- Document the merged comments + changes feed as a consumer-side
composition pattern with useSuperDocComments + useSuperDocTrackChanges.
- Update docs.json nav, overview card grid, react-setup hook table,
api-reference handle + types, and reference-demo coverage table.
* docs: cross-link built-in modules to Build Your Own UI
Adds <Tip> callouts on the four pages a consumer hits before they
realize there's a custom-UI path: modules/comments, modules/track-changes,
modules/toolbar/headless, and core/react/overview. Each one routes them
to the relevant Build Your Own UI page so they don't fight the built-in
module before discovering useSuperDocComments / useSuperDocTrackChanges
/ useSuperDocCommand.
* docs(byo-ui): address review feedback on canonical pages
- Custom commands: rewrite execute example to use the public
ui.selection.getSnapshot().selectionTarget shape (was passing the
wrong target type to editor.doc.insert). Lead with a pure-additive
pattern; mark the activeEditor reach as a known escape hatch.
- Custom commands: split override into two patterns. Pattern A
(sibling + dispatch both) is the default. Pattern B (true override)
now actually toggles the mark instead of silently discarding it.
- Comments: de-emphasize the reply pattern. Group-by-parent shape is
public; posting a reply is filed as a follow-up and points to the
reference demo as a temporary workaround.
- Track changes: move the merged-feed pattern out of the canonical
page and into reference-demo as 'one app-level composition'. Keeps
the controller surface tight.
- Drop SSO-gated linear.app URLs from public-facing docs; keep ticket
IDs as plain text.
* docs(byo-ui): replace ticket references with copy-safe workarounds
Public docs shouldn't promise specific follow-up tickets readers can't
see. Each former 'tracked under SD-XXXX' note now describes either how
the surface actually works today or a workaround that ships.
- comments: post replies via useSuperDocHost() + editor.doc.comments.create
(full snippet, not just a pointer to the demo).
- custom-commands: drop the 'when SD-2844 lands' framing; the scoped
structural cast is the pattern.
- selection-and-viewport / track-changes: explain that non-body entities
snap because story activation mounts the surface synchronously, and
show how to layer your own smooth scroll if needed.
- reference-demo: show window.getSelection() rect lookup as the path for
floating menus today.
- document-control: full transaction-listener snippet for a dirty
indicator.
* docs(byo-ui): use the typed controller APIs that landed in #3035, #3039, #3040
Three workarounds drop now that the controller surface covers them:
- comments.mdx: post a reply via ui.comments.reply(parentId, { text })
instead of useSuperDocHost() + editor.doc.comments.create.
- custom-commands.mdx: drop the structural cast on superdoc.activeEditor;
use the typed editor argument that execute({ payload, superdoc, editor })
now provides. Pattern B's chain-command cast narrowed and called out.
- document-control.mdx: drop the transaction-listener snippet; use
useSuperDocDocument().dirty directly. Includes the export-button
example pattern. Trade-offs trimmed accordingly.
API reference updated: useSuperDocDocument now returns dirty;
ui.commands.register() execute receives editor; ui.comments.reply
listed in the comments handle block.
* docs(byo-ui): address codex review on PR #3034
- api-reference.mdx: ui.toolbar.execute(id, payload?) was signature
syntax, not valid TS. Split into two valid call forms with prose.
- core/react/overview.mdx: drop the <Tip> block per AGENTS.md rule
('Don't add Tips, Warnings, or deep explanations in overview
pages'). Cross-link kept as plain inline paragraph.
* docs(byo-ui): drop em dashes per brand style
* docs(byo-ui): correct toolbar ids and comment scrollTo scope
Two factual fixes flagged in PR #3034 review:
- toolbar-and-commands.mdx: the built-in command id table listed
several ids that aren't on PublicToolbarItemId. strike →
strikethrough, color → text-color, highlight → highlight-color,
and the entire 'Block' row (heading-1/-2/-3, paragraph) is dropped
because no block-level commands exist on this surface today.
Replaced the table with the actual id set grouped by domain.
- comments.mdx: the trade-off note claimed ui.comments.scrollTo is
story-aware. CommentAddress is body-scoped in the contract — only
TrackedChangeAddress carries a story field — so the call doesn't
navigate to header/footer/note comments. Replaced with an honest
description and pointer to ui.viewport.scrollIntoView for non-body
cases.
* refactor: rename build-your-own-ui to bring-your-own-ui (SD-2669)
The BYO acronym is conventional for 'Bring Your Own X' (BYOK, BYOC,
BYOD). It also reads more accurately to what consumers actually do:
they bring their existing React app + design system and slot
SuperDoc behind it, rather than building a UI from scratch.
- Section title in docs.json: 'Build Your Own UI' becomes 'Bring
Your Own UI'.
- URL slugs: /build-your-own-ui/* becomes /bring-your-own-ui/*.
- apps/docs/build-your-own-ui/ renamed to apps/docs/bring-your-own-ui/
(10 mdx pages, all internal links updated).
- demos/build-your-own-ui/ renamed to demos/bring-your-own-ui/. Demo's
package.json name, README heading, the docs reference-demo links,
the playwright port-map key, and the ci-demos.yml matrix entry all
follow.
- Cross-link callouts on /modules/comments, /modules/track-changes,
/modules/toolbar/headless, /core/react/overview reworded.
* docs: integrate Bring Your Own UI into the broader docs (SD-2669)
Fixes stale correctness issues and lays out the layer model so
existing docs route customers to the right path.
Stage 1 — correctness fixes on BYO pages
- bring-your-own-ui/reference-demo: drop the 'demo reaches through
useSuperDocHost()' prose; replies and custom commands now use the
typed surface after #3035 and #3039 shipped.
- bring-your-own-ui/custom-commands: Pattern B (override) reframed
as an advanced escape hatch with a Warning, since override truly
replaces and consumers shouldn't trust the built-in to still run.
- modules/track-changes: drop 'merged comments + changes feed' from
the BYO callout; the merged-feed pattern moved to reference-demo
as an app-level composition.
Stage 2 — toolbar IA cleanup
- modules/toolbar/overview: replace the two-path table with a
three-path decision: Built-in / Bring Your Own UI / Headless
toolbar. Recommendation: new React apps reach for BYO first;
headless stays supported for non-React and existing integrations.
- modules/toolbar/headless: promote the BYO redirect from a Tip to
a 'Using React?' section with the supported-vs-recommended framing.
- modules/toolbar/examples: drop the React + shadcn and React + MUI
examples; redirect React readers to BYO. Vue / Svelte / vanilla
examples stay.
Stage 3 — onboarding links
- getting-started/frameworks/react: add BYO card to Next steps.
- getting-started/quickstart: add BYO link inline under the React
scenario plus a card in 'What's next'.
Stage 4 — authoring guidance + LLM context
- AGENTS.md: new 'Layer model' section with explicit recommendation
order (Document API > superdoc/ui > Modules > Core). API naming
marks superdoc.activeEditor.commands.* as legacy/compat. Source
file table extended with the doc-api contract and superdoc/ui.
- llms.txt: add Bring Your Own UI link plus a Layer Model section
so agents recommend the right surface.
Stage 5 — disambiguate track-changes pages without URL renames
- modules/track-changes: title 'Track changes module',
sidebarTitle 'Track changes module'.
- bring-your-own-ui/track-changes: title 'Custom track changes UI',
sidebarTitle stays 'Track changes' for nav consistency.
* docs: route live-state events to BYO UI; expand llms-full layer model
- core/superdoc/events.mdx: leading Note tells React consumers to
prefer superdoc/ui subscriptions over manual superdoc.on(...) loops
for live UI state. Lifecycle / integration / analytics events stay
the documented use case.
- llms-full.txt: new Layer Model section after Architecture so agents
recommend Document API for mutations, superdoc/ui for custom React
UI, and modules for built-in UI. Lists the four common
anti-patterns to steer clear of in customer code.
* docs: route legacy paths to typed surfaces (SD-2669)
- modules/comments: lead the 'API methods' section with a Note that
steers new code to editor.doc.comments.* (mutations) or ui.comments.*
(React UI). The activeEditor.commands.* docs stay for backwards
compatibility but no longer present as the recommended path.
- core/supereditor/overview: was framing SuperEditor as 'Custom UI
implementation' and claimed Document API was 'coming soon'. Both
outdated. Rewrote 'When to use' as a layer-picker that points
custom React UI at Bring Your Own UI, document mutations at the
Document API, and SuperEditor at the genuine low-level cases
(engine internals, custom extensions, server-side headless).
* docs: add BYO UI pointers in core methods + doc-api migration guide
- core/superdoc/methods: lead the Comments-methods section and the
activeEditor property docs with a Note steering new code to
ui.comments.* / editor.doc.* / ui.commands.*. addCommentsList
/ removeCommentsList stay supported for built-in sidebar users;
activeEditor.commands stays for backwards compat.
- guides/migration/document-api: append a 'Driving custom React UI'
section. Migrators dropping editor.commands/state/view from doc
mutations also benefit from migrating the UI side to typed hooks
in the same pass. Points at the BYO UI overview and the demo.
* docs: route remaining built-in callouts to typed surfaces
- getting-started/import-export: post-init insertContent example
steers new code to editor.doc.insert; chain command stays for
apps already wired to activeEditor.commands.*
- modules/toolbar/built-in: top-of-page Tip routes React readers
to Bring Your Own UI first; headless stays as the non-React
alternative.
* docs: add four Mermaid diagrams to anchor BYO UI conceptually
- bring-your-own-ui/overview: layer-model diagram showing how Your UI
→ superdoc/ui/react → superdoc/ui → Document API → engine, with
built-in modules as a sibling path also routed through Document API.
- bring-your-own-ui/react-setup: provider-tree diagram showing one
provider, one controller, many components subscribing per slice.
- bring-your-own-ui/comments: capture-sequence diagram for the textarea-
composer flow (select, click Comment, capture, focus moves, submit
posts via createFromCapture).
- getting-started/quickstart: pick-your-surface decision flow at the
top of the page so visitors route to AI agents / backend / built-in
editor / Bring Your Own UI without reading the section headings.
* docs(byo-ui): drop the three BYO Mermaid diagrams
Felt too much for the BYO surface. Removing the layer-model,
provider-tree, and capture-sequence diagrams. Visual story for
BYO will land via media assets and embedded demos in a follow-up,
not diagrams. Quickstart 'pick your surface' diagram stays — it's
site-wide orientation, not BYO-specific.
* docs(byo-ui): add embedded BYO UI demo on overview page
New snippet at apps/docs/snippets/components/byo-ui-demo.jsx renders
a compact 'workspace slice' driven by superdoc/ui:
- Custom toolbar (B / I / Comment / Edit-Suggest / Export) wired to
ui.commands observables, ui.document.setMode, ui.document.export.
- Activity sidebar shows live ui.comments and ui.trackChanges with
Resolve / Accept / Reject actions. Empty state with hints when no
comments or changes exist.
- Selection-capture composer for new comments via
ui.selection.capture() + ui.comments.createFromCapture().
- Try-it checklist above the workspace.
Loading: lazy behind a 'Launch interactive demo' button so the 5 MB
SuperDoc UMD only loads on user gesture. Editor comes from the
existing UMD pattern (window.SuperDoc); controller comes from a
dynamic import() of superdoc/ui's ESM entry. The embed bridges
controller observables into local React state instead of using
superdoc/ui/react — that bundle imports React as a bare ESM
specifier, which is fragile in Mintlify's runtime. Caption text
points React app users at the typed hooks.
Pinned to superdoc@1.30.1 (deterministic; floats forward only when
we update the snippet). v1 ships overview only; per-domain variants
(comments, track-changes, custom-command) come in follow-ups.
* docs(byo-ui): revert embed from overview, hits Mintlify runtime issues
Two failures on the deployed preview:
1. MDX runtime can't resolve capital-letter JSX references inside a
snippet ('Expected component Workspace to be defined'). The helper
functions inside byo-ui-demo.jsx need to be inlined into one big
component, no nested <Workspace />, <ToolButton />, etc.
2. The SuperDoc UMD throws 'Identifier fs has already been declared'
on injection, suggesting it's being loaded twice. Likely a baseUrl
mismatch with the existing SuperDocEditor snippet on extension
pages — different URL strings dodge the dedup querySelector.
Per the agreed fallback plan, don't block #3034 on the embed. The
snippet file stays at apps/docs/snippets/components/byo-ui-demo.jsx
for the follow-up PR where we can debug Mintlify's runtime quirks
without delaying the docs launch.
* docs(byo-ui): tighten sidebar — group toolbar, drop reference-demo, drop embed snippet
Sidebar IA cleanup. Customer-facing surface goes from 10 entries to 8
(one of which expands to 2 sub-pages):
- Group 'Toolbar and commands' + 'Custom commands' under a 'Toolbar
and commands' parent. URLs unchanged; sidebarTitle on each page set
to 'Built-in' / 'Custom' so the sub-entries don't collide with the
group label. Page titles ('Toolbar and commands', 'Custom commands')
stay verbose at the top of each page.
- Drop the 'Reference demo' page. Most of it duplicated content that
belongs in the demo's own README. The merged-feed pattern, the
'deliberately doesn't do' list, and the three takeaways for your own
UI all moved to demos/bring-your-own-ui/README.md. Overview gets a
one-line callout pointing at the demo on GitHub.
- 'Document control' page sidebarTitle becomes 'Document' — matches
the one-word pattern of Comments / Track changes (each named after
its ui.* slice).
- Drop apps/docs/snippets/components/byo-ui-demo.jsx. The embed work
is captured in SD-2871 and isn't blocking the docs launch.
Final sidebar:
Overview / React setup / Toolbar and commands (Built-in, Custom) /
Comments / Track changes / Selection and viewport / Document /
API reference
* docs(quickstart): hide mermaid pan/zoom controls on the surface picker
actions={false} disables the Mintlify-injected zoom/pan widget on
the 'Pick your surface' diagram. The diagram is small and one-glance
readable; the controls add visual noise without buying anything.1 parent 340e55a commit e6b36ca
46 files changed
Lines changed: 1622 additions & 149 deletions
File tree
- .github/workflows
- apps/docs
- bring-your-own-ui
- core
- react
- superdoc
- supereditor
- getting-started
- frameworks
- guides/migration
- modules
- toolbar
- scripts
- demos
- __tests__
- bring-your-own-ui
- public
- src
- components
- editor
- build-your-own-ui
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
102 | | - | |
| 113 | + | |
| 114 | + | |
103 | 115 | | |
104 | 116 | | |
105 | 117 | | |
| |||
111 | 123 | | |
112 | 124 | | |
113 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
114 | 129 | | |
115 | 130 | | |
116 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
0 commit comments