-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2627656
commit c55c583
Showing
5 changed files
with
109 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import SwiftUI | ||
|
||
public enum ControlState: Hashable, Sendable { | ||
case active | ||
case inactive | ||
case hover | ||
|
||
#if os(macOS) | ||
init(controlActiveState: ControlActiveState) { | ||
switch controlActiveState { | ||
case .active, .key: | ||
self = .active | ||
case .inactive: | ||
self = .inactive | ||
@unknown default: | ||
self = .active | ||
} | ||
} | ||
#endif | ||
} | ||
|
||
public struct Query: Hashable, Sendable { | ||
public enum Key: Hashable, Sendable { | ||
public enum Editor: Hashable, Sendable { | ||
case background | ||
case accessoryForeground | ||
case accessoryBackground | ||
case cursor | ||
} | ||
|
||
public enum Gutter: Hashable, Sendable { | ||
case background | ||
case label | ||
} | ||
|
||
case editor(Editor) | ||
case gutter(Gutter) | ||
case syntax(SyntaxSpecifier) | ||
} | ||
|
||
public struct Context: Hashable, Sendable { | ||
public var controlState: ControlState | ||
public var variant: Variant | ||
|
||
public init(controlState: ControlState = .active, colorScheme: ColorScheme, colorSchemeContrast: ColorSchemeContrast = .standard) { | ||
self.controlState = controlState | ||
self.variant = Variant(colorScheme: colorScheme, colorSchemeContrast: colorSchemeContrast) | ||
} | ||
} | ||
|
||
public var key: Key | ||
public var context: Context | ||
|
||
public init(key: Key, context: Context) { | ||
self.key = key | ||
self.context = context | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters