Commit 1ebd99e628
Unsigned
Layout: unified · split
Docs/ACCESSIBILITY.txt +15
| @@ -169,6 +169,21 @@ The remaining Settings destinations — Display, History & Network, Local API, | ||
| 169 | 169 | iCloud Sync, Monitoring Log, Monitoring Settings, Scheduled Reports, Import & |
| 170 | 170 | Export, Data Management — are still unaudited. |
| 171 | 171 | |
| 172 | ## Recent searches are never audited | |
| 173 | ||
| 174 | The empty-state suite launches a fresh install, so Inspect's recent-searches | |
| 175 | section — which only appears once a lookup has been run — is never in the tree | |
| 176 | when the audit walks it. Driving one real lookup and re-auditing surfaced four | |
| 177 | findings in it on iOS 27.0: | |
| 178 | ||
| 179 | - `dynamicType` on the "RECENT" header and on the "Clear" button | |
| 180 | - `hitRegion` too small on "Clear" | |
| 181 | - `sufficientElementDescription`, "label not human-readable", on a domain chip | |
| 182 | ||
| 183 | These are latent rather than new: nothing in the section changed when Inspect | |
| 184 | moved to a `List`. They need a seeded recent-searches fixture to be audited | |
| 185 | properly, which the seed harness does not have. | |
| 186 | ||
| 172 | 187 | ## Why the floor runtime needs its own run |
| 173 | 188 | |
| 174 | 189 | **Audit coverage is not nested across OS versions.** Each runtime reports |
DomainDig/ContentView.swift +41 −54
| @@ -48,47 +48,38 @@ struct ContentView: View { | ||
| 48 | 48 | |
| 49 | 49 | var body: some View { |
| 50 | 50 | NavigationStack(path: $navigationPath) { |
| 51 | ScrollView(.vertical) { | |
| 52 | VStack(spacing: 0) { | |
| 53 | inputSection | |
| 54 | if !viewModel.batchResults.isEmpty || viewModel.batchLookupRunning { | |
| 55 | batchSection | |
| 56 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 57 | } | |
| 58 | if viewModel.hasRun { | |
| 59 | actionButtons | |
| 60 | if !viewModel.resultsLoaded { | |
| 61 | LookupProgressOverviewView(steps: viewModel.activeLoadingLabels) | |
| 62 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 63 | } else if let statusMessage = resultStatusMessage { | |
| 51 | List { | |
| 52 | Section { inputSection } | |
| 53 | if !viewModel.batchResults.isEmpty || viewModel.batchLookupRunning { | |
| 54 | Section { batchSection } | |
| 55 | } | |
| 56 | if viewModel.hasRun { | |
| 57 | Section { actionButtons } | |
| 58 | if !viewModel.resultsLoaded { | |
| 59 | Section { LookupProgressOverviewView(steps: viewModel.activeLoadingLabels) } | |
| 60 | } else if let statusMessage = resultStatusMessage { | |
| 61 | Section { | |
| 64 | 62 | LookupStatusBannerView(message: statusMessage, resultSource: viewModel.currentResultSource) |
| 65 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 66 | } | |
| 67 | if viewModel.resultsLoaded { | |
| 68 | SummaryView(fields: viewModel.summaryFields) | |
| 69 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 70 | if let report = viewModel.currentReport { | |
| 71 | RiskSummaryCardView(report: report) | |
| 72 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 73 | InsightsSummaryCardView(insights: report.insights) | |
| 74 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 75 | } | |
| 76 | if let changeSummary = viewModel.currentChangeSummary { | |
| 77 | DomainChangeSummaryView(summary: changeSummary) | |
| 78 | .padding(.top, appDensity.metrics.cardSpacing) | |
| 79 | } | |
| 80 | 63 | } |
| 64 | } | |
| 65 | if viewModel.resultsLoaded { | |
| 66 | Section { SummaryView(fields: viewModel.summaryFields) } | |
| 81 | 67 | if let report = viewModel.currentReport { |
| 82 | intelligenceSection(report: report) | |
| 83 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 68 | Section { RiskSummaryCardView(report: report) } | |
| 69 | Section { InsightsSummaryCardView(insights: report.insights) } | |
| 70 | } | |
| 71 | if let changeSummary = viewModel.currentChangeSummary { | |
| 72 | Section { DomainChangeSummaryView(summary: changeSummary) } | |
| 84 | 73 | } |
| 85 | domainOverviewSection | |
| 86 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 87 | ownershipSection | |
| 88 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 89 | subdomainsSection | |
| 90 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 91 | if !viewModel.currentDiffSections.isEmpty { | |
| 74 | } | |
| 75 | if let report = viewModel.currentReport { | |
| 76 | Section { intelligenceSection(report: report) } | |
| 77 | } | |
| 78 | Section { domainOverviewSection } | |
| 79 | Section { ownershipSection } | |
| 80 | Section { subdomainsSection } | |
| 81 | if !viewModel.currentDiffSections.isEmpty { | |
| 82 | Section { | |
| 92 | 83 | DomainDiffView( |
| 93 | 84 | title: "Latest Changes", |
| 94 | 85 | sections: viewModel.currentDiffSections, |
| @@ -96,15 +87,16 @@ struct ContentView: View { | ||
| 96 | 87 | showsUnchanged: false, |
| 97 | 88 | highlightedSectionID: nil |
| 98 | 89 | ) |
| 99 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 100 | 90 | } |
| 101 | dnsSection | |
| 102 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 91 | } | |
| 92 | Section { dnsSection } | |
| 93 | Section { | |
| 103 | 94 | WebSectionView( |
| 104 | 95 | isCollapsed: sectionCollapsedBinding(.web), |
| 105 | 96 | data: viewModel.webSectionData |
| 106 | 97 | ) |
| 107 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 98 | } | |
| 99 | Section { | |
| 108 | 100 | EmailSectionView( |
| 109 | 101 | isCollapsed: sectionCollapsedBinding(.email), |
| 110 | 102 | rows: viewModel.emailRows, |
| @@ -114,7 +106,8 @@ struct ContentView: View { | ||
| 114 | 106 | confidence: viewModel.currentSnapshot.emailSecurityConfidence, |
| 115 | 107 | error: viewModel.emailSecurityError |
| 116 | 108 | ) |
| 117 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 109 | } | |
| 110 | Section { | |
| 118 | 111 | NetworkSectionView( |
| 119 | 112 | isCollapsed: sectionCollapsedBinding(.network), |
| 120 | 113 | customPortsExpanded: $customPortsExpanded, |
| @@ -122,21 +115,15 @@ struct ContentView: View { | ||
| 122 | 115 | data: viewModel.networkSectionData, |
| 123 | 116 | onScanCustomPorts: runCustomPortScan |
| 124 | 117 | ) |
| 125 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 126 | } else if !viewModel.recentSearches.isEmpty { | |
| 127 | recentSearchesSection | |
| 128 | 118 | } |
| 119 | } else if !viewModel.recentSearches.isEmpty { | |
| 120 | Section { recentSearchesSection } | |
| 129 | 121 | } |
| 130 | .padding(.horizontal) | |
| 131 | .padding(.bottom, 32) | |
| 132 | 122 | } |
| 133 | .background( | |
| 134 | LinearGradient( | |
| 135 | colors: [Color(.appBackground), Color(.appSurface)], | |
| 136 | startPoint: .top, | |
| 137 | endPoint: .bottom | |
| 138 | ) | |
| 139 | ) | |
| 123 | .listRowBackground(Color(.appSurface)) | |
| 124 | .environment(\.cardProvidesSurface, false) | |
| 125 | .scrollContentBackground(.hidden) | |
| 126 | .background(Color(.appBackground)) | |
| 140 | 127 | .navigationTitle("DomainDig") |
| 141 | 128 | .toolbar { |
| 142 | 129 | ToolbarItem(placement: .topBarTrailing) { |
DomainDig/DomainDigUI.swift +8 −1
| @@ -415,6 +415,13 @@ struct EmptyStateCardView: View { | ||
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | /// A collapsible result section. | |
| 419 | /// | |
| 420 | /// Its body is a `Group`, not a stack: inside a `List` that makes the header | |
| 421 | /// and each piece of content their own row, so the row backgrounds draw one | |
| 422 | /// grouped panel per section and the separators keep the cards inside it | |
| 423 | /// apart. Every caller puts it in a `List` for that reason — a stack would lay | |
| 424 | /// the children out itself and lose both. | |
| 418 | 425 | struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View { |
| 419 | 426 | @Environment(\.appDensity) private var appDensity |
| 420 | 427 | @Environment(\.accessibilityReduceMotion) private var reduceMotion |
| @@ -440,7 +447,7 @@ struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View { | ||
| 440 | 447 | } |
| 441 | 448 | |
| 442 | 449 | var body: some View { |
| 443 | VStack(alignment: .leading, spacing: appDensity.metrics.cardSpacing) { | |
| 450 | Group { | |
| 444 | 451 | Button { |
| 445 | 452 | withAnimation(reduceMotion ? nil : .easeInOut(duration: 0.2)) { |
| 446 | 453 | isCollapsed.toggle() |
DomainDig/HistoryView.swift +122 −108
| @@ -171,120 +171,134 @@ struct HistoryDetailView: View { | ||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | var body: some View { |
| 174 | ScrollView(.vertical) { | |
| 175 | VStack(alignment: .leading, spacing: 0) { | |
| 176 | snapshotBanner | |
| 177 | SummaryView(fields: DomainViewModel.summaryFields(from: snapshot)) | |
| 178 | .padding(.top, 8) | |
| 179 | RiskSummaryCardView(report: report) | |
| 180 | .padding(.top, 8) | |
| 181 | InsightsSummaryCardView(insights: report.insights) | |
| 182 | .padding(.top, 8) | |
| 183 | IntelligenceSectionView( | |
| 184 | isCollapsed: .constant(false), | |
| 185 | report: report, | |
| 186 | showsPlaceholder: !FeatureAccessService.hasAccess(to: .intelligenceDetail) | |
| 187 | ) | |
| 188 | .padding(.top, 8) | |
| 189 | DomainSectionView( | |
| 190 | isCollapsed: .constant(false), | |
| 191 | rows: DomainViewModel.domainRows(from: snapshot), | |
| 192 | suggestions: DomainViewModel.suggestionRows(from: snapshot), | |
| 193 | showSuggestions: entry.availabilityResult?.status == .registered && !entry.suggestions.isEmpty, | |
| 194 | availabilityLoading: false, | |
| 195 | suggestionsLoading: false, | |
| 196 | provenance: snapshot.provenanceBySection[.availability], | |
| 197 | confidence: snapshot.availabilityConfidence, | |
| 198 | snapshotNote: entry.note, | |
| 199 | trackedDomain: trackedDomain, | |
| 200 | workflows: viewModel.workflowsContaining(domain: entry.domain), | |
| 201 | trackingLimitMessage: nil, | |
| 202 | onTrack: { | |
| 203 | _ = viewModel.trackDomain(domain: entry.domain, availabilityStatus: entry.availabilityResult?.status) | |
| 204 | }, | |
| 205 | onTogglePinned: { | |
| 206 | guard let trackedDomain else { return } | |
| 207 | viewModel.togglePinned(for: trackedDomain) | |
| 208 | }, | |
| 209 | onEditNote: nil, | |
| 210 | onAddToWorkflow: nil, | |
| 211 | onOpenWorkflow: nil, | |
| 212 | onRunWorkflow: nil | |
| 213 | ) | |
| 214 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 215 | OwnershipSectionView( | |
| 216 | isCollapsed: .constant(false), | |
| 217 | rows: DomainViewModel.ownershipRows(from: snapshot), | |
| 218 | loading: false, | |
| 219 | error: snapshot.ownershipError, | |
| 220 | provenance: snapshot.provenanceBySection[.ownership], | |
| 221 | confidence: snapshot.ownershipConfidence | |
| 222 | ) | |
| 223 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 224 | SubdomainsSectionView( | |
| 225 | isCollapsed: .constant(false), | |
| 226 | rows: DomainViewModel.subdomainRows(from: snapshot), | |
| 227 | groups: report.subdomainGroups, | |
| 228 | loading: false, | |
| 229 | error: snapshot.subdomainsError, | |
| 230 | provenance: snapshot.provenanceBySection[.subdomains], | |
| 231 | confidence: snapshot.subdomainConfidence, | |
| 232 | showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains) | |
| 233 | ) | |
| 234 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 174 | List { | |
| 175 | Section { | |
| 176 | snapshotBanner | |
| 177 | } | |
| 178 | Section { | |
| 179 | SummaryView(fields: DomainViewModel.summaryFields(from: snapshot)) | |
| 180 | } | |
| 181 | Section { | |
| 182 | RiskSummaryCardView(report: report) | |
| 183 | } | |
| 184 | Section { | |
| 185 | InsightsSummaryCardView(insights: report.insights) | |
| 186 | } | |
| 187 | Section { | |
| 188 | IntelligenceSectionView( | |
| 189 | isCollapsed: .constant(false), | |
| 190 | report: report, | |
| 191 | showsPlaceholder: !FeatureAccessService.hasAccess(to: .intelligenceDetail) | |
| 192 | ) | |
| 193 | } | |
| 194 | Section { | |
| 195 | DomainSectionView( | |
| 196 | isCollapsed: .constant(false), | |
| 197 | rows: DomainViewModel.domainRows(from: snapshot), | |
| 198 | suggestions: DomainViewModel.suggestionRows(from: snapshot), | |
| 199 | showSuggestions: entry.availabilityResult?.status == .registered && !entry.suggestions.isEmpty, | |
| 200 | availabilityLoading: false, | |
| 201 | suggestionsLoading: false, | |
| 202 | provenance: snapshot.provenanceBySection[.availability], | |
| 203 | confidence: snapshot.availabilityConfidence, | |
| 204 | snapshotNote: entry.note, | |
| 205 | trackedDomain: trackedDomain, | |
| 206 | workflows: viewModel.workflowsContaining(domain: entry.domain), | |
| 207 | trackingLimitMessage: nil, | |
| 208 | onTrack: { | |
| 209 | _ = viewModel.trackDomain(domain: entry.domain, availabilityStatus: entry.availabilityResult?.status) | |
| 210 | }, | |
| 211 | onTogglePinned: { | |
| 212 | guard let trackedDomain else { return } | |
| 213 | viewModel.togglePinned(for: trackedDomain) | |
| 214 | }, | |
| 215 | onEditNote: nil, | |
| 216 | onAddToWorkflow: nil, | |
| 217 | onOpenWorkflow: nil, | |
| 218 | onRunWorkflow: nil | |
| 219 | ) | |
| 220 | } | |
| 221 | Section { | |
| 222 | OwnershipSectionView( | |
| 223 | isCollapsed: .constant(false), | |
| 224 | rows: DomainViewModel.ownershipRows(from: snapshot), | |
| 225 | loading: false, | |
| 226 | error: snapshot.ownershipError, | |
| 227 | provenance: snapshot.provenanceBySection[.ownership], | |
| 228 | confidence: snapshot.ownershipConfidence | |
| 229 | ) | |
| 230 | } | |
| 231 | Section { | |
| 232 | SubdomainsSectionView( | |
| 233 | isCollapsed: .constant(false), | |
| 234 | rows: DomainViewModel.subdomainRows(from: snapshot), | |
| 235 | groups: report.subdomainGroups, | |
| 236 | loading: false, | |
| 237 | error: snapshot.subdomainsError, | |
| 238 | provenance: snapshot.provenanceBySection[.subdomains], | |
| 239 | confidence: snapshot.subdomainConfidence, | |
| 240 | showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains) | |
| 241 | ) | |
| 242 | } | |
| 235 | 243 | if let comparisonSnapshot = viewModel.comparisonSnapshot(for: entry) { |
| 236 | 244 | if let changeSummary = entry.changeSummary { |
| 237 | DomainChangeSummaryView(summary: changeSummary) | |
| 238 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 245 | Section { | |
| 246 | DomainChangeSummaryView(summary: changeSummary) | |
| 247 | } | |
| 239 | 248 | } |
| 240 | DomainDiffView( | |
| 241 | title: "Compared With Previous Snapshot", | |
| 242 | sections: DomainDiffService.diff(from: comparisonSnapshot, to: snapshot), | |
| 243 | contextNote: DomainDiffService.comparisonContextNote(from: comparisonSnapshot, to: snapshot), | |
| 244 | showsUnchanged: false, | |
| 245 | highlightedSectionID: nil | |
| 249 | Section { | |
| 250 | DomainDiffView( | |
| 251 | title: "Compared With Previous Snapshot", | |
| 252 | sections: DomainDiffService.diff(from: comparisonSnapshot, to: snapshot), | |
| 253 | contextNote: DomainDiffService.comparisonContextNote(from: comparisonSnapshot, to: snapshot), | |
| 254 | showsUnchanged: false, | |
| 255 | highlightedSectionID: nil | |
| 256 | ) | |
| 257 | } | |
| 258 | } | |
| 259 | Section { | |
| 260 | DNSSectionView( | |
| 261 | isCollapsed: .constant(false), | |
| 262 | dnssecLabel: DomainViewModel.dnssecLabel(from: snapshot), | |
| 263 | patternSummary: report.dns.patternSummary, | |
| 264 | sections: DomainViewModel.dnsRows(from: snapshot), | |
| 265 | ptrMessage: DomainViewModel.ptrMessage(from: snapshot), | |
| 266 | loading: false, | |
| 267 | dnsProvenance: snapshot.provenanceBySection[.dns], | |
| 268 | ptrProvenance: snapshot.provenanceBySection[.ptr], | |
| 269 | sectionError: snapshot.dnsError | |
| 270 | ) | |
| 271 | } | |
| 272 | Section { | |
| 273 | WebSectionView( | |
| 274 | isCollapsed: .constant(false), | |
| 275 | data: DomainViewModel.webSectionData(from: snapshot, report: report) | |
| 276 | ) | |
| 277 | } | |
| 278 | Section { | |
| 279 | EmailSectionView( | |
| 280 | isCollapsed: .constant(false), | |
| 281 | rows: DomainViewModel.emailRows(from: snapshot), | |
| 282 | assessment: report.email, | |
| 283 | loading: false, | |
| 284 | provenance: snapshot.provenanceBySection[.emailSecurity], | |
| 285 | confidence: snapshot.emailSecurityConfidence, | |
| 286 | error: snapshot.emailSecurityError | |
| 287 | ) | |
| 288 | } | |
| 289 | Section { | |
| 290 | NetworkSectionView( | |
| 291 | isCollapsed: .constant(false), | |
| 292 | customPortsExpanded: .constant(false), | |
| 293 | customPortInput: .constant(""), | |
| 294 | data: DomainViewModel.networkSectionData(from: snapshot), | |
| 295 | onScanCustomPorts: { /* Historical snapshot; re-scanning is not offered here. */ } | |
| 246 | 296 | ) |
| 247 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 248 | 297 | } |
| 249 | DNSSectionView( | |
| 250 | isCollapsed: .constant(false), | |
| 251 | dnssecLabel: DomainViewModel.dnssecLabel(from: snapshot), | |
| 252 | patternSummary: report.dns.patternSummary, | |
| 253 | sections: DomainViewModel.dnsRows(from: snapshot), | |
| 254 | ptrMessage: DomainViewModel.ptrMessage(from: snapshot), | |
| 255 | loading: false, | |
| 256 | dnsProvenance: snapshot.provenanceBySection[.dns], | |
| 257 | ptrProvenance: snapshot.provenanceBySection[.ptr], | |
| 258 | sectionError: snapshot.dnsError | |
| 259 | ) | |
| 260 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 261 | WebSectionView( | |
| 262 | isCollapsed: .constant(false), | |
| 263 | data: DomainViewModel.webSectionData(from: snapshot, report: report) | |
| 264 | ) | |
| 265 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 266 | EmailSectionView( | |
| 267 | isCollapsed: .constant(false), | |
| 268 | rows: DomainViewModel.emailRows(from: snapshot), | |
| 269 | assessment: report.email, | |
| 270 | loading: false, | |
| 271 | provenance: snapshot.provenanceBySection[.emailSecurity], | |
| 272 | confidence: snapshot.emailSecurityConfidence, | |
| 273 | error: snapshot.emailSecurityError | |
| 274 | ) | |
| 275 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 276 | NetworkSectionView( | |
| 277 | isCollapsed: .constant(false), | |
| 278 | customPortsExpanded: .constant(false), | |
| 279 | customPortInput: .constant(""), | |
| 280 | data: DomainViewModel.networkSectionData(from: snapshot), | |
| 281 | onScanCustomPorts: { /* Historical snapshot; re-scanning is not offered here. */ } | |
| 282 | ) | |
| 283 | .padding(.top, appDensity.metrics.sectionSpacing) | |
| 284 | } | |
| 285 | .padding(.horizontal) | |
| 286 | .padding(.bottom, 32) | |
| 287 | 298 | } |
| 299 | .listRowBackground(Color(.appSurface)) | |
| 300 | .environment(\.cardProvidesSurface, false) | |
| 301 | .scrollContentBackground(.hidden) | |
| 288 | 302 | .background(Color(.appBackground)) |
| 289 | 303 | .navigationTitle(entry.domain) |
| 290 | 304 | .toolbar { |
DomainDig/ResultPrimitives.swift +27 −3
| @@ -36,6 +36,25 @@ struct SectionTitleView: View { | ||
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | /// Whether a `CardView` draws its own surface, or whether whatever contains it | |
| 40 | /// already provides one. | |
| 41 | /// | |
| 42 | /// Set to `false` by the screens that put cards in `List` rows, where the row's | |
| 43 | /// `.listRowBackground` is the surface and a card drawing its own would be a | |
| 44 | /// panel inside a panel. `CardView` sets it back to `true` for its content, so | |
| 45 | /// only the outermost card in a row gives up its chrome and a card nested | |
| 46 | /// inside one keeps it. | |
| 47 | private struct CardProvidesSurfaceKey: EnvironmentKey { | |
| 48 | static let defaultValue = true | |
| 49 | } | |
| 50 | ||
| 51 | extension EnvironmentValues { | |
| 52 | var cardProvidesSurface: Bool { | |
| 53 | get { self[CardProvidesSurfaceKey.self] } | |
| 54 | set { self[CardProvidesSurfaceKey.self] = newValue } | |
| 55 | } | |
| 56 | } | |
| 57 | ||
| 39 | 58 | /// A card that wraps its content by default. |
| 40 | 59 | /// |
| 41 | 60 | /// `allowsHorizontalScroll` used to default to `true`, so nine call sites put |
| @@ -50,6 +69,7 @@ struct SectionTitleView: View { | ||
| 50 | 69 | struct CardView<Content: View>: View { |
| 51 | 70 | @Environment(\.appDensity) private var appDensity |
| 52 | 71 | @Environment(\.dynamicTypeSize) private var dynamicTypeSize |
| 72 | @Environment(\.cardProvidesSurface) private var providesSurface | |
| 53 | 73 | let allowsHorizontalScroll: Bool |
| 54 | 74 | let content: Content |
| 55 | 75 | |
| @@ -72,15 +92,19 @@ struct CardView<Content: View>: View { | ||
| 72 | 92 | } |
| 73 | 93 | } |
| 74 | 94 | .frame(maxWidth: .infinity, alignment: .leading) |
| 75 | .padding(appDensity.metrics.cardPadding) | |
| 76 | .background(Color(.appSurface)) | |
| 77 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) | |
| 95 | .padding(providesSurface ? appDensity.metrics.cardPadding : 0) | |
| 96 | .background(providesSurface ? Color(.appSurface) : Color.clear) | |
| 97 | .clipShape( | |
| 98 | RoundedRectangle(cornerRadius: providesSurface ? appDensity.metrics.cardCornerRadius : 0) | |
| 99 | ) | |
| 78 | 100 | } |
| 79 | 101 | |
| 80 | 102 | private var cardContent: some View { |
| 81 | 103 | VStack(alignment: .leading, spacing: appDensity.metrics.cardSpacing) { |
| 82 | 104 | content |
| 83 | 105 | } |
| 106 | // Only the outermost card in a row gives up its surface. | |
| 107 | .environment(\.cardProvidesSurface, true) | |
| 84 | 108 | } |
| 85 | 109 | } |
| 86 | 110 | |