Repository navigation
feat(theme): add shared component adaptation infrastructure - #6127
imdreamrunner wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
47fab13 to
fd9005a
Compare
b7df64c to
9a2f061
Compare
fd9005a to
f1100aa
Compare
9a2f061 to
02ad5e4
Compare
f1100aa to
f5f7b46
Compare
02ad5e4 to
eb67cdb
Compare
f5f7b46 to
689b632
Compare
Extract AST-012 condition normalization and media-query compilation into a package-internal module shared by theme CSS generation and a new component adaptation resolver (spec:AST-031 IR1). Theme output and diagnostics are byte-identical. Add package-internal ComponentAdaptations/ComponentAdaptationRule/ ComponentAdaptationCondition value types, a useComponentAdaptations resolver (server default, last matching rule wins), and an effective-width-point accessor that AppShell now uses instead of reading DefinedTheme.__adaptations. AST-031 is still a draft, so nothing here is exported from the package entry point and there is no public behavior to release. The resolver separates the per-render store handle from the shared connection that owns the MediaQueryLists: only subscribe registers a connection, so a server or abandoned render leaves the registry empty; subscribe re-registers, so identical policies still share after a StrictMode remount; and attachment is tracked explicitly, so a connection opened before matchMedia exists still attaches once it does. ComponentAdaptations.rules is required and may be empty; an empty policy resolves to default everywhere and subscribes to nothing. No component behavior changes.
eb67cdb to
b22bf71
Compare
689b632 to
68e51bf
Compare
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval of this draft waits on a maintainer decision: no spec on main governs the shared component-adaptation layer (ComponentAdaptations<T> and useComponentAdaptations), because the AST-031 proposal in #6123 was closed without merging and AST-012 keeps component behavior separately owned. A maintainer needs to provide or identify that spec, including whether this layer should exist alongside the presentation prop that AST-043 and Selector's spec already use to choose a surface. Whatever the answer, these changes are needed:
- Split the 3,222-line change so the AppShell width-point accessor can land on its own, apart from the component layer.
- Keep the condition vocabulary and validation in
themeAdaptations.ts, whicharchitecture:theme-authoring-contractnames as their owner, or have that record updated first. - Replace the AST-031 citations, because that id now belongs to an unrelated record on main, and retarget the PR onto main, because its base branch no longer exists.
[Automated review]
| @@ -468,7 +470,9 @@ export function AppShell({ | |||
| ...rest | |||
| }: AppShellProps) { | |||
| const t = useTranslator(); | |||
| const activeTheme = useThemeDefinition(); | |||
| // Named width points resolve through the shared accessor (spec:AST-031 FR5), | |||
There was a problem hiding this comment.
spec:AST-031 on main is the runtime-integration feature composition spec, and its FR5 is about CLI gap-report handlers. This lookup is governed by AST-012 FR8 and architecture:theme-application INV10; please cite those instead.
| * @input Authored adaptation conditions and width-breakpoint maps | ||
| * @output Package-internal condition vocabulary, normalization, and media-query | ||
| * compilation shared by every adaptation consumer | ||
| * @position Shared owner of AST-012 condition semantics (spec:AST-031 IR1); |
There was a problem hiding this comment.
architecture:theme-authoring-contract names themeAdaptations.ts as the owner of the breakpoint/condition vocabulary and its validation. Either keep these definitions there and import them into componentAdaptations.ts, or update that record before moving ownership here.
|
(Posted by Cindy's agent.) Thank you, @imdreamrunner! This shared adaptation layer existed to serve the DateInput and Selector adaptations, and both now ship through each component's |
Summary
ComponentAdaptations<T>types and a private theme-aware resolveruseSyncExternalStoresubscription keyed by compiled query stringsValidation
This is draft infrastructure stacked on #6123, which is stacked on #5543. It does not change a component's public behavior.