move files around

This commit is contained in:
2026-07-12 15:06:51 +02:00
parent a6a7f80cce
commit 24c53eb51d
35 changed files with 27 additions and 27 deletions
@@ -1,8 +1,8 @@
struct PHThemeStyle: Decodable {
let name: String
let foreground: PHThemeColor?
let background: PHThemeColor?
let padding: PHThemePadding?
let foreground: PHThemeStyleColor?
let background: PHThemeStyleColor?
let padding: PHThemeStylePadding?
static let `default`: Self = {
PHThemeStyle(
@@ -1,6 +1,6 @@
import SwiftUI
struct PHThemeColor: Decodable, ShapeStyle {
struct PHThemeStyleColor: Decodable, ShapeStyle {
typealias Resolved = SwiftUI.Color
let color: String
@@ -1,4 +1,4 @@
struct PHThemePadding: Decodable {
struct PHThemeStylePadding: Decodable {
let trailing: Double?
let leading: Double?
@@ -8,13 +8,13 @@ struct PHThemeWindow: Decodable {
/// Window height in points.
var height: Double? = 30
/// Window width: a point value or a percentage of the screen width.
var width: PHThemeDimension? = .percentage(1.0)
var width: PHThemeWindowDimension? = .percentage(1.0)
/// Semantic placement within the screen.
var anchor: PHThemeAnchor? = .top
var anchor: PHThemeWindowAnchor? = .top
/// Insets from the anchored edges.
var margin: PHThemeMargin? = .init()
var margin: PHThemeWindowMargin? = .init()
/// Absolute origin. Overrides `anchor` and `margin` when set.
var origin: PHThemePoint?
var origin: PHThemeWindowPoint?
private enum CodingKeys: String, CodingKey {
case name
@@ -6,7 +6,7 @@ import Foundation
/// Single-edge anchors (`top`, `bottom`, `leading`, `trailing`) pin to that
/// edge and center along the opposite axis. Corner anchors pin to two edges.
/// `center` centers the window on both axes.
enum PHThemeAnchor: String, Decodable {
enum PHThemeWindowAnchor: String, Decodable {
case top, bottom, leading, trailing
case topLeading = "top-leading"
case topTrailing = "top-trailing"
@@ -15,14 +15,14 @@ enum PHThemeAnchor: String, Decodable {
case center
}
extension PHThemeAnchor {
extension PHThemeWindowAnchor {
/// Compute the top-left origin (in screen coordinates) of a window of `size`
/// placed against this anchor within `screen`, offset by `margin` along the
/// anchored edges.
///
/// Edges the anchor does not reference are ignored, so margins only affect
/// the relevant sides.
func origin(in screen: CGRect, size: CGSize, margin: PHThemeMargin) -> CGPoint {
func origin(in screen: CGRect, size: CGSize, margin: PHThemeWindowMargin) -> CGPoint {
let top = margin.top ?? 0
let bottom = margin.bottom ?? 0
let leading = margin.leading ?? 0
@@ -6,7 +6,7 @@ import Foundation
///
/// Decoded from either a number (`width = 400`) or a percentage string
/// (`width = "100%"`).
enum PHThemeDimension: Decodable, Equatable {
enum PHThemeWindowDimension: Decodable, Equatable {
case points(Double)
case percentage(Double)
@@ -4,7 +4,7 @@ import Foundation
///
/// Only the edges referenced by the anchor are consumed; the rest are ignored,
/// so a margin only affects the relevant sides of the placement.
struct PHThemeMargin: Decodable, Equatable {
struct PHThemeWindowMargin: Decodable, Equatable {
let top: Double?
let bottom: Double?
let leading: Double?
@@ -4,7 +4,7 @@ import Foundation
///
/// When set on a window, it overrides anchor/margin placement entirely the
/// window appears at exactly these coordinates.
struct PHThemePoint: Decodable, Equatable {
struct PHThemeWindowPoint: Decodable, Equatable {
let x: Double
let y: Double
}