Repository navigation
feat(theme): export the compact definition (AST-012 FR9) - #8301
Merged
Merged
Conversation
A screen is compact while its viewport is narrower than the theme's effective md point or shorter than 500 (spec:AST-012 FR9). The theme now exports that one definition: compactDefinition(widthBreakpoints?) and DEFAULT_COMPACT_DEFINITION carry both edges and the media queries with and without a coarse pointer, so presentation resolvers read one shared definition instead of keeping size numbers of their own. No consumer moves in this change; behavior is unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
Contributor
PR Analysis Report
|
Contributor
There was a problem hiding this comment.
No blocking issues found: compactDefinition and DEFAULT_COMPACT_DEFINITION match spec:AST-012 FR9, with exclusive edges at the theme's md width and at 500 tall, and the tests pin both the default and an overridden md. No changes are needed here; moving the adaptive resolvers onto the definition stays with the follow-up changes the description names.
[Automated review]
4 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User need
Components that pick a presentation by screen size each keep their own size numbers. Today Selector, MultiSelector, ContextMenu and DropdownMenu use
(max-width: 768px) and (pointer: coarse), and new touch work proposes other numbers. As a result, the same phone can get a bottom sheet from one component and a popover from another, and a landscape phone (wide but short) gets a popover where it has no room for one.spec:AST-012FR9 says compact has one definition that the theme exports and every resolver uses. Without the export, each resolver still has to restate the numbers.Problem and solution fit
This PR adds the one exported definition and nothing else. Moving each resolver onto it is its own change, with its own release note.
Current specification
spec:AST-012FR9 (current): a screen is compact while its viewport width is below the effectivemdpoint or its height is below 500, with the same numbers on every platform. The theme exports this one definition, and a resolver that also needs a coarse pointer ANDs that with compact.spec:AST-012DEC-6 (current).architecture:public-component-apiINV17 (current): a component that chooses a presentation by screen size uses the theme's compact definition and keeps no compact numbers of its own.Public delta and caller burden
New exports from
@astryxdesign/core/theme:CompactDefinitionholdswidthBelow(the effectivemd),heightBelow(500),queryandcoarsePointerQuery, and is frozen.Design and alternatives
themeAdaptations.ts, so its width edge is the theme's ownmdand never a second copy.width < Npx).Evidence
mdto 800 getswidthBelow800 with the height edge unchanged;Scope
Testing
pnpm exec vitest run --project ui packages/core/src/theme: 24 files, 1,510 tests pass.pnpm check:changesetspass.