112 lines
4.8 KiB
Swift
112 lines
4.8 KiB
Swift
import SwiftUI
|
|
|
|
public enum Metrics {
|
|
// MARK: Rows and bars
|
|
|
|
public static let explorerRow: CGFloat = 24
|
|
public static let sourceControlRow: CGFloat = 26
|
|
public static let statusBar: CGFloat = 28
|
|
public static let contextMenuItem: CGFloat = 30
|
|
/// The one top-bar height: Explorer head, Diff bar.
|
|
public static let panelHeader: CGFloat = 34
|
|
/// The bar above the code: the open file, its change counts, Preview and Diff.
|
|
public static let editorBar: CGFloat = 34
|
|
public static let titleBar: CGFloat = 44
|
|
public static let codeLine: CGFloat = 20
|
|
public static let searchHitLine: CGFloat = 24
|
|
public static let diffOverlayLine: CGFloat = 22
|
|
public static let launcherRow: CGFloat = 38
|
|
public static let launcherNewRow: CGFloat = 46
|
|
public static let searchQueryBar: CGFloat = 54
|
|
public static let commitBox: CGFloat = 52
|
|
public static let pushButton: CGFloat = 34
|
|
|
|
// MARK: Radii
|
|
|
|
/// Buttons, inputs, tags, keycaps, menu rows, code blocks.
|
|
public static let radiusSmall: CGFloat = 2
|
|
/// Panels, cards, menus.
|
|
public static let radiusMedium: CGFloat = 4
|
|
/// Overlays only.
|
|
public static let radiusOverlay: CGFloat = 8
|
|
|
|
// MARK: Lines
|
|
|
|
public static let hairline: CGFloat = 1
|
|
/// Selection rule, focus border, pull-quote.
|
|
public static let accentRule: CGFloat = 2
|
|
/// The focus ring drawn outside the 2px amber border.
|
|
public static let focusRingWidth: CGFloat = 2
|
|
|
|
// MARK: Columns
|
|
|
|
public static let sourceControlWidth: CGFloat = 236
|
|
public static let explorerWidth: CGFloat = 288
|
|
public static let agentWidth: CGFloat = 480
|
|
public static let minEditorWidth: CGFloat = 280
|
|
public static let explorerIndent: CGFloat = 16
|
|
public static let explorerBaseIndent: CGFloat = 12
|
|
/// Gutter of the code grid in the editor.
|
|
public static let codeGutter: CGFloat = 56
|
|
public static let diffOverlayGutter: CGFloat = 52
|
|
public static let searchHitGutter: CGFloat = 64
|
|
/// Room the hidden-inset title bar leaves for the traffic lights.
|
|
public static let trafficLightInset: CGFloat = 82
|
|
/// Where the traffic lights sit, measured from the window's top-left corner.
|
|
public static let trafficLightOrigin = CGPoint(x: 14, y: 12)
|
|
/// The pointer target of a 1pt splitter: 3pt either side of the line.
|
|
public static let splitterHitArea: CGFloat = 7
|
|
|
|
// MARK: Title bar and toolbar
|
|
|
|
public static let titleBarGap: CGFloat = 18
|
|
public static let titleClusterGap: CGFloat = 10
|
|
public static let crumbGap: CGFloat = 7
|
|
/// A button inside a `ButtonGroup`: the pane toggles and the toolbar.
|
|
public static let groupButtonPadding = EdgeInsets(top: 6, leading: 10, bottom: 6, trailing: 10)
|
|
public static let groupButtonGap: CGFloat = 7
|
|
public static let groupButtonDot: CGFloat = 6
|
|
/// Between the toolbar group and the `?`.
|
|
public static let toolbarIconGap: CGFloat = 8
|
|
/// The `?` button: a square with a hairline border.
|
|
public static let toolbarIconButton: CGFloat = 26
|
|
public static let statusBarGap: CGFloat = 16
|
|
|
|
// MARK: Window
|
|
|
|
public static let defaultWindow = CGSize(width: 1680, height: 1040)
|
|
public static let minimumWindow = CGSize(width: 1100, height: 680)
|
|
|
|
// MARK: Overlays
|
|
|
|
public static let overlayInset: CGFloat = 34
|
|
/// The widest an `.inset` overlay grows; past it the card stays centred.
|
|
public static let insetOverlayMaxWidth: CGFloat = 1200
|
|
public static let contextMenuWidth: CGFloat = 320
|
|
public static let passOnWidth: CGFloat = 460
|
|
public static let launcherWidth: CGFloat = 520
|
|
public static let launcherTopPadding: CGFloat = 40
|
|
public static let launcherFooter: CGFloat = 36
|
|
public static let tooltipMaxWidth: CGFloat = 300
|
|
public static let tooltipDelay: Duration = .milliseconds(350)
|
|
/// Toasts stack this far above the window's bottom edge.
|
|
public static let toastBottom: CGFloat = 44
|
|
|
|
// MARK: Elevation (only two shadows exist)
|
|
|
|
public static let menuShadowRadius: CGFloat = 16
|
|
public static let menuShadowY: CGFloat = 4
|
|
public static let overlayShadowRadius: CGFloat = 48
|
|
public static let overlayShadowY: CGFloat = 16
|
|
|
|
// MARK: Motion: colour transitions only
|
|
|
|
public static let colorTransition = Animation.timingCurve(0.22, 1, 0.36, 1, duration: 0.16)
|
|
public static let smallControlTransition = Animation.timingCurve(0.22, 1, 0.36, 1, duration: 0.12)
|
|
/// Stepped on/off blink of the caret, terminal cursor and wordmark period; no fade.
|
|
public static let blinkInterval: TimeInterval = 1.1
|
|
public static let refreshFlashDuration: TimeInterval = 0.26
|
|
/// How long the branch · project card shows when a window becomes key again.
|
|
public static let focusFlashDuration: Duration = .milliseconds(500)
|
|
}
|