Skip to content

Give renderer components owned and inheritable styles - #135

Merged
tenphi merged 13 commits into
mainfrom
codex/component-style-ownership
Oct 2, 2026
Merged

tenphi merged 13 commits into
mainfrom
codex/component-style-ownership

Conversation

@tenphi

@tenphi tenphi commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Replacing Header previously removed fonts, document defaults, and unrelated UI styling because Header rendered the shared GlobalStyles collector. Initialize foundations from the common page shell and give each component an owning style module. Built-in and consumer components now share configurable component creation and inheritance.

  • Replace GlobalStyles, LayoutComponents, and TastyComponents with component-owned definitions. Reduce useGlobalStyles declarations from 27 to 12, reserved for document foundations and generated-content bridges. MarkdownContent collects its bridges; CodeGroup also collects code and syntax styles independently.
  • Unify creation and theme customization under defineComponent(name, options), removing customizeComponent. Add extendComponent(name, base, options), preserving inherited props, variants, states, and compound parts. Export a configurable Button foundation shared by search and mobile-menu buttons. Resolve partial theme overrides before static CSS extraction; inherit base customization without mutating bases or siblings.
  • Keep the existing theme.styles component names and publish the corrected sub-element inventories. Keep foundations independent of replaceable Header/Head components, including 404 pages, and preserve the server-only Tasty/Glaze boundary in consumer builds.
  • Register shared @light/@dark appearance states with explicit-theme precedence, @system-light/@system-dark for document-root automatic appearance, and @popover-open for descendant panel states. Use registered warning palette roles for Markdown warning alerts.
  • Upgrade Tasty from 3.8.0 to 3.9.6 and its ESLint plugin from 1.1.0 to the published 1.5.1 release. Register local style helpers, remove the blanket shorthand exemption, and require zero warnings in lint/fix, CI, and release gates. Add exact release-age exceptions for these reviewed versions in pnpm and the Yarn consumer fixture.
  • Migrate native properties to Tasty shorthands and supported selector conditions to property state maps. Keep conditional omissions, explicit media dimensions, prose spacing, and current-link appearance. Give copy controls and popover panels explicit Tasty identities so anatomy overrides stay scoped. Document narrow ignores for deliberate shared-style spreads, build-only SVG encoding, ten pseudo-element selectors that Tasty currently compiles incorrectly, and four empty legacy customization hooks whose conditional override scope must remain compatible.
  • Use Tasty’s built-in data-element identities for Header, Footer, and logo parts. Remove legacy data-tasty-anatomy markers from built-in definitions, markup, and generated code blocks. Root defaults own their identity, and markup imports those owners without repeating the attribute. Scope Header’s search wrapper separately from the nested Search component.
  • Apply the new valid-sub-element diagnostics: move callout kinds, alert kinds, hover/active buttons, sidebar visibility, focus, compact selection, and code wrapping into root state maps. Keep syntax category sub-elements scoped to descendants and root category states scoped to the code element. Adopt prefer-element-selector autofixes and verify the new rules in packed ESLint/oxlint consumers. Verify one mergeStyles warning for typed shallow style composition, a clean mergeStyles replacement, and no automatic behavior-changing rewrite.
  • Model heading levels and page-title spacing as root property state maps. Fold panel position into Panel padding-token maps. Footer’s hover and only-child behavior belongs to actual MetaLink, MetaUpdated, and CreditLink parts; remove overlapping generic selectors.
  • Replace one-sided margin/padding patches with paired tokens consumed by blockMargin/blockPadding. Contextual prose spacing changes the start token while preserving an owned or customized end margin. Register spacing property types and reset their defaults per element so nested content does not inherit another element’s spacing.
  • Document authoring, inheritance, state-map overrides, merge order, and every customization surface. Use Tasty 3.9.6, including its null-display and transition-timing fixes, and document supported null display branches. Verify that the released selector rule reports the original responsive-media declarations as warnings without autofixing them.

Validation: several review/fix rounds; 377 unit tests and all 61 browser tests; desktop/mobile and light/dark computed-style comparisons; TypeScript checks; zero-warning lint; formatting; package boundaries; unused-dependency checks; theming, authoring, and recipe consumer builds; packed npm and Yarn installations with public TypeScript and ESLint/oxlint validation; reference CSS/JS/font/image budgets. Browser coverage includes built-in data-element identities, the absence of legacy markers, independent metadata states, custom end-margin preservation, nested spacing-token isolation, heading-level customization, anatomy override scope, compact root-state customization, retained media dimensions, prose and tab spacing, inherited button defaults, custom Header/Head and standalone CodeGroup, appearance precedence, menus, search, code copy, accessibility, and responsive logos. CI also runs the packed-consumer matrix across npm, pnpm, Yarn, Linux, macOS, Windows, and supported Node versions.

@tenphi tenphi changed the title Give renderer components ownership of their styles Give renderer components owned and inheritable styles Oct 1, 2026
@tenphi
tenphi merged commit 00f14de into main Oct 2, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 2, 2026
tenphi added a commit that referenced this pull request Oct 15, 2026
…rders (#160)

- Sidebar: the next item's fill covered the lower edge of a focused
  link's ring. `Sidebar.InteractiveControl` now positions focus-visible
  controls with `z-index: 1`, so the ring draws above its neighbors.
- Main content: `#main-content` (tabindex -1) receives focus when its
  text is clicked, and a key press then made it match :focus-visible, so
  keyboard scrolling drew the browser's ring around the whole article.
  It is a skip-link and page-swap target, not a control; drop its
  outline.
- Pagination: #135 reduced the link's `$border-width solid #border` to a
  bare `borderColor` when the top-bar icon borders were removed, and #147
  made it `#clear`, so links lost their resting border. Restore
  `border: true`. Hover only recolors, so geometry is unchanged and
  `theme.styles.Pagination.Link` border overrides still apply.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to 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