From 4ea5ec7efe07bf0e079f25c599125038b84fbe94 Mon Sep 17 00:00:00 2001 From: Brendan Szymanski Date: Mon, 15 Jun 2026 15:11:25 -0400 Subject: [PATCH] Use type native style view modifiers --- Sources/Luminate/ServerSetupView.swift | 4 ++-- Sources/LuminateHome/LibraryGrid.swift | 2 +- Sources/LuminateHome/MediaRow.swift | 2 +- .../LuminateLibrary/Components/PersonCell.swift | 4 ++-- .../LuminateLibrary/Components/RatingBadge.swift | 2 +- Sources/LuminateLibrary/EpisodeList.swift | 10 +++++----- Sources/LuminateLibrary/ItemGrid.swift | 2 +- Sources/LuminateLibrary/MovieDetailView.swift | 12 ++++++------ Sources/LuminateLibrary/PosterCell.swift | 4 ++-- Sources/LuminateLibrary/SearchView.swift | 12 ++++++------ Sources/LuminateLibrary/TVShowView.swift | 11 ++++++----- Sources/LuminatePlayer/PlayerControls.swift | 14 +++++++------- Sources/LuminatePlayer/VideoPlayerWidget.swift | 8 ++++---- 13 files changed, 44 insertions(+), 43 deletions(-) diff --git a/Sources/Luminate/ServerSetupView.swift b/Sources/Luminate/ServerSetupView.swift index fda09f7..dadd9e8 100644 --- a/Sources/Luminate/ServerSetupView.swift +++ b/Sources/Luminate/ServerSetupView.swift @@ -32,13 +32,13 @@ public struct ServerSetupView: View { Button("Connect") { connect() } - .style("suggested-action") + .suggested() if isLoading { Spinner() } if let error { Text(error) - .style("error") + .error() } } .padding() diff --git a/Sources/LuminateHome/LibraryGrid.swift b/Sources/LuminateHome/LibraryGrid.swift index 639df41..84a5293 100644 --- a/Sources/LuminateHome/LibraryGrid.swift +++ b/Sources/LuminateHome/LibraryGrid.swift @@ -11,7 +11,7 @@ struct LibraryGrid: View { var view: Body { VStack(spacing: 16) { Text(title ?? "Libraries") - .style("title-3") + .title3() .halign(.start) .padding(10, .horizontal) FlowBox(libraries) { library in diff --git a/Sources/LuminateHome/MediaRow.swift b/Sources/LuminateHome/MediaRow.swift index 5e2cb59..d8b7adf 100644 --- a/Sources/LuminateHome/MediaRow.swift +++ b/Sources/LuminateHome/MediaRow.swift @@ -13,7 +13,7 @@ struct MediaRow: View { VStack(spacing: 16) { HStack { Text(title) - .style("title-3") + .title3() /// Poor man's `Spacer()` Bin() diff --git a/Sources/LuminateLibrary/Components/PersonCell.swift b/Sources/LuminateLibrary/Components/PersonCell.swift index 7dc5dbd..59d741d 100644 --- a/Sources/LuminateLibrary/Components/PersonCell.swift +++ b/Sources/LuminateLibrary/Components/PersonCell.swift @@ -7,10 +7,10 @@ struct PersonCell: View { VStack { Avatar(showInitials: false, size: 60) Text(person.name ?? "") - .style("caption") + .caption() if let role = person.role { Text(role) - .style("caption") + .caption() .dimLabel() } } diff --git a/Sources/LuminateLibrary/Components/RatingBadge.swift b/Sources/LuminateLibrary/Components/RatingBadge.swift index 6e112be..7e4c777 100644 --- a/Sources/LuminateLibrary/Components/RatingBadge.swift +++ b/Sources/LuminateLibrary/Components/RatingBadge.swift @@ -5,7 +5,7 @@ struct RatingBadge: View { var view: Body { HStack { Text("\u{2605}") - .style("accent") + .accent() Text(String(format: "%.1f", rating)) } } diff --git a/Sources/LuminateLibrary/EpisodeList.swift b/Sources/LuminateLibrary/EpisodeList.swift index 370f6e3..69e5383 100644 --- a/Sources/LuminateLibrary/EpisodeList.swift +++ b/Sources/LuminateLibrary/EpisodeList.swift @@ -50,27 +50,27 @@ struct EpisodeRow: View { .frame(minWidth: 100, minHeight: 56) .frame(maxWidth: 100) .frame(maxHeight: 56) - .style("card") + .card() } else { Box(spacing: 0) {} .frame(minWidth: 100, minHeight: 56) .frame(maxWidth: 100) .frame(maxHeight: 56) - .style("card") + .card() } VStack { Text("\(episode.indexNumber ?? 0). \(episode.name ?? "")") - .style("body") + .body() .halign(.start) Text(episode.runtimeString) - .style("caption") + .caption() .halign(.start) } .hexpand(true) Button(icon: .default(icon: .mediaPlaybackStart)) { } - .style("flat") + .flat() } .padding(10, .horizontal) .onAppear { diff --git a/Sources/LuminateLibrary/ItemGrid.swift b/Sources/LuminateLibrary/ItemGrid.swift index da629a9..6ed0270 100644 --- a/Sources/LuminateLibrary/ItemGrid.swift +++ b/Sources/LuminateLibrary/ItemGrid.swift @@ -30,7 +30,7 @@ public struct ItemGrid: View { VStack { if let title { Text(title) - .style("title-2") + .title2() .halign(.start) .padding() } diff --git a/Sources/LuminateLibrary/MovieDetailView.swift b/Sources/LuminateLibrary/MovieDetailView.swift index d5b8052..6288d37 100644 --- a/Sources/LuminateLibrary/MovieDetailView.swift +++ b/Sources/LuminateLibrary/MovieDetailView.swift @@ -36,7 +36,7 @@ struct MovieDetailView: View { .frame(maxWidth: 200) VStack { Text(item.name ?? "") - .style("title-1") + .title1() .halign(.start) HStack { if let year = item.productionYear { @@ -52,19 +52,19 @@ struct MovieDetailView: View { Button("Play", icon: .default(icon: .mediaPlaybackStart)) { } - .style("suggested-action") + .suggested() Button(icon: .default(icon: .bookmarkNew)) { toggleFavorite() } Button(isPlayed ? "Mark Unplayed" : "Mark Played") { togglePlayed() } - .style("flat") + .flat() } .padding(10, .vertical) if let overview = item.overview { Text(overview) - .style("body") + .body() .halign(.start) } } @@ -74,7 +74,7 @@ struct MovieDetailView: View { if let people = item.people, !people.isEmpty { VStack { Text("Cast") - .style("title-3") + .title3() .halign(.start) FlowBox(people) { person in PersonCell(person: person) @@ -85,7 +85,7 @@ struct MovieDetailView: View { if !similarItems.isEmpty { VStack { Text("Similar") - .style("title-3") + .title3() .halign(.start) ScrollView { HStack { diff --git a/Sources/LuminateLibrary/PosterCell.swift b/Sources/LuminateLibrary/PosterCell.swift index cad7f5a..ef47ad2 100644 --- a/Sources/LuminateLibrary/PosterCell.swift +++ b/Sources/LuminateLibrary/PosterCell.swift @@ -19,10 +19,10 @@ struct PosterCell: View { Box(spacing: 0) {} .frame(maxWidth: 150) .frame(maxHeight: 225) - .style("card") + .card() } Text(item.name ?? "") - .style("body") + .body() .halign(.center) .frame(maxWidth: 150) } diff --git a/Sources/LuminateLibrary/SearchView.swift b/Sources/LuminateLibrary/SearchView.swift index 9d7d734..3763d73 100644 --- a/Sources/LuminateLibrary/SearchView.swift +++ b/Sources/LuminateLibrary/SearchView.swift @@ -69,30 +69,30 @@ struct SearchResultRow: View { .frame(minWidth: 80, minHeight: 120) .frame(maxWidth: 80) .frame(maxHeight: 120) - .style("card") + .card() } else { Box(spacing: 0) {} .frame(minWidth: 80, minHeight: 120) .frame(maxWidth: 80) .frame(maxHeight: 120) - .style("card") + .card() } VStack { Text(hint.name ?? "") - .style("body") + .body() .halign(.start) if let type = hint._type?.value1 { Text("\(type)") - .style("caption") + .caption() .halign(.start) } if let year = hint.productionYear { Text("\(year)") - .style("caption") + .caption() .halign(.start) } Text(hint.runtimeString) - .style("caption") + .caption() .halign(.start) } .hexpand(true) diff --git a/Sources/LuminateLibrary/TVShowView.swift b/Sources/LuminateLibrary/TVShowView.swift index f8083c0..b5089f0 100644 --- a/Sources/LuminateLibrary/TVShowView.swift +++ b/Sources/LuminateLibrary/TVShowView.swift @@ -27,16 +27,16 @@ struct TVShowView: View { .frame(maxWidth: 200) VStack { Text(item.name ?? "") - .style("title-1") + .title1() .halign(.start) if let status = item.status { Text(status) - .style("caption") + .caption() .halign(.start) } if let overview = item.overview { Text(overview) - .style("body") + .body() .halign(.start) .padding(10, .vertical) } @@ -47,14 +47,15 @@ struct TVShowView: View { if !seasons.isEmpty { VStack { Text("Season") - .style("caption") + .caption() .halign(.start) HStack { ForEach(seasons) { season in Button(season.name ?? "?") { selectedSeasonId = season.id } - .style(selectedSeasonId == season.id ? "suggested-action" : "flat") + .suggested(selectedSeasonId == season.id) + .flat(selectedSeasonId != season.id) } } } diff --git a/Sources/LuminatePlayer/PlayerControls.swift b/Sources/LuminatePlayer/PlayerControls.swift index 9352576..0e4c94c 100644 --- a/Sources/LuminatePlayer/PlayerControls.swift +++ b/Sources/LuminatePlayer/PlayerControls.swift @@ -16,33 +16,33 @@ public struct PlayerControls: View { Button(icon: .default(icon: .windowClose)) { onClose() } - .style("flat") + .flat() Button(icon: .default(icon: .goPrevious)) { onSeekBack() } - .style("flat") + .flat() Button(icon: .default(icon: isPlaying ? .mediaPlaybackPause : .mediaPlaybackStart)) { onTogglePlay() } - .style("flat") + .flat() Button(icon: .default(icon: .goNext)) { onSeekForward() } - .style("flat") + .flat() HStack { Text(formatTime(position)) - .style("caption") + .caption() LevelBar() .value(duration > 0 ? position / duration : 0) .hexpand(true) Text(formatTime(duration)) - .style("caption") + .caption() } .hexpand(true) Button(icon: .default(icon: .viewFullscreen)) { onFullscreen() } - .style("flat") + .flat() } .padding(10) } diff --git a/Sources/LuminatePlayer/VideoPlayerWidget.swift b/Sources/LuminatePlayer/VideoPlayerWidget.swift index 5907cbf..dfbd97f 100644 --- a/Sources/LuminatePlayer/VideoPlayerWidget.swift +++ b/Sources/LuminatePlayer/VideoPlayerWidget.swift @@ -11,19 +11,19 @@ struct VideoPlayerWidget: View { var view: Body { VStack { Text("Now Playing") - .style("title-1") + .title1() Text(url) - .style("caption") + .caption() .dimLabel() HStack { Button(icon: .default(icon: .mediaPlaybackStart)) { isPlaying = true } - .style("suggested-action") + .suggested() } } .padding(50) .frame(minWidth: 400, minHeight: 300) - .style("card") + .card() } }