Repository navigation
feat(native): Swift Card takes core's props; theme shadows reach Swift - #8307
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
10923a6 to
44ac0b4
Compare
61aafd2 to
a7ed31c
Compare
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 Regression48 of 502 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 28 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row): any engineering owner, the author included, records it by commenting /approve-spec <full head SHA> on this pull request or asks for amendments. Independently of that decision, a few fixes are needed:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in place.- A theme whose shadow token is
nonenow fails Swift generation, and mapping it to an empty layer list keeps such themes working. - The new
shadow-<level>row in G6 sits outside the table, and the collision rule below it lost its indent. - AST-093 FR5 asks for the Swift tests to run on this head and for light, dark and largest-text captures, and neither is there yet.
[Automated review]
| case .text(let text): Text(text.viewProps(send: send)) | ||
| case .heading(let heading): Heading(heading.viewProps(send: send)) | ||
| case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send) | ||
| default: EmptyView() |
There was a problem hiding this comment.
default: EmptyView() draws the .unsupported case and every other component (vStack, hStack, button, switch, …) as nothing, so a tree rooted in a VStack draws a blank screen. AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place; a visible unsupported placeholder here (and SwiftUI stacks for VStack/HStack) would conform.
| /^(inset\s+)?(\S+)\s+(\S+)\s+(\S+)(?:\s+(\S+))?\s+((?:light-dark|rgba?|hsla?|oklch)\(.*\)|#[0-9A-Fa-f]+|[a-z]+)$/s.exec( | ||
| layer, | ||
| ); | ||
| if (!m) return null; |
There was a problem hiding this comment.
none does not match the layer pattern, so a theme with --shadow-low: none (valid CSS, zero layers) now fails Swift generation entirely, where it generated before shadows were kept. Returning [] for none keeps such themes working.
|
|
||
| Two tokens that map to the same member, or a member that is a Swift keyword | ||
| or does not start with a letter, fail the run with both token names. | ||
| | `shadow-<level>` | `shadow.<level>`: `shadow-low` → `shadow.low` | |
There was a problem hiding this comment.
This row sits outside the G6 table (column 0, after a blank line), so it renders as a literal | … | paragraph, and lines 87-88 lost their indent, which moves the collision rule out of G6 and splits the requirements list. Deleting the blank line above, indenting this row by two spaces and re-indenting 87-88 fixes both.
| #expect(labeled.props.elevation == fromProps.props.elevation) | ||
| } | ||
|
|
||
| @Test func everyVariantDrawsCoresGroundAndOnlyDefaultHasABorder() { |
There was a problem hiding this comment.
This test checks the ground of 4 of the 13 variants and no borders; looping over CardVariant.allCases and asserting the border per variant would match its name.
44ac0b4 to
c7c537e
Compare
a7ed31c to
1781ce0
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in place.- A theme whose shadow token is
nonenow fails Swift generation, and reading it as an empty layer list keeps such themes working. - The new G6 row sits outside the table, and the collision rule below it lost its indent.
- AST-093 FR5's Swift test run on this revision, a largest-text Card test, and light, dark and largest-text captures are still missing.
[Automated review]
| case .text(let text): Text(text.viewProps(send: send)) | ||
| case .heading(let heading): Heading(heading.viewProps(send: send)) | ||
| case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send) | ||
| default: EmptyView() |
There was a problem hiding this comment.
default: EmptyView() draws .unsupported and every component other than Card, Text and Heading as nothing, so a tree rooted in a VStack (the shape WireTests.swift decodes) draws a blank screen. AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place; a visible placeholder here, plus a test that draws such a tree, would meet it.
| /^(inset\s+)?(\S+)\s+(\S+)\s+(\S+)(?:\s+(\S+))?\s+((?:light-dark|rgba?|hsla?|oklch)\(.*\)|#[0-9A-Fa-f]+|[a-z]+)$/s.exec( | ||
| layer, | ||
| ); | ||
| if (!m) return null; |
There was a problem hiding this comment.
none does not match the layer pattern, so a theme with --shadow-low: none (valid CSS, zero layers) now fails Swift generation entirely, where the base skipped shadows and generated it. Returning [] for none keeps such themes working and has an exact Swift form.
|
|
||
| Two tokens that map to the same member, or a member that is a Swift keyword | ||
| or does not start with a letter, fail the run with both token names. | ||
| | `shadow-<level>` | `shadow.<level>`: `shadow-low` → `shadow.low` | |
There was a problem hiding this comment.
This row is at column 0 after a blank line, so GFM renders it as a literal | … | paragraph outside the G6 table, and lines 87-88 lost their indent, which ends the G6 item and splits the requirements list. Deleting the blank line above and indenting this row and lines 87-88 by two spaces keeps both inside G6.
| #expect(labeled.props.elevation == fromProps.props.elevation) | ||
| } | ||
|
|
||
| @Test func everyVariantDrawsCoresGroundAndOnlyDefaultHasABorder() { |
There was a problem hiding this comment.
This checks the ground of 4 of the 13 variants and no borders; looping over CardVariant.allCases and asserting the ground and the border per variant would match the test's name.
c7c537e to
bd51b1b
Compare
1781ce0 to
8e5470b
Compare
8e5470b to
a32df9f
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row, under which a theme whose shadow is none or has a spread now fails Swift generation): any engineering owner, the author included as one, records it by commenting /approve-spec <full head SHA> on this pull request, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in place.- The new G6 row sits outside the table, the collision rule below it lost its indent, and G3 still lists five
Tokensgroups. - AST-093 FR5's Swift test run on this revision, a largest-text Card test, and light, dark and largest-text captures are still missing, and one Card test names a border check it does not make.
[Automated review]
| @@ -39,7 +39,7 @@ const REGENERATE = 'pnpm -F @astryxdesign/native generate:swift-ios'; | |||
| // G5: the token groups Swift keeps. Everything else (shadows, motion, layout | |||
There was a problem hiding this comment.
This comment still says shadows stay out of Swift, but the pattern below now keeps shadow-low, shadow-med and shadow-high; G3 in theme-generator.md (lines 38-40) likewise still lists five Tokens groups.
a32df9f to
9962508
Compare
9962508 to
e211ae1
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row, under which a theme whose shadow is none or has a spread now fails Swift generation): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place.- The new G6 row sits outside the table, the collision rule below it lost its indent, and G3 still lists five
Tokensgroups. - AST-093 FR5's Swift test run on this revision, a largest-text Card test, a test of each variant's border, and light, dark and largest-text captures are still missing.
[Automated review]
| case .text(let text): Text(text.viewProps(send: send)) | ||
| case .heading(let heading): Heading(heading.viewProps(send: send)) | ||
| case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send) | ||
| default: EmptyView() |
There was a problem hiding this comment.
default: EmptyView() draws .unsupported and every readable component other than Card, Text and Heading (vStack, hStack, button, switch, …) as nothing, so a tree rooted in a VStack (the shape WireTests.swift decodes) draws a blank screen. AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place; SwiftUI stacks for VStack/HStack, a visible unsupported placeholder here, and a test that draws such a tree would meet it.
|
|
||
| Two tokens that map to the same member, or a member that is a Swift keyword | ||
| or does not start with a letter, fail the run with both token names. | ||
| | `shadow-<level>` | `shadow.<level>`: `shadow-low` → `shadow.low` | |
There was a problem hiding this comment.
This row is at column 0 after a blank line, so GitHub-flavoured Markdown renders it as a literal | … | paragraph outside the G6 table, and lines 87-88 lost their indent, which ends the G6 item and splits the requirements list. Deleting the blank line above and indenting this row and lines 87-88 by two spaces keeps both inside G6. G3 (lines 38-40) also still lists five Tokens groups without shadow.
| /^(inset\s+)?(\S+)\s+(\S+)\s+(\S+)(?:\s+(\S+))?\s+((?:light-dark|rgba?|hsla?|oklch)\(.*\)|#[0-9A-Fa-f]+|[a-z]+)$/s.exec( | ||
| layer, | ||
| ); | ||
| if (!m) return null; |
There was a problem hiding this comment.
none does not match the layer pattern, so a theme with --shadow-low: none (valid CSS, zero layers) now stops Swift generation, where the base skipped shadows and generated it; the same holds for a drop layer with a spread. This is part of the G7 decision the owner is asked to make; reading none as [] would have an exact Swift form.
| @@ -39,7 +39,7 @@ const REGENERATE = 'pnpm -F @astryxdesign/native generate:swift-ios'; | |||
| // G5: the token groups Swift keeps. Everything else (shadows, motion, layout | |||
There was a problem hiding this comment.
This comment still says shadows stay out of Swift, but the pattern below now keeps shadow-low, shadow-med and shadow-high.
| } | ||
|
|
||
| @MainActor | ||
| @Test func everyVariantDrawsCoresGroundAndOnlyDefaultHasABorder() { |
There was a problem hiding this comment.
This checks the ground of 4 of the 13 variants and no borders, so a border on every variant, or none on default, still passes every Card test. Looping over CardVariant.allCases and asserting the ground and the border per variant would match the test's name.
e211ae1 to
4e533ce
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row, under which a theme whose shadow is none or has a spread now fails Swift generation): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place.- The new G6 row sits outside the table, the collision rule below it lost its indent, G3 still lists five
Tokensgroups, and the generator's comment still says shadows stay out of Swift. - AST-093 FR5's Swift test run on this revision, a largest-text Card test and a test of each variant's border are still missing, and the new captures show 7 of the 13 variants although the description says each variant.
[Automated review]
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row, under which a theme whose shadow is none or has a spread now fails Swift generation): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place.- The new G6 row sits outside the table, the collision rule below it lost its indent, G3 still lists five
Tokensgroups, the G6 names test has no shadow case, and the generator's comment still says shadows stay out of Swift. - AST-093 FR5's Swift test run on this revision, a largest-text Card test and a test of each variant's border are still missing, and the captures show 7 of the 13 variants although the description says each variant.
[Automated review]
44d3981 to
cbaaa44
Compare
cbaaa44 to
1266c5f
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the draft theme-generator changes in this pull request (G5's three shadow tokens, G6's shadow-<level> row, and G7's oklch() and [ShadowLayer] rules with the rewritten acceptance row, under which a theme whose shadow is none, has a spread or uses another layer shape now fails Swift generation): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner, or asks for amendments. Independently of that decision, these need fixing:
AstryxNodeViewdraws nothing for unsupported nodes and for every component other than Card, Text and Heading (aVStackroot included), where AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place.- The new G6 row sits outside the table and the collision rule below it lost its indent, G3 still lists five
Tokensgroups, the G6 names test has no shadow case, and the generator's comment still says shadows stay out of Swift. - AST-093 FR5 still asks for a largest-text Card test, a test of each variant's border, and captures of the six variants the current ones leave out, since the description says each variant is shown.
The Swift tests now pass on macOS and the iOS Simulator for this revision.
[Automated review]
| case .text(let text): Text(text.viewProps(send: send)) | ||
| case .heading(let heading): Heading(heading.viewProps(send: send)) | ||
| case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send) | ||
| default: EmptyView() |
There was a problem hiding this comment.
default: EmptyView() draws .unsupported and every readable component other than Card, Text and Heading (vStack, hStack, button, switch, …) as nothing, so a tree rooted in a VStack (the shape WireTests.swift decodes) draws a blank screen. AST-082 FR19 asks a host to draw every node it can read and render the rest as unsupported in its place; SwiftUI stacks for VStack/HStack, a visible unsupported placeholder here, and a test that draws such a tree would meet it.
|
|
||
| Two tokens that map to the same member, or a member that is a Swift keyword | ||
| or does not start with a letter, fail the run with both token names. | ||
| | `shadow-<level>` | `shadow.<level>`: `shadow-low` → `shadow.low` | |
There was a problem hiding this comment.
This row is at column 0 after a blank line, so GitHub-flavoured Markdown renders it as a literal | … | paragraph outside the G6 table, and lines 87-88 lost their indent, which ends the G6 item and splits the requirements list. Deleting the blank line above and indenting this row and lines 87-88 by two spaces keeps both inside G6; G3 (lines 38-40) also still lists five Tokens groups without shadow.
| @@ -39,7 +39,7 @@ const REGENERATE = 'pnpm -F @astryxdesign/native generate:swift-ios'; | |||
| // G5: the token groups Swift keeps. Everything else (shadows, motion, layout | |||
There was a problem hiding this comment.
This comment still says shadows stay out of Swift, but the pattern below now keeps shadow-low, shadow-med and shadow-high.
| } | ||
|
|
||
| @MainActor | ||
| @Test func everyVariantDrawsCoresGroundAndOnlyDefaultHasABorder() { |
There was a problem hiding this comment.
This checks the ground of 4 of the 13 variants and no borders, so a border on every variant, or none on default, still passes every Card test. Looping over CardVariant.allCases and asserting the ground and the border per variant would match the test's name.
dcdbaf9 to
35d4efe
Compare
35d4efe to
adce2d0
Compare
…ed in place; Card variant, largest-text, and generator doc fixes
413f374 to
e56c79d
Compare
|
/approve-spec e56c79d |
There was a problem hiding this comment.
Recommending approval: Swift's Card now takes core's generated CardProps, the theme generator's shadow and oklch() rules carry an engineering owner's exact-head approval, and the Swift tests pass on macOS and the iOS Simulator. Three follow-ups are worth a look, none of them blocking:
AstryxNodeViewdrawsHStackandVStacknodes as placeholders, so a stack-rooted wire tree shows a singleVStackbox until stacks get a view.- Neutral's dark inset ring is stroked over the default card's border (
Shadow.swift:29), where the web draws it just inside the border. paddingHalfStepsAreCoresSpacingTokenschecks only that step 4 is taller than step 0.5 and the ground test covers 4 of the 13 variants; exact heights and a loop overCardVariant.allCaseswould pin both mappings.
[Automated review]
| .overlay { | ||
| ForEach(Array(layers.enumerated()), id: \.offset) { _, layer in | ||
| if layer.isInset { | ||
| shape.strokeBorder(layer.color, lineWidth: layer.spread) |
There was a problem hiding this comment.
This strokes each ring in the outer spread points of the shape, the same band where Card strokes the default variant's border, so neutral's dark ring lands on the border. CSS paints an inset shadow inside the padding edge, just inside the border; insetting the ring by the border width when the card draws one would match the web.
| case .heading(let heading): Heading(heading.viewProps(send: send)) | ||
| case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send) | ||
| case .icon(let icon): Icon(icon.viewProps(send: send)) | ||
| default: AstryxUnsupportedNode(component: Self.componentName(node)) |
There was a problem hiding this comment.
HStack and VStack nodes land here too, so a stack-rooted tree (like the sample in WireTests.swift) draws one VStack placeholder. Drawing stacks with SwiftUI's own, from their generated props, would be a good next step.
| let child = Color(astryxHex: "#FF0000FF").frame(width: 20, height: 20) | ||
| let half = Pixels(Astryx.Card(padding: .v0_5) { child }.fixedSize()) | ||
| let four = Pixels(Astryx.Card(padding: .v4) { child }.fixedSize()) | ||
| #expect(four.height > half.height) |
There was a problem hiding this comment.
This passes for any mapping in which step 4 is taller than step 0.5. Asserting the exact height (20 + 2 * Theme.default.light.space.s0_5), and the same for .v1_5 and a nil padding, would pin the mapping the test is named for.
… tokens (#8310) ## What changes for people An iOS developer gets core's whole Button: - `width: .fill` for a full-width button; - `href`, which makes the button a real link the system opens and VoiceOver reads as a link; - `tooltip` as a pointer tip and a VoiceOver hint; - `elevation` drawn with the theme's shadow; - `isInterruptible`, so a loading button can still be pressed to interrupt it. With this, every Swift view that has a core contract takes its generated props, and every view reads the theme through typed tokens. The Login template's Sign in button fills its card through `width: .fill`, as on the web. ## What this does - `Button` takes the generated `ButtonProps` (AST-093 FR5; Swift component API A2, A3, A4): a labeled initializer with the press last as a trailing closure (`onClick`), and the props initializer. - Each prop follows core: - `href` on an enabled button draws a SwiftUI `Link` styled with the Astryx button style; a disabled one stays a disabled button. - A loading link stays a link, focusable and busy, and opens nothing until loading ends unless it is interruptible. The open goes through SwiftUI's `openURL`, so `onClick` runs on every activation: tap, VoiceOver, or keyboard. - `tooltip` is SwiftUI's `.help`: a hover tip with a pointer and a hint VoiceOver reads; a tap belongs to the button, as with core's `touchTrigger: auto`. - `elevation` draws the theme's shadow; `width` is `content` or `fill`; `size` and `variant` come from typed tokens. - `AstryxNodeView` also draws Button and TextInput nodes. - **G9:** - Banner and the Login template read typed tokens. - The by-name lookups (`astryx.color("…")`, `size`, `space`, `fontSize`, `font(size:…)`) are no longer public. - **New spec record, `component:swift/Button`** (`packages/native/apple/Sources/Astryx/Button/Button.spec.md`, draft), per Cindy's decision that the loading rule belongs on the Swift Button spec. FR4 holds the loading-link rule: a loading Button with `href` stays a `Link`, keeps focus, shows its spinner, reads as busy, and does not open its destination until loading ends, unless the Button is interruptible, in which case each activation opens it. It never swaps to a button while busy (core Button FR9 and FR11). FR1–FR3 record the initializers, the loading presentation, and enabled or disabled `href`; FR5 says a script URL (`javascript:`, `vbscript:`) or an HTML document in a `data:` URL never opens, and the Button stays an enabled button. FR6: every disabled Button keeps its keyboard focus stop and shows its tooltip on focus, draws dimmed, reads as a dimmed button, and never runs `onClick` (core Button FR10, buttons family FR3); the focus stop is not measured until an app-hosted test can observe it. Each has a verification row. The record names the Apple guideline pages it follows (Buttons, Progress indicators, Accessibility) and the theme values Button reads. The shared component API record keeps no loading rule, only a pointer to Button FR4, and states no general rule. Theme environment's Current state describes the `Astryx` product. - README: the interim-exemption list is gone; Banner, which has no native contract yet, is the one view with hand-written parameters. **Landing order:** after #8307 (Card) and #8308 (TextInput); #8305 (Button `width`) is on `main`. This branch carries #8308's commit so it builds; it is rebased onto `main` as each lands, leaving only its own change (8 files). - `tooltip` shows through the shared Astryx tooltip on hover and keyboard focus, its words the VoiceOver hint; no view uses `.help`. **Compatibility:** breaking for canary callers. `action:`, `fillsWidth:`, `icon:`, and the hand-written `AstryxButtonVariant` and `AstryxButtonSize` give way to the generated `ButtonProps` (`onClick:`, `width:`, `ButtonVariant`, `ButtonSize`); the record states it. ## Writing rubric results - R1 present tense: `component:swift/Button` and the component API pointer describe the system as it is. - R2 research in the record: none. - R3 evidence naming a change: none. Verification rows name tests, not pull requests. - R4 rejected alternatives: none. - R5 user impact first: the record's End-user impact row leads with a width that holds and a link that stays a link. - R6 open questions: none. ## Captures (AST-093 FR5) Capture set: iPhone 16 simulator, iOS 18.5, Xcode 16.4, built from this PR's head (`6cad853`). Each capture shows each variant and size, loading and disabled, full width, `href` as a link, loading and disabled links, each elevation, and two themes. | Light | Dark | Light, largest text | Light, largest text, end | Dark, largest text | Dark, largest text, end | |---|---|---|---|---|---| | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-light-large.png" width="150" alt="Button, Light"> | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-dark-large.png" width="150" alt="Button, Dark"> | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-light-ax5.png" width="150" alt="Button, Light, largest text"> | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-light-ax5-end.png" width="150" alt="Button, Light, largest text, end"> | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-dark-ax5.png" width="150" alt="Button, Dark, largest text"> | <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Button-dark-ax5-end.png" width="150" alt="Button, Dark, largest text, end"> | Accessibility tree: not measured in these captures; the Swift tests check names, traits and values. **Banner** (statuses; two themes): <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Banner-light-large.png" width="150"> <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Banner-dark-large.png" width="150"> <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Banner-light-ax5.png" width="150"> <img src="https://raw.githubusercontent.com/cixzhang/astryx-pixel-gallery/27f10ad1a94648b64447aba2a1ec79bfe79c13c3/pr-shots/8310/Banner-dark-ax5.png" width="150"> ## Testing - Swift tests: - both initializers build the same props; - an interruptible loading button takes presses, and a plain loading one does not; - `href` makes an enabled button a link and a disabled one a button; - a loading link stays a link and accepts no press, and an interruptible loading link opens; - every disabled Button keeps its focus stop and takes no press; - `javascript:`, `vbscript:`, and `data:text/html` destinations never open and leave an enabled button, while `data:image` and `mailto:` still open; - `fill` takes the whole width, in pixels; - elevation reads the theme's shadows; - Banner's typed colors; - the existing loading, disabled, 44-point, and Dynamic Type tests. - `swiftc -typecheck` of both modules, the tests, and the templates passes; the Swift tests run in CI on the iOS Simulator. Every changed file is under `packages/native/`.
What changes for people
An iOS developer gets core's whole Card: every padding step including
0.5and1.5(Card(padding: .v0_5)), every background variant (muted,transparent, the twelve colors), andelevationdrawn with the theme's own shadow. A screen a logic core sends now draws its cards and their text through the same views.What this does
Cardtakes the generatedCardProps(AST-093 FR5; Swift component API A2, A3): a labeled initializer withpadding,variant,elevation,base, and a@ViewBuildercontent slot, and a props initializer that takes the children as wire nodes ([AstryxNode]) withsendfor their callbacks.padding: core's spacing steps, from the theme's typed spacing tokens. The border sits inside the padding, so the content inset equals the step, as in core. When nil, step 4: core's default without a theme.variant: core's ground for each variant. Onlydefaultdraws the border;transparentdraws neither ground nor border.elevation: the theme'sshadow-low,-med, or-high, drawn like CSSbox-shadow: drop layers only outside the card, so a see-through card shows no shadow beneath it, plus inset rings inside its edge.idandisHidden.AstryxNodeViewdraws a wire node with its Astryx view (Text, Heading, and Card so far). A component with no Swift view yet draws nothing.shadow-low,shadow-med, andshadow-high, the elevations core's Card and Button draw (shadow.low, …), in the same pull request as the first component that reads them, as G5 asks.box-shadowlist as[ShadowLayer](drop layers with no spread, inset rings) with alight-dark()color per mode, and readsoklch()colors exactly through OKLab, because neutral writes its shadows that way.color-mix().Lands after #8303 (Text and Heading props) and #8299 (the Astryx names), which this branch builds on.
Not in this pull request
Captures (AST-093 FR5)
Capture set: iPhone 16 simulator, iOS 18.5, Xcode 16.4, built from
adce2d0; the head since (e56c79d) changes only tests and the rebase onto main after #8418, so the views draw the same. Each capture shows padding 0.5 to 8, all 13 variants, each elevation, a wire tree with a node the package cannot draw rendered in place as unsupported (its siblings still render), content, and neutral and butter at elevation high.Accessibility tree: not measured in these captures; the Swift tests check names, traits and values.
Testing
defaulthas a border;--shadow-lowbecomes two drop layers and a ring with its color per mode; a drop spread or a blurred inset fails;oklch()values convert exactly; the drift test passes over the regenerated themes.swiftc -typecheckof both modules, the tests, and the templates passes;pnpm -F @astryxdesign/native typecheckpasses; the Swift tests run in CI on the iOS Simulator.Every changed file is under
packages/native/.