diff --git a/compose/build.gradle.kts b/compose/build.gradle.kts index bff1882..827a109 100644 --- a/compose/build.gradle.kts +++ b/compose/build.gradle.kts @@ -73,6 +73,8 @@ kotlin { implementation(compose.foundation) implementation(compose.runtime) implementation(libs.kotlin.stdlib) + implementation(libs.annotation) + implementation(libs.collection) implementation(kotlin("reflect")) } } diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt index cfcef79..a39c271 100644 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt +++ b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstrainScope.kt @@ -16,13 +16,13 @@ package androidx.constraintlayout.compose +import androidx.annotation.FloatRange import androidx.compose.foundation.layout.LayoutScopeMarker import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.TransformOrigin import androidx.compose.ui.layout.FirstBaseline import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.constraintlayout.compose.platform.annotation.FloatRange import androidx.constraintlayout.core.parser.CLArray import androidx.constraintlayout.core.parser.CLNumber import androidx.constraintlayout.core.parser.CLObject diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt index ff8c0be..bd357cd 100644 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt +++ b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt @@ -16,6 +16,7 @@ package androidx.constraintlayout.compose +import androidx.collection.IntIntPair import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.tween @@ -77,7 +78,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastForEachIndexed -import androidx.constraintlayout.compose.extra.IntIntPair import androidx.constraintlayout.compose.extra.parseLong import androidx.constraintlayout.compose.extra.rememberEmptyPainter import androidx.constraintlayout.compose.platform.Log diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/TransitionScope.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/TransitionScope.kt index e17e171..7ef8eb1 100644 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/TransitionScope.kt +++ b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/TransitionScope.kt @@ -16,11 +16,11 @@ package androidx.constraintlayout.compose +import androidx.annotation.FloatRange +import androidx.annotation.IntRange import androidx.compose.foundation.layout.LayoutScopeMarker import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.constraintlayout.compose.platform.annotation.FloatRange -import androidx.constraintlayout.compose.platform.annotation.IntRange import androidx.constraintlayout.core.parser.CLArray import androidx.constraintlayout.core.parser.CLContainer import androidx.constraintlayout.core.parser.CLNumber diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/extra/IntIntPair.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/extra/IntIntPair.kt deleted file mode 100644 index fd60b4f..0000000 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/extra/IntIntPair.kt +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.constraintlayout.compose.extra - -import kotlin.jvm.JvmField -import kotlin.jvm.JvmInline - -/** - * Container to ease passing around a tuple of two [Int] values. - * - * *Note*: This class is optimized by using a value class, a Kotlin language featured - * not available from Java code. Java developers can get the same functionality by - * using [Pair] or by constructing a custom implementation using Int parameters - * directly (see [LongLongPair] for an example). - */ -@JvmInline -internal value class IntIntPair internal constructor( - @PublishedApi @JvmField internal val packedValue: Long, -) { - /** - * Constructs a [IntIntPair] with two [Int] values. - * - * @param first the first value in the pair - * @param second the second value in the pair - */ - public constructor(first: Int, second: Int) : this(packInts(first, second)) - - /** - * The first value in the pair. - */ - public val first: Int - get() = (packedValue shr 32).toInt() - - /** - * The second value in the pair. - */ - public val second: Int - get() = (packedValue and 0xFFFFFFFF).toInt() - - /** - * Returns the [first] component of the pair. For instance, the first component - * of `PairIntInt(3, 4)` is `3`. - * - * This method allows to use destructuring declarations when working with pairs, - * for example: - * ``` - * val (first, second) = myPair - * ``` - */ - // NOTE: Unpack the value directly because using `first` forces an invokestatic - public inline operator fun component1(): Int = (packedValue shr 32).toInt() - - /** - * Returns the [second] component of the pair. For instance, the second component - * of `PairIntInt(3, 4)` is `4`. - * - * This method allows to use destructuring declarations when working with pairs, - * for example: - * ``` - * val (first, second) = myPair - * ``` - */ - // NOTE: Unpack the value directly because using `second` forces an invokestatic - public inline operator fun component2(): Int = (packedValue and 0xFFFFFFFF).toInt() - - override fun toString(): String = "($first, $second)" -} - -/** - * Packs two Int values into one Long value for use in inline classes. - */ -private inline fun packInts(val1: Int, val2: Int): Long { - return (val1.toLong() shl 32) or (val2.toLong() and 0xFFFFFFFF) -} diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/FloatRange.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/FloatRange.kt deleted file mode 100644 index f714c74..0000000 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/FloatRange.kt +++ /dev/null @@ -1,21 +0,0 @@ -package androidx.constraintlayout.compose.platform.annotation - -/** - * Replace when androidx.annotation.FloatRange support wasm - */ -@Retention(AnnotationRetention.BINARY) -@Target( - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER, - AnnotationTarget.VALUE_PARAMETER, - AnnotationTarget.FIELD, - AnnotationTarget.LOCAL_VARIABLE, - AnnotationTarget.ANNOTATION_CLASS, -) -annotation class FloatRange( - val from: Double = Double.NEGATIVE_INFINITY, - val to: Double = Double.POSITIVE_INFINITY, - val fromInclusive: Boolean = true, - val toInclusive: Boolean = true, -) diff --git a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/IntRange.kt b/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/IntRange.kt deleted file mode 100644 index cea2ade..0000000 --- a/compose/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/IntRange.kt +++ /dev/null @@ -1,19 +0,0 @@ -package androidx.constraintlayout.compose.platform.annotation - -/** - * Replace when androidx.annotation.IntRange support wasm - */ -@Retention(AnnotationRetention.BINARY) -@Target( - AnnotationTarget.FUNCTION, - AnnotationTarget.PROPERTY_GETTER, - AnnotationTarget.PROPERTY_SETTER, - AnnotationTarget.VALUE_PARAMETER, - AnnotationTarget.FIELD, - AnnotationTarget.LOCAL_VARIABLE, - AnnotationTarget.ANNOTATION_CLASS, -) -annotation class IntRange( - val from: Long = Long.MIN_VALUE, - val to: Long = Long.MAX_VALUE, -) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bbfeea4..899676d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,8 @@ androidx-appcompat = "1.6.1" androidx-activityCompose = "1.9.0" +annotation = "1.8.0-alpha01" +collection = "1.6.10" compose = "1.6.10" kotlin = "1.9.24" agp = "8.2.2" @@ -12,6 +14,8 @@ spotless = "6.25.0" androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } +annotation = { module = "org.jetbrains.compose.annotation-internal:annotation", version.ref = "annotation" } +collection = { module = "org.jetbrains.compose.collection-internal:collection", version.ref = "collection" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } [plugins] diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/sample/iosApp/iosApp.xcodeproj/project.pbxproj b/sample/iosApp/iosApp.xcodeproj/project.pbxproj index 94cadc3..7d6f7be 100644 --- a/sample/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/sample/iosApp/iosApp.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ @@ -13,7 +13,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - A93A953729CC810C00F8E227 /* constraintlayout-compose-multiplatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "constraintlayout-compose-multiplatform.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + A93A953729CC810C00F8E227 /* constraintlayout-compose-multiplatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "constraintlayout-compose-multiplatform.app"; sourceTree = BUILT_PRODUCTS_DIR; }; A93A953A29CC810C00F8E227 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = ""; }; A93A953E29CC810D00F8E227 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; A93A954129CC810D00F8E227 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; @@ -153,7 +153,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$SRCROOT/../..\"\n./gradlew :sample:shared:embedAndSignAppleFrameworkForXcode\n"; + shellScript = "\ncd \"$SRCROOT/../..\"\n\nchmod +x ./gradlew\n\n./gradlew :sample:shared:embedAndSignAppleFrameworkForXcode\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -291,11 +291,12 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = D4RT859GVR; ENABLE_PREVIEWS = YES; - FRAMEWORK_SEARCH_PATHS = ( - "${inherited}", - "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", - ); + FRAMEWORK_SEARCH_PATHS = ( + "${inherited}", + "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", + ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -307,11 +308,11 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - OTHER_LDFLAGS = ( - "${inherited}", - "-framework", - shared, - ); + OTHER_LDFLAGS = ( + "${inherited}", + "-framework", + shared, + ); PRODUCT_BUNDLE_IDENTIFIER = tech.annexflow.sample.iosApp; PRODUCT_NAME = "constraintlayout-compose-multiplatform"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -328,11 +329,12 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; + DEVELOPMENT_TEAM = D4RT859GVR; ENABLE_PREVIEWS = YES; - FRAMEWORK_SEARCH_PATHS = ( - "${inherited}", - "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", - ); + FRAMEWORK_SEARCH_PATHS = ( + "${inherited}", + "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)", + ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -344,11 +346,11 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0; - OTHER_LDFLAGS = ( - "${inherited}", - "-framework", - shared, - ); + OTHER_LDFLAGS = ( + "${inherited}", + "-framework", + shared, + ); PRODUCT_BUNDLE_IDENTIFIER = tech.annexflow.sample.iosApp; PRODUCT_NAME = "constraintlayout-compose-multiplatform"; SWIFT_EMIT_LOC_STRINGS = YES;