diff --git a/CHANGELOG.md b/CHANGELOG.md index db20b4e5a76..60ec2d06892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.12.12 + +* `Common`: + * `Compose`: + * `JS`: + * Add `SkeletonAnimation` stylesheet + ## 0.12.11 * `Repos`: diff --git a/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/SkeletonAnimation.kt b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/SkeletonAnimation.kt new file mode 100644 index 00000000000..f3c2bb2e9c3 --- /dev/null +++ b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/SkeletonAnimation.kt @@ -0,0 +1,43 @@ +package dev.inmo.micro_utils.common.compose + +import org.jetbrains.compose.web.css.* + +object SkeletonAnimation : StyleSheet() { + val skeletonKeyFrames: CSSNamedKeyframes by keyframes { + to { backgroundPosition("-20% 0") } + } + + fun CSSBuilder.includeSkeletonStyle( + duration: CSSSizeValue = 2.s, + timingFunction: AnimationTimingFunction = AnimationTimingFunction.EaseInOut, + iterationCount: Int? = null, + direction: AnimationDirection = AnimationDirection.Normal, + keyFrames: CSSNamedKeyframes = skeletonKeyFrames, + hideChildren: Boolean = true, + hideText: Boolean = hideChildren + ) { + backgroundImage("linear-gradient(110deg, rgb(236, 236, 236) 40%, rgb(245, 245, 245) 50%, rgb(236, 236, 236) 65%)") + backgroundSize("200% 100%") + backgroundPosition("180% 0") + animation(keyFrames) { + duration(duration) + timingFunction(timingFunction) + iterationCount(iterationCount) + direction(direction) + } + if (hideText) { + property("color", "${Color.transparent} !important") + } + + if (hideChildren) { + child(self, universal) style { + property("visibility", "hidden") + } + } + } + + val skeleton by style { + includeSkeletonStyle() + } +} + diff --git a/gradle.properties b/gradle.properties index 70aafb53c64..3951f3c7e6e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,5 +14,5 @@ crypto_js_version=4.1.1 # Project data group=dev.inmo -version=0.12.11 -android_code_version=150 +version=0.12.12 +android_code_version=151