Codex flagged: the previous fix (b3180534) read \`doc.themes[SEMANTIC_PALETTE_THEME_AXIS]\` as the dark-mode discriminator, but \`seedDocVariablesFromStyleGuide\` — the only production writer of theme-related doc state — writes ONLY \`doc.variables\`, never \`doc.themes\`. So on a real orchestrator-emitted dark-mode design the axis is empty, the test \`modeAxis[0] === 'Dark'\` is false, and the cascade still served the LIGHT palette. The "production" dark-mode signal was wired to nothing. Fix reads the active page root's fill via \`detectThemeFromNode\`, the same heuristic \`resolveTreeRoles\` uses at its entry point to set \`ctx.theme\` for role defaults. The page root's fill is what the model / user actually painted as the page background, regardless of whether any themes axis was ever populated, so it's the production-truthful signal. New \`detectActivePageMode()\` helper reads the doc store + canvas store's activePageId, finds the first frame on that page, and runs \`detectThemeFromNode\`. Defaults to 'light' when no page root exists or it has no fill — same conservative bias as before. Test updated to seed a dark page-root fill on the live doc store (replaces the prior \`themes['Mode']\` axis seed which never matched production state). Also explicitly nulls the themes axis to confirm the fill-based detection is the active code path. |
||
|---|---|---|
| .. | ||
| public | ||
| server | ||
| src | ||
| CLAUDE.md | ||
| components.json | ||
| dev.ts | ||
| package.json | ||
| tsconfig.json | ||
| vite.config.ts | ||