feat(fonts): config-gated bundled font availability and curation (SD-3441)#3732
feat(fonts): config-gated bundled font availability and curation (SD-3441)#3732caio-pizzol wants to merge 6 commits into
Conversation
…3441)
Without a configured pack SuperDoc advertises and renders only a safe baseline (one font per CSS generic), so an unconfigured app never fetches a bundled substitute it cannot serve. Configuring the pack (@superdoc/fonts, fonts.assetBaseUrl/resolveAssetUrl, or the CDN build) lights up the full reviewed set, gated by config presence rather than a runtime probe.
createSuperDocFonts({ include / exclude }) curates the pack by Word family name, validated against the offerings so a typo fails fast at setup time. Activation is document-scoped in the resolver and offerings and folded into the resolver signature, so a no-pack or curated document never reuses a full-pack document's measures. A CI drift check keeps the generated curatable list in sync with the offerings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02aa7d5c10
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The optional bundled-font pack publishes under the org's npm scope, @superdoc-dev, not @superdoc. Renames the package and every reference: the runtime install warning, the getting-started examples (deps + imports), the docs plus the docs import allow-list, and the workspace lockfile. @superdoc/font-system (the internal, unpublished package) is unchanged.
Georgia is a pack-enabled rich option, not part of the one-per-generic baseline, so the no-pack union expectation should not list it. Drop the stale entry that failed once the baseline dropped to three.
Cut code-narrating and cross-file-repeating prose flagged in review: the baseline and curatable-names JSDoc, the createSuperDocFonts and composeToolbarFontOptions headers, and a headless-toolbar paragraph the constants table already covers. The load-bearing why stays.
The package was renamed to @superdoc-dev/fonts, but the manual-publish prose still named the old @superdoc org/scope. A stale operator runbook can misdirect the publish, so align it with the package name.
A non-array include/exclude in hand-written fonts.bundled (e.g. `include: 'Calibri'`) made normalizeList call .map on a string and throw during editor init, and made warnUnknownBundledSelection spread the string into per-character warnings. Coerce non-arrays to empty in both paths so a wrong shape degrades to the full pack and warns once, honoring the warn-not-crash contract. createSuperDocFonts stays the strict path.
|
This pull request landed on |
|
🎉 This PR is included in superdoc-cli v0.18.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.17.0 |
|
🎉 This PR is included in @superdoc-dev/mcp v0.13.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.41.0 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.12.0 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.13.0 |
Bundled font availability is now explicit and predictable, closing the gap the 1.40 toolbar rollback left open. Without a configured pack, SuperDoc shows a safe baseline (one Word font per CSS generic: Arial, Times New Roman, Courier New) and renders logical names with system fonts, so an unconfigured app never fetches a substitute it cannot serve. Configuring the pack (
superdocFonts,fonts.assetBaseUrl/fonts.resolveAssetUrl, or the CDN build) lights up the full reviewed set, gated by config presence rather than a runtime probe.createSuperDocFonts({ include / exclude })curates the pack by Word family name, validated against the offerings so a typo fails fast at setup time.FontFaceSetregistration is untouched) and folded into the resolver signature, so a no-pack or curated document never reuses a full-pack document's measures.@superdoc-dev/fonts(the org's npm scope) so it can be published, updating the runtime warning, the getting-started examples, the docs, and the docs import allow-list.@superdoc-dev/fonts@0.1.0still needs its first manual publish before the examples can leaveworkspace:*.