feat(docs): add light/dark mode support for images and icons #11360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #8497
Adds support for light/dark mode variants for all image and icon fields in
docs.ymlconfiguration. Users can now specify different assets for light and dark themes using either a simple string path (backward compatible) or an object with separatelightanddarkproperties.Link to Devin run: https://app.devin.ai/sessions/8a0f273f51024c6e866e87ddb32e1601
Requested by: Catherine Deskur (catherine@buildwithfern.com)
Changes Made
ImageConfigandIconConfigunion types to the Fern definition that accept either a string or themed objectThemedImageandThemedIconinterfaces toParsedDocsConfigurationresolveThemedIcon,resolveThemedImage,resolveIconConfigToSingleValue)DocsDefinitionResolverwithresolveIconFileId,resolveStringIconFileId, andresolveThemedImageFileIdmethodsApiReferenceNodeConverterandtoPageNode.tsto handleThemedIcontypeExample usage:
Updates Since Last Revision
docs-resolverby updatingresolveIconFileIdto acceptThemedIcon | undefinedresolveStringIconFileIdfor navbar links (FDR SDK types expectstring | undefined)resolveThemedImageFileIdfor product imagesApiReferenceNodeConverter.tsandtoPageNode.tsto handleThemedIcontypehiddenproperty inPlaygroundSettingsthat was accidentally removed during SDK regenerationNode18UniversalStreamWrapper.ts,UndiciStreamWrapper.ts) that had unrelated formatting changes from SDK regenerationTesting
pnpm run check)pnpm -F @fern-api/docs-resolver compile)Human Review Checklist
ThemedIcon/ThemedImagetypesresolveStringIconFileIdwhich extracts a single icon (prefers light, then dark) because FDR SDK types expectstring | undefined. Full themed support for navbar links would require FDR SDK updates.PlaygroundSettings.hiddenproperty restoration is correct