Skip to content

Commit 28f9660

Browse files
committed
Use context parameters throughout
1 parent 73733f4 commit 28f9660

2 files changed

Lines changed: 37 additions & 9 deletions

File tree

build.gradle.kts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
22
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag
33
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
4+
import org.jetbrains.kotlin.gradle.targets.wasm.nodejs.WasmNodeJsRootPlugin
45

56
plugins {
67
kotlin("multiplatform") apply false
@@ -23,15 +24,6 @@ allprojects {
2324
plugins.withId("org.jetbrains.kotlin.multiplatform") {
2425
extensions.configure<KotlinMultiplatformExtension> {
2526
sourceSets.all {
26-
// compilerOptions {
27-
// freeCompilerArgs.add("-Xwhen-guards")
28-
// freeCompilerArgs.add("-Xcontext-parameters")
29-
// }
30-
// languageSettings {
31-
// optIn("androidx.compose.animation.core.ExperimentalTransitionApi")
32-
// optIn("androidx.compose.animation.ExperimentalAnimationApi")
33-
// optIn("androidx.compose.animation.ExperimentalSharedTransitionApi")
34-
// }
3527
languageSettings {
3628
enableLanguageFeature("ContextParameters")
3729
enableLanguageFeature("WhenGuards")
@@ -45,3 +37,9 @@ allprojects {
4537
}
4638
}
4739
}
40+
41+
plugins.withType(WasmNodeJsRootPlugin::class.java) {
42+
tasks.register("rootPackageJson") {
43+
dependsOn(tasks.named("wasmRootPackageJson"))
44+
}
45+
}

storyboard-easel/src/commonMain/kotlin/dev/bnorm/storyboard/easel/interop.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,40 @@ import androidx.compose.animation.*
44
import androidx.compose.animation.SharedTransitionScope.*
55
import androidx.compose.animation.SharedTransitionScope.PlaceHolderSize.Companion.contentSize
66
import androidx.compose.animation.SharedTransitionScope.ResizeMode.Companion.ScaleToBounds
7+
import androidx.compose.runtime.Composable
78
import androidx.compose.ui.Alignment.Companion.Center
89
import androidx.compose.ui.Modifier
910
import androidx.compose.ui.layout.ContentScale
1011

12+
// ============================ //
13+
// ----- animateEnterExit ----- //
14+
// ============================ //
15+
16+
context(animatedVisibilityScope: AnimatedVisibilityScope)
17+
fun Modifier.animateEnterExit(
18+
enter: EnterTransition = fadeIn(),
19+
exit: ExitTransition = fadeOut(),
20+
label: String = "animateEnterExit",
21+
): Modifier {
22+
with(animatedVisibilityScope) {
23+
return animateEnterExit(
24+
enter = enter,
25+
exit = exit,
26+
label = label,
27+
)
28+
}
29+
}
30+
31+
// ========================= //
32+
// ----- sharedElement ----- //
33+
// ========================= //
34+
35+
@Composable
36+
context(sharedTransitionScope: SharedTransitionScope)
37+
fun rememberSharedContentState(key: Any): SharedContentState {
38+
return sharedTransitionScope.rememberSharedContentState(key)
39+
}
40+
1141
// ========================= //
1242
// ----- sharedElement ----- //
1343
// ========================= //

0 commit comments

Comments
 (0)