Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownJoe796 committed Mar 19, 2024
2 parents 9c73f66 + ba36650 commit 41f3e91
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 62 deletions.
29 changes: 0 additions & 29 deletions library/src/commonMain/kotlin/com/lightningkite/rock/models/Svg.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ data class Theme(
val outline: Paint = Color.black,
val outlineWidth: Dimension = 0.px,
val background: Paint = Color.white,
val card: (Theme.() -> Theme) = { this },
val hover: (Theme.() -> Theme) = {
copy(
background = this.background.closestColor().highlight(0.2f),
Expand Down Expand Up @@ -88,6 +89,9 @@ data class Theme(
) {
val icon: Paint get() = iconOverride ?: foreground

private var cardCache: Theme? = null
@JsName("cardDirect")
fun card() = cardCache ?: card(this).also { cardCache = it }
private var dialogCache: Theme? = null
@JsName("dialogDirect")
fun dialog() = dialogCache ?: dialog(this).also { dialogCache = it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,36 +96,6 @@ data class SizeConstraints(
val height: Dimension? = null,
)

data class Insets(
val left: Dimension? = null,
val top: Dimension? = null,
val right: Dimension? = null,
val bottom: Dimension? = null
) {
constructor(all: Dimension) : this(all, all, all, all)

companion object {
fun zero() = Insets(0.px)

val none = zero()

fun symmetric(horizontal: Dimension = 0.px, vertical: Dimension = 0.px) =
Insets(horizontal, vertical, horizontal, vertical)
}
}

data class TextStyle(
val color: Color = Color.black,
val disabledColor: Color = Color.gray,
val size: Double = 14.0,
val font: Font = systemDefaultFont,
val bold: Boolean = false,
val italic: Boolean = false,
val allCaps: Boolean = false,
val lineSpacingMultiplier: Double = 1.0,
val letterSpacing: Dimension = 0.px,
)

enum class Align {
Start, Center, End, Stretch
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var ViewWriter.navigator by viewWriterAddonLateInit<RockNavigator>()
@ViewModifierDsl3 inline fun ViewWriter.tweakTheme(crossinline calculate: suspend (Theme)->Theme?): ViewWrapper {
return themeModifier { val e = it(); calculate(e) ?: e }
}
@ViewModifierDsl3 val ViewWriter.card: ViewWrapper get() = themeFromLast { it }
@ViewModifierDsl3 val ViewWriter.card: ViewWrapper get() = themeFromLast { it.card() }
@ViewModifierDsl3 val ViewWriter.dialog: ViewWrapper get() = themeFromLast { it.dialog() }
@ViewModifierDsl3 val ViewWriter.hover: ViewWrapper get() = themeFromLast { it.hover() }
@ViewModifierDsl3 val ViewWriter.down: ViewWrapper get() = themeFromLast { it.down() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ actual var NView.spacing: Dimension
set(value) {
style.setProperty("--spacing", value.value)
val cn = "spacingOf${value.value.replace(".", "_").filter { it.isLetterOrDigit() || it == '_' }}"
DynamicCSS.styleIfMissing(".$cn.$cn.$cn.$cn.$cn > *, .$cn.$cn.$cn.$cn.$cn > .hidingContainer > *", mapOf(
DynamicCSS.styleIfMissing(".$cn.$cn.$cn.$cn.$cn.$cn.$cn > *, .$cn.$cn.$cn.$cn.$cn.$cn.$cn > .hidingContainer > *", mapOf(
"--parentSpacing" to value.value
))
className = className.split(' ').filter { !it.startsWith("spacingOf") }.plus(cn).joinToString(" ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ fun ImageView.setSrc(url: String) {
}
for(index in 0..<myIndex) {
val it = children[index]
(it as? HTMLElement)?.style?.opacity = "0"
window.setTimeout({
native.removeChild(it)
}, 150)
Expand Down

0 comments on commit 41f3e91

Please sign in to comment.