Skip to content

docs(spec): define responsive theme adaptations - #5806

Merged
imdreamrunner merged 1 commit into
mainfrom
docs/responsive-theme-tiers-spec
Sep 2, 2026
Merged

docs(spec): define responsive theme adaptations#5806
imdreamrunner merged 1 commit into
mainfrom
docs/responsive-theme-tiers-spec

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

Themes need opt-in adaptations for environmental conditions without a second theme, handwritten media-query CSS, or React styling state.

Accepted contract

  • adaptations, not responsive or responsiveness.
  • widthBreakpoints, not generic breakpoints.
  • Named {when, value} rules, not positional tuples.
  • Nested width: {from, below}, not flat minWidth / maxWidth.
  • Fields in when are ANDed.
  • Width points mark tier starts; from is inclusive and below is exclusive.
  • Rules follow authored cascade order; later matching writes win.
  • Source and built themes preserve equivalent adaptation data for extends.
  • Breakpoint configuration alone emits no CSS.
defineTheme({
  adaptations: {
    widthBreakpoints: {
      sm: 640,
      md: 768,
      lg: 1024,
      xl: 1280,
      '2xl': 1536,
    },
    rules: [
      {
        when: {
          width: {from: 'lg', below: 'xl'},
          pointer: 'coarse',
          contrast: 'more',
        },
        value: {
          components: {/* overrides */},
        },
      },
    ],
  },
});

Approval

Cindy approved the complete contract at adf1b531b2. This update records that decision as authority: current, phase: accepted, approved_by: cixzhang, with no open questions.

Because the spec-owner gate binds approval to the exact commit, this metadata-only promotion invalidates the previous head approval and needs one final approval on the promoted head.

Relationship to #5543

#5543's public tier API is superseded by this accepted contract and must not land as-is. Its value resolver, explicit-value preservation, CSS generation/build parity, and extension metadata remain useful implementation evidence.

Risk

Knowledge only. No runtime, package, or consumer behavior changes. The AppShell equality change is identified as breaking for the later implementation.

Validation

  • pnpm check:knowledge -- --base origin/main
  • pnpm check:repo
  • Prettier, diff, stale-vocabulary, and public-content checks

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 2, 2026 8:51pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 1, 2026
@cixzhang
cixzhang force-pushed the docs/theme-token-palette-spec branch 3 times, most recently from 0566355 to 00f9597 Compare September 1, 2026 02:03
@cixzhang
cixzhang force-pushed the docs/responsive-theme-tiers-spec branch from bd9359e to fbd16e3 Compare September 1, 2026 03:06
@cixzhang
cixzhang changed the base branch from docs/theme-token-palette-spec to main September 1, 2026 03:06
@cixzhang
cixzhang force-pushed the docs/responsive-theme-tiers-spec branch from fbd16e3 to 6e96207 Compare September 1, 2026 04:29

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theme authors who need one coarse-pointer rule across all widths would still have to duplicate it across manufactured width tiers, although the intent promises width or pointer adaptation.

Thanks—fixed tiers, sparse matching, inheritance, pins, and compiler parity are much clearer. Before this draft is ready:

  • Make the pointer choice explicit: can pointer rules stand alone, and are conditions nested under width or represented as a flat, closed model?
  • The built-theme requirement preselects always-on metadata even though the draft leaves that bundle-cost choice open. State both compatibility outcomes.
  • Keep #5543 as evidence, but move branch-specific rollout steps into an implementation plan so this specification survives a replacement implementation.

[Reviewed by Robohands]

@cixzhang

cixzhang commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Visible review summary — suggestions for Ivor to resolve, not a prescribed API rewrite.

The full three-option exploration is on the implementation PR: #5543 (comment)

Before this draft can become current, it should settle three contract questions:

  • Condition shape: can pointer rules stand alone across all widths, and are width/pointer combinations represented by a flat closed model or by nesting one axis under another?
  • Built-theme compatibility: describe both outcomes for condition metadata—retained for runtime inspection versus compiled away—rather than preselecting permanent bundle cost while the choice remains open.
  • Durable rollout: keep feat(theme): ordered environmental adaptations in defineTheme #5543 as implementation evidence, but move branch-specific migration steps out of the specification so a replacement compiler can satisfy the same contract.

My exploration leans toward a flat, closed adaptations model because it can express width-only, pointer-only, and combined rules without promising arbitrary CSS media syntax. That direction still needs canonical identity, precedence, conflict, inheritance, and diagnostics before it is dependable. @imdreamrunner owns the final shape after weighing those guarantees against implementation cost.

@imdreamrunner imdreamrunner changed the title docs(spec): propose responsive theme width tiers docs(spec): define responsive theme adaptations Sep 1, 2026
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from 6e96207 to db3fe12 Compare September 1, 2026 22:16
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from db3fe12 to b6a7209 Compare September 1, 2026 23:09
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from b6a7209 to 70b33cf Compare September 2, 2026 00:49
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from 70b33cf to 21357e2 Compare September 2, 2026 01:13
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from 21357e2 to adf1b53 Compare September 2, 2026 16:05
@imdreamrunner
imdreamrunner marked this pull request as ready for review September 2, 2026 16:49
@github-actions github-actions Bot added the spec-auto-merge Auto-merge was enabled by the spec owner gate label Sep 2, 2026
@imdreamrunner
imdreamrunner force-pushed the docs/responsive-theme-tiers-spec branch from adf1b53 to f4c4f07 Compare September 2, 2026 20:47
@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed spec-auto-merge Auto-merge was enabled by the spec owner gate labels Sep 2, 2026
@imdreamrunner
imdreamrunner merged commit 621c401 into main Sep 2, 2026
24 of 25 checks passed
@github-actions
github-actions Bot deleted the docs/responsive-theme-tiers-spec branch September 3, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants