Repository navigation
spec(native): Astryx looks as SwiftUI styles, with views built on them - #8091
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec cfc164b |
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression46 of 494 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 26 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Requesting changes on two small points in the Swift styles spec; the direction itself is owner-approved on this head.
- The Relation line extends
packages/native/specs/swift/library/component-api.md, which is not in this branch or onmainyet (it arrives with #8035), and Y1 and Y3 also rely on the theme environment from #8040 without naming it: land after both or stack on them, and name the theme environment record in the Relation line. - Y1 and Y3's last sentence would require styles for Picker and TextField, which Y3 excludes because
PickerStyleandTextFieldStyletake no custom conformance: scope both to controls whose style protocol accepts a custom conformance.
Because approval is tied to the exact head, a fixed head needs a fresh /approve-spec <full head SHA> from an engineering owner.
[Automated review]
| # SwiftUI styles (Swift) | ||
|
|
||
| - Status: draft | ||
| - Relation: extends `packages/native/specs/swift/library/component-api.md` |
| tint and text colors from the theme environment. A component added later | ||
| joins this table when its core contract matches a SwiftUI control with a | ||
| public style protocol. |
There was a problem hiding this comment.
PickerStyle and TextFieldStyle are public protocols, so this rule, and Y1's scope at lines 19-21, would admit the Selector and TextInput styles that lines 42-43 rule out. Suggested wording: "...matches a SwiftUI control whose style protocol accepts a custom conformance."
|
/approve-spec 86c2e77 |
There was a problem hiding this comment.
Requesting changes on one remaining point; the direction is owner-approved, and the earlier scope fix (only style protocols that accept a custom conformance) is in. The Relation line extends component-api.md and reads the theme through theme-environment.md, but neither file is on main yet (they arrive with #8035 and #8040), so merging this now would leave the record's basis, and the theme environment Y1 and Y3 rely on, pointing at files that do not exist. Once both land, rebase onto them (or stack this branch on #8040) and post a fresh /approve-spec <full head SHA> for the new head, which you can do as an engineering owner. Two non-blocking gaps are worth settling in the same pass: which visual props .astryx takes where one protocol serves two components (ProgressBar and Spinner; Switch and CheckboxInput), and which components the LabelStyle, LabeledContentStyle and ControlGroupStyle rows style.
[Automated review]
| - Relation: extends `packages/native/specs/swift/library/component-api.md`, | ||
| reads the theme as `packages/native/specs/swift/library/theme-environment.md` | ||
| says, and applies AST-093 FR2 (native-first: a component sits on the platform's | ||
| own control). It decides how Astryx's look reaches SwiftUI's own controls. |
There was a problem hiding this comment.
component-api.md and theme-environment.md are not in this branch or on main yet: they arrive with #8035 and #8040, and #8040 itself lands after #8031, #8038 and #8035. Y1, Y3 and the Y1 capture check rest on them, so merging this head first would leave both paths pointing at nothing. Once they land, rebase onto them (or stack this branch on #8040) and post a fresh /approve-spec <full head SHA>.
|
/approve-spec 5a7e08e |
5a7e08e to
876fee3
Compare
|
/approve-spec 876fee3 |
There was a problem hiding this comment.
Requesting changes on one remaining point: the direction is owner-approved on this head, but the Relation line (styles.md:4-6) still extends component-api.md and reads the theme through theme-environment.md, and neither file is on main yet (they arrive with #8035 and #8040), so merging this first would leave the record's basis, and the theme environment Y3 relies on, pointing at files that do not exist. Once both land, rebase onto them and post a fresh /approve-spec <full head SHA> for the new head, which you can do as an engineering owner. Worth settling in the same pass:
- Which input picks the checkbox or spinner look where one protocol serves two components (
ToggleStyle,ProgressViewStyle), and which components theLabelStyle,LabeledContentStyleandControlGroupStyleentries style. - Y5's "a style draws only" does not hold for
ToggleStyle, since a custom toggle style has to flip the on state itself. - The
Link,NavigationLinkandShareLinkcompile check passes for any view, so only a capture shows they take the Astryx look.
[Automated review]
| | `ToggleStyle` | Switch; CheckboxInput on macOS | | ||
| | `ProgressViewStyle` | ProgressBar, Spinner | |
There was a problem hiding this comment.
ToggleStyle and ProgressViewStyle each carry two looks (Switch and macOS CheckboxInput; ProgressBar and Spinner), but Y4 gives each protocol one type behind .astryx and Y2 allows only core visual props, none of which picks the look. Name the input that chooses the checkbox or the spinner, or give each look its own member.
| - **Y5 — Accessibility comes from the system control.** A style draws only; | ||
| the control keeps its name, traits, actions, and focus. A stock control |
There was a problem hiding this comment.
"A style draws only" does not hold for ToggleStyle: SwiftUI leaves a custom toggle style to flip configuration.isOn itself. Say whether the Astryx toggle style composes the system switch (keeping AST-082 FR11's switches on the platform control) or draws and drives its own.
|
|
||
| | Requirement | Check | | ||
| | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Y1 | A compile test applies every Y3 style to its SwiftUI control through `.astryx`; `Link`, `NavigationLink`, and `ShareLink` accept `.buttonStyle(.astryx(…))`; a source check finds no public protocol declared by Astryx whose name ends in `Style`. | |
There was a problem hiding this comment.
.buttonStyle(_:) is a modifier on every View, so this compile check passes whatever Link, NavigationLink and ShareLink draw; a capture like the Button one on the next row would show they take the Astryx look.
876fee3 to
a419530
Compare
|
/approve-spec a419530 |
There was a problem hiding this comment.
Requesting changes on one point: the direction is owner-approved on this head and the records the Relation names are now on main, but the LabelStyle row gives DropdownMenu items Astryx's label layout (styles.md:39) while the MenuStyle row keeps the menu's contents system (:40), and a SwiftUI menu presents its items with the system layout, so a DropdownMenu built from this record cannot satisfy both. Dropping "and DropdownMenu items" from the LabelStyle row, or saying the items keep the system layout, fixes it; the new head then needs a fresh /approve-spec <full head SHA>, which you can post as an engineering owner. Smaller points worth settling in the same pass:
- Y1's "
.astryx<Component>where one protocol styles more than one component" does not match the single.astryxforButtonStyleandLabelStyleor the.astryxCheckboxname. theme-environment.mdE2 still says corner radius, spacing, element heights, borders and backgrounds are read only by Astryx components, which the styles now also read.- The Y1 capture check's bare
Linknames Astryx's own view in a file that imports only Astryx;SwiftUI.Linkis meant.
[Automated review]
| | `LabelStyle` | `.astryx` | the icon-and-label layout of Button, Badge, and DropdownMenu items | | ||
| | `MenuStyle` | `.astryx` | DropdownMenu trigger (menu contents stay system) | |
There was a problem hiding this comment.
These two rows conflict for DropdownMenu items: the LabelStyle row gives them Astryx's icon-and-label layout, while the MenuStyle row keeps the menu's contents system, and a SwiftUI Menu presents its items in the system menu, which does not draw a custom LabelStyle. Dropping "and DropdownMenu items" from the LabelStyle row, or saying the items keep the system layout, resolves it.
| conformance, Astryx ships a conformance to that control's style protocol, reached as `.astryx` (or `.astryx<Component>` where one protocol styles | ||
| more than one component, Y3) with only the component's core visual props as |
There was a problem hiding this comment.
Non-blocking: Y3 gives ButtonStyle (Button, IconButton) and LabelStyle (three components) a single .astryx each, and names CheckboxInput's member .astryxCheckbox, so "where one protocol styles more than one component" does not match the table; "where one protocol carries more than one look" would.
| | Requirement | Check | | ||
| | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Y1 | A compile test applies every Y3 style to its SwiftUI control through its Y3 member; a source check finds no public protocol declared by Astryx whose name ends in `Style`. | | ||
| | Y1 | A capture test draws `SwiftUI.Button("x") {}.buttonStyle(.astryx(variant: .primary))` and `Button("x", variant: .primary) {}` identically in two themes, light and dark. `Link`, `NavigationLink`, and `ShareLink` with `.buttonStyle(.astryx(variant: .primary))` draw the same look. | |
There was a problem hiding this comment.
Non-blocking: in a test file that imports only Astryx, a bare Link names Astryx's own view (component-api.md A1a and A1b), so SwiftUI.Link says which one this check means.
…styles read the theme's own values
|
/approve-spec baf628c |
There was a problem hiding this comment.
This looks ready to approve: the Swift styles record is owner-approved on this head, contradicts nothing in AST-082 or AST-093, and its LabelStyle and MenuStyle rows no longer overlap. Two points are worth a follow-up, neither blocking:
- Y1's member rule says a protocol that styles one component reaches it as
.astryx, butButtonStyle(Button, IconButton) andLabelStyle(Button, Badge) each serve two and CheckboxInput's member is.astryxCheckbox, so "a protocol with one Astryx look" would match the table. - The record leaves open which props count as core visual props, what
LabelStyle's.astryxtakes, what CheckboxInput draws on iOS, and whether ToggleButton, Collapsible and Link join the Y3 table.
Any further commit needs a fresh /approve-spec <full head SHA> from an engineering owner, which you can post yourself as one.
[Automated review]
| conformance, Astryx ships a conformance to that control's style protocol, with only the component's core visual props as parameters. A protocol that | ||
| styles one component reaches it as `.astryx` (`ButtonStyle`, `LabelStyle`, | ||
| `MenuStyle`, `GroupBoxStyle`, `LabeledContentStyle`, `ControlGroupStyle`); | ||
| one that styles several reaches each as `.astryx<Component>` (`.astryxSwitch`, | ||
| `.astryxCheckbox`, `.astryxProgressBar`, `.astryxSpinner`). Each style reads the theme from the |
There was a problem hiding this comment.
Non-blocking: this rule says a protocol that styles one component reaches it as .astryx, but ButtonStyle serves Button and IconButton (line 38), LabelStyle serves Button and Badge (line 41), and CheckboxInput's member is .astryxCheckbox rather than .astryxCheckboxInput. "A protocol with one Astryx look reaches it as .astryx; one with several reaches each look as .astryx<Look>" would match every member in Y3.
| | `ButtonStyle` | `.astryx(variant:size:elevation:)` | Button, IconButton; also SwiftUI's own `Link`, `NavigationLink`, and `ShareLink`, which SwiftUI styles with `ButtonStyle` | | ||
| | `ToggleStyle` | `.astryxSwitch`; `.astryxCheckbox` on macOS | Switch; CheckboxInput | | ||
| | `ProgressViewStyle` | `.astryxProgressBar`; `.astryxSpinner` | ProgressBar (determinate or not); Spinner | | ||
| | `LabelStyle` | `.astryx` | the icon-and-label layout of Button and Badge | |
There was a problem hiding this comment.
Non-blocking: Y2 gives a style the component's core visual props with the generated types, but this row serves Button (ButtonVariant, ButtonSize, ButtonElevation) and Badge (BadgeVariant only), so the parameters of this .astryx are undefined; naming them, or saying this style takes none, closes the gap.
Exact decision needed
Astryx ships its look as SwiftUI styles: look-only conformances to SwiftUI's style protocols, reached as
.astryxwith only a component's core visual props, and Astryx's own views are built on them. The owner chose this direction; the record states it.Existing authority searched
spec:AST-093FR2 (native-first: components sit on the platform's own control).packages/native/specs/swift/library/component-api.md): names, the contract as parameter list, and no styling parameters beyond the contract. This record adds styles beside the views without changing that spec.Decision
.astryxwith only the core visual props; each style reads the theme; the view is the control plus that style plus behavior props; Astryx declares no style protocol of its own.ButtonStyle.astryx(variant:size:elevation:)for Button/IconButton and SwiftUI's ownLink,NavigationLink,ShareLink;ToggleStyle.astryxSwitch(Switch) and.astryxCheckboxon macOS (CheckboxInput);ProgressViewStyle.astryxProgressBarand.astryxSpinner;LabelStylefor the icon-and-label layout of Button and Badge;MenuStylefor the DropdownMenu trigger;GroupBoxStylefor Card;LabeledContentStylefor Field;ControlGroupStylefor ButtonGroup.PickerStyleandTextFieldStyleaccept no custom conformance, so Selector and TextInput use system styles with the theme's tint.Astryx<Control>Style, since the unprefixed name is SwiftUI's protocol; callers write.astryx.ToggleStyleis the exception, so the Astryx toggle styles keep the toggle trait and value and act on a tap or the default action.Rejected alternatives
None recorded in the spec.
Also in this pull request
One line in
theme-environment.mdE2: the theme values with no SwiftUI equivalent (radius, spacing, heights, borders, backgrounds) are read by Astryx components and Astryx's SwiftUI styles.Claim scope and non-goals
No change to the component API spec. Which style parameters exist follows each component's generated contract.
Landing order
Builds on the component API spec (#8035) and reads the theme as the theme environment spec (#8040) says; lands after both.
Evidence and implementation relationship
One file:
packages/native/specs/swift/library/styles.md.Writing rubric results
Scope
packages/native/.