From 0b3a9e0f23e0313296566842c50018c635b426fa Mon Sep 17 00:00:00 2001 From: DavidBabinec Date: Tue, 13 Oct 2026 16:19:35 +0200 Subject: [PATCH] fix(framework): set the root font size the rem scale assumes The framework converts every type and spacing token to rem against rootFontSize (10 in the Core preset), but nothing set html font-size, so at the 16px browser default every token rendered 1.6x larger than the scale says. A new emitRootFontSize preference makes the framework emit html { font-size: 62.5% } (rootFontSize / 16 as a percentage) in both the published framework.css and the canvas iframes. The Core preset turns it on for new frameworks; existing sites have no stored value, which means off, so they keep rendering exactly as before. Site settings > Publishing gets a toggle to opt in. --- docs/features/canvas-iframe-per-frame.md | 2 +- docs/features/publisher.md | 2 +- docs/features/site-shell.md | 6 +- src/__tests__/framework/rootFontSize.test.ts | 119 ++++++++++++++++++ .../framework/typographySpacing.test.ts | 2 + .../persistence/validateSiteRoundTrip.test.ts | 11 ++ .../Settings/sections/PublishingSection.tsx | 21 ++++ src/core/framework-schema/schemas.ts | 11 ++ src/core/framework/coreFrameworkPreset.ts | 6 +- src/core/framework/generate.ts | 31 ++++- src/core/framework/manageFramework.ts | 9 +- src/core/framework/scale.ts | 5 + 12 files changed, 214 insertions(+), 11 deletions(-) create mode 100644 src/__tests__/framework/rootFontSize.test.ts diff --git a/docs/features/canvas-iframe-per-frame.md b/docs/features/canvas-iframe-per-frame.md index 201ea3355..7b8f31f87 100644 --- a/docs/features/canvas-iframe-per-frame.md +++ b/docs/features/canvas-iframe-per-frame.md @@ -124,7 +124,7 @@ Five `