Skip to content

refactor(ui-css): split module styles - #487

Merged
Astro-Han merged 5 commits into
mainfrom
codex/module-styles-split
Jul 3, 2026
Merged

refactor(ui-css): split module styles#487
Astro-Han merged 5 commits into
mainfrom
codex/module-styles-split

Conversation

@Astro-Han

@Astro-HanAstro-Han commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Split apps/desktop/src/renderer/styles/module-pages.css into focused module-page child stylesheets under styles/module-pages/.
  • Move shared/global selectors out of styles/module-pages/ to their real owners: field focus, SettingsSelect, chat header, model switcher, and shared .detailPane chrome.
  • Keep module-pages.css as the same renderer import slot, now only an ordered module-page import manifest.
  • Add a renderer module styles contract so new module rules land in the owned child stylesheet and cross-owner selectors do not grow inside styles/module-pages/ again, including mixed comma selector lists.

Why

Refs #476.

PR1 made renderer CSS parseable and PR2 settled the cascade / bare-field reset path. This PR takes the next CSS hygiene step: module-pages.css was still a 2141-line mixed-domain stylesheet. Splitting it by ownership makes future CSS changes easier to review without changing the visual design.

Scope

Changed:

  • apps/desktop/src/renderer/styles/module-pages.css now imports only true module-page child styles in a fixed order.
  • apps/desktop/src/renderer/styles/module-pages/plan-reminders.css owns plan reminder styles.
  • apps/desktop/src/renderer/styles/module-pages/capability-audit.css owns CapabilityAuditStrip styles.
  • apps/desktop/src/renderer/styles/module-pages/module-shell.css owns .maka-module-* shell styles.
  • apps/desktop/src/renderer/styles/module-pages/skills.css owns skill module styles.
  • apps/desktop/src/renderer/styles/field-focus.css owns the shared renderer field focus rule from PR2.
  • apps/desktop/src/renderer/styles/settings-select.css owns the shared SettingsSelect / grouped select menu chrome.
  • apps/desktop/src/renderer/styles/chat-header.css now owns the .maka-chat-header* and chat status cluster rules.
  • apps/desktop/src/renderer/styles/model-switcher.css owns the .maka-model-switcher* trigger chrome.
  • apps/desktop/src/renderer/styles/base.css owns shared .detailPane sizing/overflow chrome.
  • apps/desktop/src/main/__tests__/renderer-module-styles-contract.test.ts pins module-pages.css as an ordered import manifest and rejects global/shared/chat/model/select selectors under styles/module-pages/**, including mixed comma selector lists.
  • apps/desktop/src/main/__tests__/renderer-important-audit-contract.test.ts now points the existing allowlist checks at the moved owner files.

Not included:

Verification

  • RED: renderer-module-styles-contract.test.js failed before the split because module-pages.css had no child imports and still contained selector rules.
  • RED: owner contract failed before the review fix on field-focus.css, chat-header-bridge.css, model-switcher.css, .settingsSelect*, and .detailPane under styles/module-pages/**.
  • RED: mixed selector-list fixture .foreign-owner, .maka-plan-card { ... } passed under the whole-rule.selector check; after splitting with postcss.list.comma, the same fixture fails on .foreign-owner, while .maka-plan-a, .maka-plan-b { ... } passes.
  • Main sync: merged origin/main after fix(ui): visual audit round — list bullets, artifact toolbar, disclosure affordance #488 and mapped its old module-pages.css.maka-skill-featured-art adjustment into styles/module-pages/skills.css.
  • Temporary declaration-equivalence check before initial split: parsed the original main:apps/desktop/src/renderer/styles/module-pages.css and the expanded split CSS with PostCSS; both had 1174 declarations, with 0 missing and 0 added.
  • Temporary declaration-equivalence check after owner fix: expanded full renderer CSS before/after the owner move; both had 7546 declarations, with 0 missing and 0 added.
  • node ../../worktree-bootstrap.mjs (inside the worktree; links @maka/* to this checkout and runs npm run rebuild)
  • Commit-level check for refactor(ui-css): move shared styles to true owners: npm run -w @maka/desktop build:main && node --test apps/desktop/dist/main/__tests__/renderer-module-styles-contract.test.js apps/desktop/dist/main/__tests__/renderer-important-audit-contract.test.js apps/desktop/dist/main/__tests__/renderer-css-parse-contract.test.js apps/desktop/dist/main/__tests__/renderer-tailwind-compile-contract.test.js
  • Commit-level check for test(ui-css): guard module style ownership: npm run -w @maka/desktop build:main && node --test apps/desktop/dist/main/__tests__/renderer-module-styles-contract.test.js
  • Commit-level check for test(ui-css): split module owner selector lists: npm run -w @maka/desktop build:main && node --test apps/desktop/dist/main/__tests__/renderer-module-styles-contract.test.js apps/desktop/dist/main/__tests__/renderer-css-parse-contract.test.js apps/desktop/dist/main/__tests__/renderer-tailwind-compile-contract.test.js apps/desktop/dist/main/__tests__/renderer-important-audit-contract.test.js
  • Post-main-sync CSS contracts: npm --workspace @maka/ui run build && npm run -w @maka/desktop build:main && node --test apps/desktop/dist/main/__tests__/renderer-module-styles-contract.test.js apps/desktop/dist/main/__tests__/renderer-css-parse-contract.test.js apps/desktop/dist/main/__tests__/renderer-tailwind-compile-contract.test.js apps/desktop/dist/main/__tests__/renderer-important-audit-contract.test.js apps/desktop/dist/main/__tests__/renderer-style-layer-cascade-contract.test.js apps/desktop/dist/main/__tests__/capability-audit-ui-contract.test.js (19 tests pass)
  • node --test apps/desktop/dist/main/__tests__/renderer-css-parse-contract.test.js apps/desktop/dist/main/__tests__/renderer-tailwind-compile-contract.test.js apps/desktop/dist/main/__tests__/renderer-important-audit-contract.test.js apps/desktop/dist/main/__tests__/renderer-style-layer-cascade-contract.test.js apps/desktop/dist/main/__tests__/renderer-module-styles-contract.test.js
  • npm run -w @maka/desktop build:renderer (passes; existing Vite chunk-size warning remains)
  • Visual screenshots from this worktree:
    • node scripts/capture-screenshots.mjs --scenario module-skills --variant light-1280-motion
    • node scripts/capture-screenshots.mjs --scenario plan-reminders --variant light-1280-motion
    • node scripts/capture-screenshots.mjs --scenario provider-workspace --variant light-1280-motion
  • npm run -w @maka/desktop test (1721 tests pass)

User-facing impact

No visual change intended. This is a CSS ownership split plus review fix. The declaration-equivalence checks and targeted screenshots above cover the affected module, capability audit, shared select, chat header, and model-switcher surfaces.

Reviewer notes

Commits are split by rollback reason:

  • refactor(ui-css): split module styles splits the old catch-all stylesheet into initial focused files.
  • refactor(ui-css): move shared styles to true owners addresses review feedback by moving global/shared/chat/model/select rules out of styles/module-pages/**.
  • test(ui-css): guard module style ownership addresses review feedback by adding an owner-scoped contract for module-page child styles.
  • test(ui-css): split module owner selector lists addresses review feedback by validating each comma-separated selector independently.
  • chore: merge main into module styles split absorbs fix(ui): visual audit round — list bullets, artifact toolbar, disclosure affordance #488 and keeps its old module-pages.css visual fix under the new styles/module-pages/skills.css owner.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Astro-Han