-
Notifications
You must be signed in to change notification settings - Fork 0
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
8113030
commit 43491bb
Showing
18 changed files
with
276 additions
and
157 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 |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
*~ | ||
.DS_STORE | ||
|
||
# KOTLIN | ||
.kotlin | ||
|
||
# GRADLE | ||
.gradle | ||
build/ | ||
|
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
22 changes: 22 additions & 0 deletions
22
compose/src/commonMain/kotlin/net/kodein/theme/compose/FontResource.kt
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,22 @@ | ||
package net.kodein.theme.compose | ||
|
||
import org.jetbrains.compose.resources.FontResource | ||
import org.jetbrains.compose.resources.InternalResourceApi | ||
import org.jetbrains.compose.resources.ResourceItem | ||
|
||
|
||
@OptIn(InternalResourceApi::class) | ||
internal fun FontResource(file: String): FontResource { | ||
val id = file.split('/').last().removeSuffix(".ttf").replace('-', '_') | ||
return FontResource( | ||
id = "font:$id", | ||
items = setOf( | ||
ResourceItem( | ||
qualifiers = emptySet(), | ||
path = file, | ||
offset = -1, | ||
size = -1 | ||
) | ||
) | ||
) | ||
} |
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
31 changes: 0 additions & 31 deletions
31
compose/src/commonMain/kotlin/net/kodein/theme/compose/KodeinLogo.kt
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 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
66 changes: 0 additions & 66 deletions
66
cup/src/commonMain/kotlin/net/kodein/theme/cup/KodeinLogo.kt
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 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
21 changes: 19 additions & 2 deletions
21
cup/src/commonMain/kotlin/net/kodein/theme/cup/KodeinStyleSheet.kt
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 |
---|---|---|
@@ -1,19 +1,36 @@ | ||
package net.kodein.theme.cup | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.text.AnnotatedString | ||
import androidx.compose.ui.text.SpanStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import net.kodein.cup.ui.SpanStyleSheet | ||
import net.kodein.cup.ui.styled | ||
import net.kodein.theme.compose.JetBrainsMono | ||
|
||
|
||
public object KodeinStyleSheet : SpanStyleSheet() { | ||
public abstract class KodeinStyleSheet : SpanStyleSheet() { | ||
/** Light */ | ||
public val l: Marker by registerMarker(SpanStyle(fontWeight = FontWeight.Light)) | ||
/** Normal */ | ||
public val n: Marker by registerMarker(SpanStyle(fontWeight = FontWeight.Normal)) | ||
/** Medium */ | ||
public val m: Marker by registerMarker(SpanStyle(fontWeight = FontWeight.Medium)) | ||
|
||
public companion object : KodeinStyleSheet() | ||
} | ||
|
||
public class ComposeKodeinStyleSheet( | ||
private val jetBrainsMono: FontFamily | ||
) : KodeinStyleSheet() { | ||
/** Source Code */ | ||
public val sc: Marker by registerMarker(SpanStyle(fontFamily = jetBrainsMono)) | ||
} | ||
|
||
public fun kStyled(build: KodeinStyleSheet.() -> String): AnnotatedString = styled(KodeinStyleSheet, build) | ||
public fun kStyled(build: KodeinStyleSheet.() -> String): AnnotatedString = | ||
styled(KodeinStyleSheet, build) | ||
|
||
@Composable | ||
public fun kcStyled(build: ComposeKodeinStyleSheet.() -> String): AnnotatedString = | ||
styled(ComposeKodeinStyleSheet(JetBrainsMono), build) |
Oops, something went wrong.