From dbc14d41de29ca6568ac0c2a67c8cf291d7845b6 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 15 Nov 2024 21:39:17 +0600 Subject: [PATCH 1/3] start 0.23.1 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 889df70f702..ff3f66e9794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.23.1 + ## 0.23.0 **THIS UPDATE MAY CONTAINS SOME BREAKING CHANGES (INCLUDING BREAKING CHANGES IN BYTECODE LAYER) RELATED TO UPDATE OF diff --git a/gradle.properties b/gradle.properties index 8cad02a585c..23056a9a04b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 From 72202b8a2185905f3122577525da1e20ea6174e0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 25 Nov 2024 15:11:30 +0600 Subject: [PATCH 2/3] add StyleSheetsAggregator --- CHANGELOG.md | 4 ++ .../compose/StyleSheetsAggregator.kt | 66 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 coroutines/compose/src/jsMain/kotlin/dev/inmo/micro_utils/coroutines/compose/StyleSheetsAggregator.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index ff3f66e9794..0792f7d001b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.23.1 +* `Coroutines`: + * `Compose`: + * Add `StyleSheetsAggregator` + ## 0.23.0 **THIS UPDATE MAY CONTAINS SOME BREAKING CHANGES (INCLUDING BREAKING CHANGES IN BYTECODE LAYER) RELATED TO UPDATE OF diff --git a/coroutines/compose/src/jsMain/kotlin/dev/inmo/micro_utils/coroutines/compose/StyleSheetsAggregator.kt b/coroutines/compose/src/jsMain/kotlin/dev/inmo/micro_utils/coroutines/compose/StyleSheetsAggregator.kt new file mode 100644 index 00000000000..9cc62b81acd --- /dev/null +++ b/coroutines/compose/src/jsMain/kotlin/dev/inmo/micro_utils/coroutines/compose/StyleSheetsAggregator.kt @@ -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>(emptySet()) + val stylesFlow: StateFlow> = _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 = 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) +} From e5f4ae647f97807e1d79d47019c3690684d299a8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 25 Nov 2024 15:27:55 +0600 Subject: [PATCH 3/3] update dependencies --- CHANGELOG.md | 6 ++++++ gradle/libs.versions.toml | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0792f7d001b..20c32f9194d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## 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` diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 88f7d79de3a..f22244b2a45 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e2fbf0d458..81aa1c0448a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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