mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-25 11:38:48 +00:00
commit
24347b422c
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## 0.23.1
|
||||
|
||||
* `Versions`:
|
||||
* `Compose`: `1.7.0` -> `1.7.1`
|
||||
* `Exposed`: `0.55.0` -> `0.56.0`
|
||||
* `Xerial SQLite`: `3.46.1.3` -> `3.47.0.0`
|
||||
* `Android CoreKTX`: `1.13.1` -> `1.15.0`
|
||||
* `Android Fragment`: `1.8.4` -> `1.8.5`
|
||||
* `Coroutines`:
|
||||
* `Compose`:
|
||||
* Add `StyleSheetsAggregator`
|
||||
|
||||
## 0.23.0
|
||||
|
||||
**THIS UPDATE MAY CONTAINS SOME BREAKING CHANGES (INCLUDING BREAKING CHANGES IN BYTECODE LAYER) RELATED TO UPDATE OF
|
||||
|
@ -0,0 +1,66 @@
|
||||
package dev.inmo.micro_utils.coroutines.compose
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.remember
|
||||
import dev.inmo.micro_utils.coroutines.SpecialMutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import org.jetbrains.compose.web.css.CSSRulesHolder
|
||||
import org.jetbrains.compose.web.css.Style
|
||||
import org.jetbrains.compose.web.css.StyleSheet
|
||||
|
||||
/**
|
||||
* Aggregator of Compose CSS StyleSheet. Allowing to add [StyleSheet] in it and draw it in one place without requiring
|
||||
* to add `Style(stylesheet)` on every compose function call
|
||||
*/
|
||||
object StyleSheetsAggregator {
|
||||
private val _stylesFlow = SpecialMutableStateFlow<Set<CSSRulesHolder>>(emptySet())
|
||||
val stylesFlow: StateFlow<Set<CSSRulesHolder>> = _stylesFlow.asStateFlow()
|
||||
|
||||
@Composable
|
||||
fun draw() {
|
||||
_stylesFlow.debounce(13L).collectAsState(emptySet()).value.forEach {
|
||||
Style(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding [styleSheet] into the [Set] of included stylesheets. If you called [enableStyleSheetsAggregator],
|
||||
* new styles will be enabled in the document
|
||||
*/
|
||||
fun addStyleSheet(styleSheet: CSSRulesHolder) {
|
||||
_stylesFlow.value += styleSheet
|
||||
}
|
||||
|
||||
/**
|
||||
* Removed [styleSheet] into the [Set] of included stylesheets
|
||||
*/
|
||||
fun removeStyleSheet(styleSheet: CSSRulesHolder) {
|
||||
_stylesFlow.value -= styleSheet
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drawing [StyleSheetsAggregator] in place. You may pass [Set] of [CSSRulesHolder]/[StyleSheet]s as preset of styles
|
||||
*/
|
||||
@Composable
|
||||
fun enableStyleSheetsAggregator(
|
||||
stylesPreset: Set<CSSRulesHolder> = emptySet(),
|
||||
) {
|
||||
remember {
|
||||
stylesPreset.forEach {
|
||||
StyleSheetsAggregator.addStyleSheet(it)
|
||||
}
|
||||
}
|
||||
StyleSheetsAggregator.draw()
|
||||
}
|
||||
|
||||
/**
|
||||
* Will include [this] [CSSRulesHolder]/[StyleSheet] in the [StyleSheetsAggregator] using its
|
||||
* [StyleSheetsAggregator.addStyleSheet]
|
||||
*/
|
||||
fun CSSRulesHolder.includeInStyleSheetsAggregator() {
|
||||
StyleSheetsAggregator.addStyleSheet(this)
|
||||
}
|
@ -15,5 +15,5 @@ crypto_js_version=4.1.1
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.23.0
|
||||
android_code_version=276
|
||||
version=0.23.1
|
||||
android_code_version=277
|
||||
|
@ -6,11 +6,11 @@ kt-coroutines = "1.9.0"
|
||||
|
||||
kslog = "1.3.6"
|
||||
|
||||
jb-compose = "1.7.0"
|
||||
jb-exposed = "0.55.0"
|
||||
jb-compose = "1.7.1"
|
||||
jb-exposed = "0.56.0"
|
||||
jb-dokka = "1.9.20"
|
||||
|
||||
sqlite = "3.46.1.3"
|
||||
sqlite = "3.47.0.0"
|
||||
|
||||
korlibs = "5.4.0"
|
||||
uuid = "0.8.4"
|
||||
@ -23,7 +23,7 @@ koin = "4.0.0"
|
||||
|
||||
okio = "3.9.1"
|
||||
|
||||
ksp = "2.0.21-1.0.26"
|
||||
ksp = "2.0.21-1.0.28"
|
||||
kotlin-poet = "1.18.1"
|
||||
|
||||
versions = "0.51.0"
|
||||
@ -31,10 +31,10 @@ versions = "0.51.0"
|
||||
android-gradle = "8.2.2"
|
||||
dexcount = "4.0.0"
|
||||
|
||||
android-coreKtx = "1.13.1"
|
||||
android-coreKtx = "1.15.0"
|
||||
android-recyclerView = "1.3.2"
|
||||
android-appCompat = "1.7.0"
|
||||
android-fragment = "1.8.4"
|
||||
android-fragment = "1.8.5"
|
||||
android-espresso = "3.6.1"
|
||||
android-test = "1.2.1"
|
||||
android-compose-material3 = "1.3.0"
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
Loading…
Reference in New Issue
Block a user