Applying a theme migration
compareThemeLayouts() reports layout differences; applyThemeMigration() turns that report into a next draft only after every loss or addition has an explicit decision.
- Missing or incompatible current slots require
discardbefore their content is omitted. - Required new slots require
add; optional new slots require eitheraddorskip. - Added sections are initialized from the component’s schema-approved default content.
- The returned result is a draft only. Authorization, review, and audit remain outside this helper. On Cloudflare,
TenantWorkspaceThemeStore.switchDraft()atomically saves the returned document and target theme selection with optimistic versions;publishSite()later publishes that exact pair.
The initial implementation covers the current typed component registry. Future component mappings can add explicit conversion decisions rather than silently coercing incompatible content.