-
Notifications
You must be signed in to change notification settings - Fork 350
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
49101f6
commit 0838208
Showing
22 changed files
with
126 additions
and
137 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
14 changes: 0 additions & 14 deletions
14
Sources/MarkdownUI/Views/Common/TextAlignment+Alignment.swift
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
Sources/MarkdownUI/Views/Environment/Environment+BaseURL.swift
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,12 @@ | ||
import SwiftUI | ||
|
||
extension EnvironmentValues { | ||
var markdownBaseURL: URL? { | ||
get { self[MarkdownBaseURLKey.self] } | ||
set { self[MarkdownBaseURLKey.self] = newValue } | ||
} | ||
} | ||
|
||
private struct MarkdownBaseURLKey: EnvironmentKey { | ||
static var defaultValue: URL? = nil | ||
} |
30 changes: 30 additions & 0 deletions
30
Sources/MarkdownUI/Views/Environment/Environment+Image.swift
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,30 @@ | ||
import SwiftUI | ||
|
||
extension View { | ||
public func markdownImageLoader( | ||
_ imageLoader: ImageLoader?, | ||
forURLScheme urlScheme: String | ||
) -> some View { | ||
environment(\.imageLoaderRegistry[urlScheme], imageLoader) | ||
} | ||
} | ||
|
||
extension EnvironmentValues { | ||
var imageLoaderRegistry: [String: ImageLoader] { | ||
get { self[ImageLoaderRegistryKey.self] } | ||
set { self[ImageLoaderRegistryKey.self] = newValue } | ||
} | ||
|
||
var imageTransaction: Transaction { | ||
get { self[ImageTransactionKey.self] } | ||
set { self[ImageTransactionKey.self] = newValue } | ||
} | ||
} | ||
|
||
private struct ImageLoaderRegistryKey: EnvironmentKey { | ||
static var defaultValue: [String: ImageLoader] = [:] | ||
} | ||
|
||
private struct ImageTransactionKey: EnvironmentKey { | ||
static var defaultValue = Transaction() | ||
} |
21 changes: 21 additions & 0 deletions
21
Sources/MarkdownUI/Views/Environment/Environment+List.swift
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,21 @@ | ||
import SwiftUI | ||
|
||
extension EnvironmentValues { | ||
var listLevel: Int { | ||
get { self[ListLevelKey.self] } | ||
set { self[ListLevelKey.self] = newValue } | ||
} | ||
|
||
var tightSpacingEnabled: Bool { | ||
get { self[TightSpacingEnabledKey.self] } | ||
set { self[TightSpacingEnabledKey.self] = newValue } | ||
} | ||
} | ||
|
||
private struct ListLevelKey: EnvironmentKey { | ||
static var defaultValue = 0 | ||
} | ||
|
||
private struct TightSpacingEnabledKey: EnvironmentKey { | ||
static var defaultValue = false | ||
} |
24 changes: 24 additions & 0 deletions
24
Sources/MarkdownUI/Views/Environment/Environment+Theme.swift
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,24 @@ | ||
import SwiftUI | ||
|
||
extension View { | ||
public func markdownTheme(_ theme: Theme) -> some View { | ||
environment(\.theme, theme) | ||
} | ||
|
||
public func markdownTheme<V>( | ||
_ keyPath: WritableKeyPath<Theme, V>, _ value: V | ||
) -> some View { | ||
environment((\EnvironmentValues.theme).appending(path: keyPath), value) | ||
} | ||
} | ||
|
||
extension EnvironmentValues { | ||
var theme: Theme { | ||
get { self[ThemeKey.self] } | ||
set { self[ThemeKey.self] = newValue } | ||
} | ||
} | ||
|
||
private struct ThemeKey: EnvironmentKey { | ||
static var defaultValue: Theme = .default | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.