From 33b7e31f35f76f1002ce586db681b6b0aefdf5fe Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Wed, 9 Oct 2024 16:56:56 -0400 Subject: [PATCH 1/4] initial commit --- androidApp/build.gradle.kts | 12 ++--- atomik/build.gradle.kts | 21 ++++---- build.gradle.kts | 23 ++++---- desktopApp/build.gradle.kts | 15 +++--- .../kotlin-project-structure-metadata.json | 28 ---------- .../build/tmp/allMetadataJar/MANIFEST.MF | 2 - gradle.properties | 5 -- gradle/libs.versions.toml | 21 ++++++++ gradle/wrapper/gradle-wrapper.properties | 3 +- settings.gradle.kts | 38 ++++---------- shared/build.gradle.kts | 52 +++++++++---------- .../fotopresenter/KoinAndroid.kt | 2 + .../com/kevinschildhorn/fotopresenter/Koin.kt | 2 +- 13 files changed, 97 insertions(+), 127 deletions(-) delete mode 100644 desktopApp/build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json delete mode 100644 desktopApp/build/tmp/allMetadataJar/MANIFEST.MF create mode 100644 gradle/libs.versions.toml diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index acef0180..73989477 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - kotlin("multiplatform") id("com.android.application") - id("org.jetbrains.compose") - id("com.google.gms.google-services") - id("com.google.firebase.crashlytics") + kotlin("multiplatform") + alias(libs.plugins.google.services) + alias(libs.plugins.crashlytics) + alias(libs.plugins.kotlin.compose) } kotlin { @@ -12,8 +12,8 @@ kotlin { val androidMain by getting { dependencies { implementation(project(":shared")) - implementation("io.insert-koin:koin-android:3.4.0") - implementation("com.google.firebase:firebase-crashlytics:18.6.0") + implementation("io.insert-koin:koin-android:3.5.3") + implementation("com.google.firebase:firebase-crashlytics:19.2.0") } } } diff --git a/atomik/build.gradle.kts b/atomik/build.gradle.kts index 606c3e12..6b9a6282 100644 --- a/atomik/build.gradle.kts +++ b/atomik/build.gradle.kts @@ -1,8 +1,8 @@ plugins { kotlin("multiplatform") - id("com.android.library") - id("org.jetbrains.compose") - id("org.jlleitschuh.gradle.ktlint") + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.compose) + alias(libs.plugins.ktlint) } /* // Exclude compose from iOS @@ -51,13 +51,14 @@ kotlin { jvmToolchain(15) sourceSets { val commonMain by getting { + dependencies { implementation(kotlin("stdlib-common")) - implementation("co.touchlab:kermit:1.2.2") - implementation(compose.runtime) + implementation("co.touchlab:kermit:2.0.4") + /*implementation(compose.runtime) implementation(compose.foundation) implementation(compose.material) - implementation(compose.ui) + implementation(compose.ui)*/ api("dev.icerock.moko:resources:0.23.0") api("dev.icerock.moko:resources-compose:0.23.0") // for compose multiplatform } @@ -73,9 +74,10 @@ kotlin { val androidMain by getting { dependsOn(jvmMain) + languageSettings.optIn("kotlin.ExperimentalMultiplatform") dependencies { - api("androidx.appcompat:appcompat:1.6.1") - api("androidx.core:core-ktx:1.12.0") + api("androidx.appcompat:appcompat:1.7.0") + api("androidx.core:core-ktx:1.13.1") } } /* @@ -91,6 +93,7 @@ kotlin { val desktopMain by getting { dependsOn(jvmMain) + languageSettings.optIn("kotlin.ExperimentalMultiplatform") } } } @@ -98,7 +101,7 @@ kotlin { android { namespace = "com.kevinschildhorn.atomik" - compileSdk = 33 + compileSdk = 34 defaultConfig { minSdk = (findProperty("android.minSdk") as String).toInt() diff --git a/build.gradle.kts b/build.gradle.kts index b9249406..50278925 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,13 @@ plugins { - // this is necessary to avoid the plugins to be loaded multiple times - // in each subproject's classloader - kotlin("multiplatform").apply(false) - id("com.android.application").apply(false) - id("com.android.library").apply(false) - id("org.jetbrains.compose").apply(false) - id("org.jlleitschuh.gradle.ktlint").version("12.0.2").apply(false) - id("dev.icerock.mobile.multiplatform-resources").version("0.23.0").apply(false) - id("app.cash.sqldelight").version("2.0.1").apply(false) - kotlin("plugin.serialization").version("1.9.21").apply(false) - id("com.google.firebase.crashlytics").version("2.9.9").apply(false) - id("com.google.gms.google-services").version("4.4.0").apply(false) + alias(libs.plugins.google.services).apply(false) + alias(libs.plugins.crashlytics).apply(false) + alias(libs.plugins.android.application).apply(false) + alias(libs.plugins.android.library).apply(false) + alias(libs.plugins.kotlin.android).apply(false) + alias(libs.plugins.kotlin.compose).apply(false) + alias(libs.plugins.sqldelight).apply(false) + alias(libs.plugins.resources).apply(false) + alias(libs.plugins.serialization).apply(false) + alias(libs.plugins.kotlinMultiplatform).apply(false) + } diff --git a/desktopApp/build.gradle.kts b/desktopApp/build.gradle.kts index 37d582e4..c2e526d4 100644 --- a/desktopApp/build.gradle.kts +++ b/desktopApp/build.gradle.kts @@ -1,8 +1,7 @@ -import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") - id("org.jetbrains.compose") + alias(libs.plugins.kotlin.compose) } kotlin { @@ -10,17 +9,17 @@ kotlin { sourceSets { val jvmMain by getting { dependencies { - implementation(compose.desktop.currentOs) - implementation("io.insert-koin:koin-core:3.4.0") - implementation("co.touchlab:kermit:1.2.2") - implementation("com.russhwolf:multiplatform-settings:1.0.0") + //implementation(compose.desktop.currentOs) + implementation("io.insert-koin:koin-core:3.5.3") + implementation("co.touchlab:kermit:2.0.4") + implementation("com.russhwolf:multiplatform-settings:1.1.1") implementation(project(":shared")) } } } } - +/* compose.desktop { application { mainClass = "MainKt" @@ -31,4 +30,4 @@ compose.desktop { packageVersion = "1.0.0" } } -} +}*/ diff --git a/desktopApp/build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json b/desktopApp/build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json deleted file mode 100644 index fda7cbb1..00000000 --- a/desktopApp/build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "projectStructure": { - "formatVersion": "0.3.3", - "isPublishedAsRoot": "true", - "variants": [ - { - "name": "jvmApiElements", - "sourceSet": [ - "commonMain" - ] - }, - { - "name": "jvmRuntimeElements", - "sourceSet": [ - "commonMain" - ] - } - ], - "sourceSets": [ - { - "name": "commonMain", - "dependsOn": [], - "moduleDependency": [], - "binaryLayout": "klib" - } - ] - } -} \ No newline at end of file diff --git a/desktopApp/build/tmp/allMetadataJar/MANIFEST.MF b/desktopApp/build/tmp/allMetadataJar/MANIFEST.MF deleted file mode 100644 index 59499bce..00000000 --- a/desktopApp/build/tmp/allMetadataJar/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/gradle.properties b/gradle.properties index 283cc9cd..6efd8543 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,8 +14,3 @@ android.useAndroidX=true android.compileSdk=34 android.targetSdk=34 android.minSdk=23 - -#Versions -kotlin.version=1.9.21 -agp.version=8.1.4 -compose.version=1.5.11 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..bcaae2a4 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,21 @@ +[versions] +agp = "8.5.2" +kotlin = "2.0.10" +crashlytics = "3.0.2" +google-services = "4.4.2" +ktlint-plugin = "12.1.1" +sqldelight = "2.0.2" +resources = "0.24.3" + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +google-services = { id = "com.google.gms.google-services", version.ref = "google-services" } +crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" } +sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } +resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "resources"} +serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a5952066..a19841b5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Wed Oct 09 16:09:25 EDT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index 63d189bd..8f47dbe6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,42 +1,22 @@ -rootProject.name = "FotoPresenter" - -include(":androidApp") -include(":shared") -include(":desktopApp") -include(":atomik") pluginManagement { repositories { - gradlePluginPortal() - mavenCentral() google() + mavenCentral() + gradlePluginPortal() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - - plugins { - val kotlinVersion = extra["kotlin.version"] as String - val agpVersion = extra["agp.version"] as String - val composeVersion = extra["compose.version"] as String - - kotlin("jvm").version(kotlinVersion) - kotlin("multiplatform").version(kotlinVersion) - kotlin("android").version(kotlinVersion) - - id("com.android.application").version(agpVersion) - id("com.android.library").version(agpVersion) - - id("org.jetbrains.compose").version(composeVersion) - } -} - -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0") } - dependencyResolutionManagement { repositories { - mavenCentral() google() + mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } } + +rootProject.name = "FotoPresenter" +include(":androidApp") +include(":shared") +include(":desktopApp") +include(":atomik") \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index b27f9b45..f522a775 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,13 +1,12 @@ plugins { - kotlin("multiplatform") - id("com.android.library") - id("org.jetbrains.compose") - id("org.jlleitschuh.gradle.ktlint") - id("dev.icerock.mobile.multiplatform-resources") - id("app.cash.sqldelight") - id("com.google.firebase.crashlytics") - - kotlin("plugin.serialization") + alias(libs.plugins.kotlinMultiplatform) + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.compose) + alias(libs.plugins.ktlint) + alias(libs.plugins.sqldelight) + //alias(libs.plugins.crashlytics) + alias(libs.plugins.resources) + alias(libs.plugins.serialization) } kotlin { @@ -29,21 +28,22 @@ kotlin { sourceSets { val commonMain by getting { dependencies { + implementation(kotlin("stdlib-common")) implementation(project(":atomik")) - implementation(compose.runtime) - implementation(compose.foundation) - implementation(compose.material) - @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) - implementation(compose.components.resources) + //implementation(compose.runtime) + //implementation(compose.foundation) + //implementation(compose.material) + //@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + //implementation(compose.components.resources) implementation("br.com.devsrsouza.compose.icons:eva-icons:1.1.0") implementation("io.github.reactivecircus.cache4k:cache4k:0.12.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2") - implementation("io.insert-koin:koin-core:3.4.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2") + implementation("io.insert-koin:koin-core:3.5.3") implementation("androidx.security:security-crypto:1.1.0-alpha06") - implementation("co.touchlab:kermit:1.2.2") + implementation("co.touchlab:kermit:2.0.4") implementation("co.touchlab:kermit-koin:1.2.2") - implementation("com.russhwolf:multiplatform-settings:1.0.0") - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation("com.russhwolf:multiplatform-settings:1.1.1") + implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0") implementation("com.ashampoo:kim:0.8.3") api("dev.icerock.moko:resources:0.23.0") api("dev.icerock.moko:resources-compose:0.23.0") // for compose multiplatform @@ -65,7 +65,7 @@ kotlin { resources.srcDir("src/commonMain/resources") dependencies { implementation("com.hierynomus:smbj:0.11.5") - implementation(compose.uiTooling) + //implementation(compose.uiTooling) implementation("app.cash.sqldelight:sqlite-driver:2.0.1") } } @@ -74,9 +74,9 @@ kotlin { dependsOn(jvmMain) resources.srcDirs("src/commonMain/resources") dependencies { - api("androidx.activity:activity-compose:1.8.1") - api("androidx.appcompat:appcompat:1.6.1") - api("androidx.core:core-ktx:1.12.0") + api("androidx.activity:activity-compose:2.0.10") + api("androidx.appcompat:appcompat:1.7.0") + api("androidx.core:core-ktx:1.13.1") implementation("io.github.kevinschildhorn:atomik:0.0.6") implementation("app.cash.sqldelight:android-driver:2.0.1") } @@ -97,8 +97,8 @@ kotlin { dependsOn(jvmMain) dependencies { resources.srcDirs("src/commonMain/resources") - implementation(compose.preview) - implementation(compose.desktop.common) + //implementation(compose.preview) + //implementation(compose.desktop.common) } } } @@ -125,7 +125,7 @@ android { } multiplatformResources { - multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required + //multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required } dependencies { diff --git a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt index f880f59b..b4b5b554 100644 --- a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt +++ b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/KoinAndroid.kt @@ -12,6 +12,7 @@ import com.kevinschildhorn.fotopresenter.ui.shared.DriverFactory import com.russhwolf.settings.Settings import com.russhwolf.settings.SharedPreferencesSettings import org.koin.core.KoinApplication +import org.koin.core.annotation.KoinInternalApi import org.koin.core.context.startKoin import org.koin.core.logger.Level import org.koin.core.module.Module @@ -46,6 +47,7 @@ internal actual val platformModule: Module = module { single { DriverFactory(context = get()).createDriver() } } +@OptIn(KoinInternalApi::class) fun KoinApplication.androidContext(androidContext: Context): KoinApplication { if (koin.logger.isAt(Level.INFO)) { koin.logger.info("[init] declare Android Context") diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/Koin.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/Koin.kt index 32f875b1..27543619 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/Koin.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/Koin.kt @@ -33,7 +33,7 @@ import org.koin.core.module.Module import org.koin.dsl.module -val baseLogger = Logger(LoggerConfig.default) +val baseLogger = Logger.withTag("") val commonModule = From 4af6c11838157e92c4460255d4b8bc102b5ecf31 Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Thu, 10 Oct 2024 10:48:09 -0400 Subject: [PATCH 2/4] updating more details --- androidApp/build.gradle.kts | 7 +- atomik/build.gradle.kts | 26 ++++-- build.gradle.kts | 3 +- desktopApp/build.gradle.kts | 8 +- gradle/libs.versions.toml | 54 +++++++++++- shared/build.gradle.kts | 84 +++++++++++-------- .../fotopresenter/UseCaseFactoryDesktop.kt | 1 - 7 files changed, 130 insertions(+), 53 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 73989477..1962eab1 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -3,7 +3,8 @@ plugins { kotlin("multiplatform") alias(libs.plugins.google.services) alias(libs.plugins.crashlytics) - alias(libs.plugins.kotlin.compose) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.jetbrains.compose) } kotlin { @@ -12,8 +13,8 @@ kotlin { val androidMain by getting { dependencies { implementation(project(":shared")) - implementation("io.insert-koin:koin-android:3.5.3") - implementation("com.google.firebase:firebase-crashlytics:19.2.0") + implementation(libs.koin.android) + implementation(libs.firebase.crashlytics) } } } diff --git a/atomik/build.gradle.kts b/atomik/build.gradle.kts index 6b9a6282..1cc4a759 100644 --- a/atomik/build.gradle.kts +++ b/atomik/build.gradle.kts @@ -1,7 +1,13 @@ +@file:OptIn(ExperimentalKotlinGradlePluginApi::class) + +import org.gradle.kotlin.dsl.add +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi + plugins { kotlin("multiplatform") alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.compose) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.jetbrains.compose) alias(libs.plugins.ktlint) } /* @@ -54,13 +60,13 @@ kotlin { dependencies { implementation(kotlin("stdlib-common")) - implementation("co.touchlab:kermit:2.0.4") - /*implementation(compose.runtime) + implementation(libs.kermit) + implementation(compose.runtime) implementation(compose.foundation) implementation(compose.material) - implementation(compose.ui)*/ - api("dev.icerock.moko:resources:0.23.0") - api("dev.icerock.moko:resources-compose:0.23.0") // for compose multiplatform + implementation(compose.ui) + api(libs.resources) + api(libs.resources.compose) // for compose multiplatform } } val commonTest by getting { @@ -76,8 +82,8 @@ kotlin { dependsOn(jvmMain) languageSettings.optIn("kotlin.ExperimentalMultiplatform") dependencies { - api("androidx.appcompat:appcompat:1.7.0") - api("androidx.core:core-ktx:1.13.1") + api(libs.appcompat) + api(libs.core.ktx) } } /* @@ -96,6 +102,10 @@ kotlin { languageSettings.optIn("kotlin.ExperimentalMultiplatform") } } + + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") + } } android { diff --git a/build.gradle.kts b/build.gradle.kts index 50278925..7d0d9df1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,8 @@ plugins { alias(libs.plugins.android.application).apply(false) alias(libs.plugins.android.library).apply(false) alias(libs.plugins.kotlin.android).apply(false) - alias(libs.plugins.kotlin.compose).apply(false) + alias(libs.plugins.compose.compiler).apply(false) + alias(libs.plugins.jetbrains.compose).apply(false) alias(libs.plugins.sqldelight).apply(false) alias(libs.plugins.resources).apply(false) alias(libs.plugins.serialization).apply(false) diff --git a/desktopApp/build.gradle.kts b/desktopApp/build.gradle.kts index c2e526d4..40940c87 100644 --- a/desktopApp/build.gradle.kts +++ b/desktopApp/build.gradle.kts @@ -1,7 +1,7 @@ plugins { kotlin("multiplatform") - alias(libs.plugins.kotlin.compose) + alias(libs.plugins.compose.compiler) } kotlin { @@ -10,9 +10,9 @@ kotlin { val jvmMain by getting { dependencies { //implementation(compose.desktop.currentOs) - implementation("io.insert-koin:koin-core:3.5.3") - implementation("co.touchlab:kermit:2.0.4") - implementation("com.russhwolf:multiplatform-settings:1.1.1") + implementation(libs.koin.core) + implementation(libs.kermit) + implementation(libs.multiplatform.settings) implementation(project(":shared")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bcaae2a4..e3ec5453 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,17 +1,69 @@ [versions] +activity-compose = "1.9.2" agp = "8.5.2" +appcompat = "1.7.0" +atomik = "0.0.6" +cache4k = "0.12.0" +core-ktx = "1.13.1" +eva-icons = "1.1.0" +firebase-crashlytics = "19.2.0" +kermit = "2.0.4" +kermit-koin = "1.2.2" +kim = "0.8.3" +koin-core = "3.5.3" +koin-test = "3.4.0" kotlin = "2.0.10" crashlytics = "3.0.2" google-services = "4.4.2" +kotlinx-datetime = "0.6.0" +kotlinx-serialization-json = "1.7.3" +ktlint = "0.0.26" ktlint-plugin = "12.1.1" +multiplatform-settings = "1.1.1" +multiplatform-settings-test = "1.0.0" +resources-version = "0.23.0" +security-crypto = "1.1.0-alpha06" +smbj = "0.11.5" sqldelight = "2.0.2" resources = "0.24.3" +compose = "1.6.11" +sqlite-driver = "2.0.1" +turbine = "1.0.0" + +[libraries] +activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" } +android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqlite-driver" } +appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +atomik = { module = "io.github.kevinschildhorn:atomik", version.ref = "atomik" } +cache4k = { module = "io.github.reactivecircus.cache4k:cache4k", version.ref = "cache4k" } +core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" } +eva-icons = { module = "br.com.devsrsouza.compose.icons:eva-icons", version.ref = "eva-icons" } +firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics", version.ref = "firebase-crashlytics" } +kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } +kermit-koin = { module = "co.touchlab:kermit-koin", version.ref = "kermit-koin" } +kim = { module = "com.ashampoo:kim", version.ref = "kim" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin-core" } +koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin-core" } +koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin-test" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-serialization-json" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } +ktlint = { module = "com.twitter.compose.rules:ktlint", version.ref = "ktlint" } +multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatform-settings" } +multiplatform-settings-test = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatform-settings-test" } +resources = { module = "dev.icerock.moko:resources", version.ref = "resources-version" } +resources-compose = { module = "dev.icerock.moko:resources-compose", version.ref = "resources-version" } +security-crypto = { module = "androidx.security:security-crypto", version.ref = "security-crypto" } +smbj = { module = "com.hierynomus:smbj", version.ref = "smbj" } +sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlite-driver" } +turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } [plugins] android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } google-services = { id = "com.google.gms.google-services", version.ref = "google-services" } crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index f522a775..a0bdac8a 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,7 +1,13 @@ +@file:OptIn(ExperimentalKotlinGradlePluginApi::class) + +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import kotlin.collections.plusAssign + plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.compose) + alias(libs.plugins.compose.compiler) + alias(libs.plugins.jetbrains.compose) alias(libs.plugins.ktlint) alias(libs.plugins.sqldelight) //alias(libs.plugins.crashlytics) @@ -26,37 +32,40 @@ kotlin { }*/ sourceSets { + all { + languageSettings.optIn("kotlin.RequiresOptIn") + } val commonMain by getting { dependencies { implementation(kotlin("stdlib-common")) implementation(project(":atomik")) - //implementation(compose.runtime) - //implementation(compose.foundation) - //implementation(compose.material) - //@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) - //implementation(compose.components.resources) - implementation("br.com.devsrsouza.compose.icons:eva-icons:1.1.0") - implementation("io.github.reactivecircus.cache4k:cache4k:0.12.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2") - implementation("io.insert-koin:koin-core:3.5.3") - implementation("androidx.security:security-crypto:1.1.0-alpha06") - implementation("co.touchlab:kermit:2.0.4") - implementation("co.touchlab:kermit-koin:1.2.2") - implementation("com.russhwolf:multiplatform-settings:1.1.1") - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0") - implementation("com.ashampoo:kim:0.8.3") - api("dev.icerock.moko:resources:0.23.0") - api("dev.icerock.moko:resources-compose:0.23.0") // for compose multiplatform + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(compose.components.resources) + implementation(libs.eva.icons) + implementation(libs.cache4k) + implementation(libs.kotlinx.serialization.json) + implementation(libs.koin.core) + implementation(libs.security.crypto) + implementation(libs.kermit) + implementation(libs.kermit.koin) + implementation(libs.multiplatform.settings) + implementation(libs.kotlinx.datetime) + implementation(libs.kim) + api(libs.resources) + api(libs.resources.compose) // for compose multiplatform } } val commonTest by getting { dependencies { implementation(kotlin("test")) - implementation("com.russhwolf:multiplatform-settings-test:1.0.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3") - implementation("io.insert-koin:koin-test:3.4.0") - implementation("app.cash.turbine:turbine:1.0.0") - implementation("app.cash.sqldelight:sqlite-driver:2.0.1") + implementation(libs.multiplatform.settings.test) + implementation(libs.kotlinx.coroutines.test) + implementation(libs.koin.test) + implementation(libs.turbine) + implementation(libs.sqlite.driver) } } @@ -64,9 +73,9 @@ kotlin { dependsOn(commonMain) resources.srcDir("src/commonMain/resources") dependencies { - implementation("com.hierynomus:smbj:0.11.5") - //implementation(compose.uiTooling) - implementation("app.cash.sqldelight:sqlite-driver:2.0.1") + implementation(libs.smbj) + implementation(compose.uiTooling) + implementation(libs.sqlite.driver) } } @@ -74,11 +83,11 @@ kotlin { dependsOn(jvmMain) resources.srcDirs("src/commonMain/resources") dependencies { - api("androidx.activity:activity-compose:2.0.10") - api("androidx.appcompat:appcompat:1.7.0") - api("androidx.core:core-ktx:1.13.1") - implementation("io.github.kevinschildhorn:atomik:0.0.6") - implementation("app.cash.sqldelight:android-driver:2.0.1") + api(libs.activity.compose) + api(libs.appcompat) + api(libs.core.ktx) + implementation(libs.atomik) + implementation(libs.android.driver) } } /* @@ -97,11 +106,15 @@ kotlin { dependsOn(jvmMain) dependencies { resources.srcDirs("src/commonMain/resources") - //implementation(compose.preview) - //implementation(compose.desktop.common) + implementation(compose.preview) + implementation(compose.desktop.common) } } } + + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") + } } android { @@ -125,11 +138,12 @@ android { } multiplatformResources { - //multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required + resourcesPackage.set("com.kevinschildhorn.fotopresenter") // required + resourcesClassName.set("SharedRes") } dependencies { - ktlintRuleset("com.twitter.compose.rules:ktlint:0.0.26") + ktlintRuleset(libs.ktlint) } sqldelight { diff --git a/shared/src/desktopMain/kotlin/com/kevinschildhorn/fotopresenter/UseCaseFactoryDesktop.kt b/shared/src/desktopMain/kotlin/com/kevinschildhorn/fotopresenter/UseCaseFactoryDesktop.kt index 7ff30a9b..460b0abf 100644 --- a/shared/src/desktopMain/kotlin/com/kevinschildhorn/fotopresenter/UseCaseFactoryDesktop.kt +++ b/shared/src/desktopMain/kotlin/com/kevinschildhorn/fotopresenter/UseCaseFactoryDesktop.kt @@ -32,7 +32,6 @@ import java.util.prefs.Preferences actual object UseCaseFactory { - val baseLogger = Logger(LoggerConfig.default) private val preferences: Preferences = Preferences.userRoot() private val settings = PreferencesSettings(preferences) private val networkHandler: NetworkHandler = SMBJHandler From 226f277661a52995b15f581437126cd0a92d9984 Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Thu, 10 Oct 2024 11:39:46 -0400 Subject: [PATCH 3/4] updating dependencies --- androidApp/build.gradle.kts | 11 +++++---- atomik/build.gradle.kts | 23 ++++++++----------- .../atomik/atomic/atoms/compose/+TextAtom.kt | 2 +- gradle.properties | 3 --- gradle/libs.versions.toml | 15 +++++++++--- shared/build.gradle.kts | 13 +++++------ .../screens/common/composables/AtomikText.kt | 2 +- .../screens/common/composables/ErrorView.kt | 2 -- .../common/composables/PrimaryTextButton.kt | 2 +- .../screens/common/composables/TitleView.kt | 3 --- .../common/composables/ToastOverlay.kt | 2 +- .../ui/screens/directory/DirectoryScreen.kt | 2 +- .../composables/grid/DirectoryGridCell.kt | 2 +- .../composables/LoginPasswordTextField.kt | 2 +- .../login/composables/LoginTextField.kt | 2 +- .../composables/PlaylistScreenCreateRow.kt | 4 ---- .../composables/PlaylistScreenPlaylistRow.kt | 4 ---- 17 files changed, 43 insertions(+), 51 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 1962eab1..1614f358 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -1,3 +1,6 @@ +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.java + plugins { id("com.android.application") kotlin("multiplatform") @@ -21,15 +24,15 @@ kotlin { } android { - compileSdk = (findProperty("android.compileSdk") as String).toInt() + compileSdk = libs.versions.compileSdk.get().toInt() namespace = "com.kevinschildhorn" sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { applicationId = "com.kevinschildhorn.fotopresenter" - minSdk = (findProperty("android.minSdk") as String).toInt() - targetSdk = (findProperty("android.targetSdk") as String).toInt() + minSdk = libs.versions.minSdk.get().toInt() + targetSdk = libs.versions.targetSdk.get().toInt() versionCode = 1 versionName = "1.0" } @@ -38,6 +41,6 @@ android { targetCompatibility = JavaVersion.VERSION_17 } kotlin { - jvmToolchain(17) + jvmToolchain(libs.versions.java.get().toInt()) } } diff --git a/atomik/build.gradle.kts b/atomik/build.gradle.kts index 1cc4a759..56a243bd 100644 --- a/atomik/build.gradle.kts +++ b/atomik/build.gradle.kts @@ -1,6 +1,9 @@ @file:OptIn(ExperimentalKotlinGradlePluginApi::class) import org.gradle.kotlin.dsl.add +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.implementation +import org.gradle.kotlin.dsl.java import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { @@ -29,12 +32,6 @@ android { namespace = "com.kevinschildhorn.atomik" } -tasks.withType().configureEach { - kotlinOptions { - jvmTarget = "15" - } -} - kotlin { explicitApi() applyDefaultHierarchyTemplate() @@ -54,7 +51,7 @@ kotlin { }*/ jvm("desktop") - jvmToolchain(15) + jvmToolchain(libs.versions.java.get().toInt()) sourceSets { val commonMain by getting { @@ -65,8 +62,8 @@ kotlin { implementation(compose.foundation) implementation(compose.material) implementation(compose.ui) - api(libs.resources) - api(libs.resources.compose) // for compose multiplatform + implementation(compose.components.resources) + api(libs.bundles.moko.resources) } } val commonTest by getting { @@ -111,15 +108,15 @@ kotlin { android { namespace = "com.kevinschildhorn.atomik" - compileSdk = 34 + compileSdk = libs.versions.compileSdk.get().toInt() defaultConfig { - minSdk = (findProperty("android.minSdk") as String).toInt() + minSdk = libs.versions.minSdk.get().toInt() } compileOptions { - sourceCompatibility = JavaVersion.VERSION_15 - targetCompatibility = JavaVersion.VERSION_15 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } sourceSets { diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt index 296a704d..a3b655c4 100644 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt +++ b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt @@ -1,6 +1,6 @@ @file:Suppress("ktlint:standard:filename") -package com.kevinschildhorn.atomik.atomic.atoms +package com.kevinschildhorn.atomik.atomic.atoms.compose import androidx.compose.runtime.Composable import androidx.compose.ui.text.TextStyle diff --git a/gradle.properties b/gradle.properties index 6efd8543..8b768577 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,3 @@ kotlin.mpp.androidSourceSetLayoutVersion=2 #Android android.useAndroidX=true -android.compileSdk=34 -android.targetSdk=34 -android.minSdk=23 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e3ec5453..57a818b8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,11 +25,17 @@ resources-version = "0.23.0" security-crypto = "1.1.0-alpha06" smbj = "0.11.5" sqldelight = "2.0.2" -resources = "0.24.3" +resources = "0.23.0" compose = "1.6.11" sqlite-driver = "2.0.1" turbine = "1.0.0" +## SDK Versions +minSdk = "23" +targetSdk = "34" +compileSdk = "34" +java = "21" + [libraries] activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" } android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqlite-driver" } @@ -51,8 +57,8 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa ktlint = { module = "com.twitter.compose.rules:ktlint", version.ref = "ktlint" } multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatform-settings" } multiplatform-settings-test = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatform-settings-test" } -resources = { module = "dev.icerock.moko:resources", version.ref = "resources-version" } -resources-compose = { module = "dev.icerock.moko:resources-compose", version.ref = "resources-version" } +moko-resource = { module = "dev.icerock.moko:resources", version.ref = "resources-version" } +moko-resource-compose = { module = "dev.icerock.moko:resources-compose", version.ref = "resources-version" } security-crypto = { module = "androidx.security:security-crypto", version.ref = "security-crypto" } smbj = { module = "com.hierynomus:smbj", version.ref = "smbj" } sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlite-driver" } @@ -71,3 +77,6 @@ ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" } sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "resources"} serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } + +[bundles] +moko-resources = ["moko-resource", "moko-resource-compose"] \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index a0bdac8a..90c337ce 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,5 +1,6 @@ @file:OptIn(ExperimentalKotlinGradlePluginApi::class) +import org.gradle.kotlin.dsl.get import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import kotlin.collections.plusAssign @@ -54,8 +55,7 @@ kotlin { implementation(libs.multiplatform.settings) implementation(libs.kotlinx.datetime) implementation(libs.kim) - api(libs.resources) - api(libs.resources.compose) // for compose multiplatform + api(libs.bundles.moko.resources) } } val commonTest by getting { @@ -118,7 +118,7 @@ kotlin { } android { - compileSdk = (findProperty("android.compileSdk") as String).toInt() + compileSdk = libs.versions.compileSdk.get().toInt() namespace = "com.kevinschildhorn.common" sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") @@ -126,20 +126,19 @@ android { sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - minSdk = (findProperty("android.minSdk") as String).toInt() + minSdk = libs.versions.minSdk.get().toInt() } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlin { - jvmToolchain(17) + jvmToolchain(libs.versions.java.get().toInt()) } } multiplatformResources { - resourcesPackage.set("com.kevinschildhorn.fotopresenter") // required - resourcesClassName.set("SharedRes") + multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required } dependencies { diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikText.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikText.kt index 64ddc51f..05d73a9e 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikText.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikText.kt @@ -4,7 +4,7 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.atomik.color.base.composeColor @Composable diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ErrorView.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ErrorView.kt index 444ef6f3..db75bc8a 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ErrorView.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ErrorView.kt @@ -4,11 +4,9 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms.errorView diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt index 9b3b12db..ec1bc121 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt @@ -4,7 +4,7 @@ package com.kevinschildhorn.fotopresenter.ui.screens.common.composables import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms @Composable diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt index de287166..c414599a 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt @@ -1,10 +1,7 @@ package com.kevinschildhorn.fotopresenter.ui.screens.common.composables -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.kevinschildhorn.atomik.atomic.atoms.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms.title diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt index 8e8fe956..547b7fba 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors import com.kevinschildhorn.fotopresenter.ui.atoms.Padding diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt index 4917e0ad..0345e49d 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.data.ImageSlideshowDetails import com.kevinschildhorn.fotopresenter.ui.UiState diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt index 243b76c2..eda2ef93 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt index 18cdedd4..e9475a2d 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import com.kevinschildhorn.atomik.atomic.atoms.shape -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms import compose.icons.EvaIcons import compose.icons.evaicons.Fill diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt index 2f45f716..23d4412f 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt @@ -5,7 +5,7 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.kevinschildhorn.atomik.atomic.atoms.shape -import com.kevinschildhorn.atomik.atomic.atoms.textStyle +import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms @Composable diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt index 3f6746ae..2967f69a 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt @@ -5,15 +5,11 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.atoms.Padding import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt index 2e4967c8..920f33db 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt @@ -8,15 +8,11 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width -import androidx.compose.material.Icon -import androidx.compose.material.Text import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms From ffcd000e9e479205a066a3cdcb256674c69cad4f Mon Sep 17 00:00:00 2001 From: Kevin Schildhorn Date: Thu, 10 Oct 2024 13:40:46 -0400 Subject: [PATCH 4/4] Fixing composables --- androidApp/build.gradle.kts | 4 +- atomik/.gitignore | 1 - atomik/build.gradle.kts | 133 ------------------ atomik/src/androidMain/AndroidManifest.xml | 2 - .../atomic/atoms/xml/EditTextExtensions.kt | 12 -- .../atomic/atoms/xml/TextViewExtensions.kt | 37 ----- .../atomik/atomic/atoms/xml/ViewExtensions.kt | 18 --- .../atomik/color/base/AtomikColor.kt | 52 ------- .../typography/AtomikTypographyExtensions.kt | 26 ---- .../typography/PlatformTypographySet.kt | 55 -------- .../kevinschildhorn/atomik/DesignSystem.kt | 63 --------- .../atomik/ExperimentalAtomik.kt | 6 - .../atomik/atomic/atoms/Atom.kt | 39 ----- .../atomik/atomic/atoms/FigmaAtom.kt | 115 --------------- .../atomik/atomic/atoms/ImageAtom.kt | 12 -- .../atomik/atomic/atoms/TextViewAtom.kt | 25 ---- .../atomic/atoms/compose/+AtomikColorType.kt | 14 -- .../atomic/atoms/compose/+ConstrainedAtom.kt | 57 -------- .../atomic/atoms/compose/+EnablableAtom.kt | 13 -- .../atomic/atoms/compose/+FixedSizeAtom.kt | 14 -- .../atomic/atoms/compose/+RoundedAtom.kt | 11 -- .../atomik/atomic/atoms/compose/+TextAtom.kt | 43 ------ .../atomic/atoms/interfaces/AtomInterface.kt | 13 -- .../atomic/atoms/interfaces/AtomType.kt | 18 --- .../atomic/atoms/interfaces/BorderedAtom.kt | 22 --- .../atomic/atoms/interfaces/ColorAtom.kt | 26 ---- .../atoms/interfaces/ConstrainedAtom.kt | 40 ------ .../atomic/atoms/interfaces/EnablableAtom.kt | 19 --- .../atomic/atoms/interfaces/FixedSizeAtom.kt | 20 --- .../atomic/atoms/interfaces/PaddingAtom.kt | 36 ----- .../atomic/atoms/interfaces/ResourceAtom.kt | 10 -- .../atomic/atoms/interfaces/RoundedAtom.kt | 18 --- .../atomic/atoms/interfaces/TextAtom.kt | 36 ----- .../atomik/atomic/molecules/BaseMolecule.kt | 15 -- .../molecules/OutlinedTextFieldMolecule.kt | 86 ----------- .../atomic/molecules/TextButtonMolecule.kt | 16 --- .../atomic/molecules/TextFieldMolecule.kt | 74 ---------- .../atomik/atomic/organisms/BaseOrganism.kt | 7 - .../atomik/atomic/organisms/FormOrganism.kt | 7 - .../atomik/color/CustomColorSet.kt | 26 ---- .../atomik/color/CustomColorSetTyped.kt | 33 ----- .../atomik/color/base/AtomikColor.kt | 52 ------- .../atomik/color/base/AtomikColorData.kt | 101 ------------- .../atomik/color/base/AtomikColorType.kt | 13 -- .../atomik/color/base/ColorSet.kt | 20 --- .../atomik/typography/+TypographyWeight.kt | 17 --- .../atomik/typography/CustomTypographySet.kt | 27 ---- .../typography/CustomTypographySetTyped.kt | 34 ----- .../typography/base/AtomikFontFamily.kt | 14 -- .../typography/base/AtomikTypography.kt | 17 --- .../typography/base/AtomikTypographyType.kt | 13 -- .../typography/base/AtomikTypographyWeight.kt | 18 --- .../atomik/typography/base/TypographySet.kt | 20 --- .../kevinschildhorn/atomik/AtomikColorTest.kt | 103 -------------- .../atomik/color/base/AtomikColor.kt | 55 -------- .../atomik/atomic/atoms/+TextAtom.kt | 10 -- .../atomik/color/base/AtomikColor.kt | 48 ------- .../atomik/typography/+TypographyWeight.kt | 33 ----- .../typography/PlatformTypographySet.kt | 38 ----- .../typography/base/AtomikFontFamily.kt | 16 --- .../atomik/atomic/atoms/+Modifier.kt | 18 --- .../typography/base/AtomikFontFamily.kt | 15 -- build.gradle.kts | 1 - desktopApp/build.gradle.kts | 8 +- desktopApp/src/jvmMain/kotlin/Main.kt | 9 +- gradle/libs.versions.toml | 10 +- settings.gradle.kts | 1 - shared/build.gradle.kts | 12 +- .../ui/shared/SharedImageConverter.kt | 2 +- .../font/quicksand_bold.ttf} | Bin .../font/quicksand_light.ttf} | Bin .../font/quicksand_medium.ttf} | Bin .../font/quicksand_regular.ttf} | Bin .../font/quicksand_semibold.ttf} | Bin .../fotopresenter/ui/atoms/FotoColors.kt | 44 ++++-- .../fotopresenter/ui/atoms/FotoTypography.kt | 63 +++++---- .../fotopresenter/ui/screens/.DS_Store | Bin 0 -> 6148 bytes .../fotopresenter/ui/screens/common/.DS_Store | Bin 0 -> 6148 bytes .../ui/screens/common/CommonAtoms.kt | 32 ----- .../ui/screens/common/composables/.DS_Store | Bin 0 -> 6148 bytes .../screens/common/composables/ActionSheet.kt | 8 +- .../screens/common/composables/AtomikIcon.kt | 23 --- .../screens/common/composables/AtomikText.kt | 18 --- .../common/composables/ConfirmationDialog.kt | 3 +- .../common/composables/DialogButtonText.kt | 47 +++++++ .../screens/common/composables/ErrorView.kt | 13 +- .../common/composables/FilterDialog.kt | 28 +++- .../screens/common/composables/FotoDIalog.kt | 15 +- .../common/composables/ImagePreviewOverlay.kt | 4 +- .../common/composables/LoadingOverlay.kt | 8 +- .../ui/screens/common/composables/Overlay.kt | 6 +- .../common/composables/PrimaryButton.kt | 11 +- .../common/composables/PrimaryTextButton.kt | 8 +- .../screens/common/composables/TitleView.kt | 5 +- .../common/composables/ToastOverlay.kt | 11 +- .../ui/screens/directory/.DS_Store | Bin 0 -> 6148 bytes .../ui/screens/directory/DirectoryAtoms.kt | 55 -------- .../ui/screens/directory/DirectoryScreen.kt | 12 +- .../composables/grid/DirectoryGridCell.kt | 12 +- .../grid/FolderDirectoryGridCell.kt | 14 +- .../grid/ImageDirectoryGridCell.kt | 7 +- .../navbar/DirectoryNavigationBar.kt | 5 +- .../navbar/DirectoryNavigationHome.kt | 20 ++- .../navbar/DirectoryNavigationItem.kt | 19 +-- .../navrail/DirectoryTitleBarButton.kt | 5 +- .../navrail/NavigationRailOverlay.kt | 13 +- .../ui/screens/login/LoginScreenAtoms.kt | 62 -------- .../composables/LoginPasswordTextField.kt | 18 +-- .../login/composables/LoginTextField.kt | 30 ++-- .../screens/playlist/PlaylistScreenAtoms.kt | 20 --- .../playlist/composables/PlaylistColumn.kt | 16 +-- .../composables/PlaylistScreenCreateRow.kt | 13 +- .../composables/PlaylistScreenPlaylistRow.kt | 21 ++- .../kevinschildhorn/fotopresenter/KoinTest.kt | 2 +- .../domain/SaveCredentialsUseCaseTest.kt | 2 +- 115 files changed, 276 insertions(+), 2416 deletions(-) delete mode 100644 atomik/.gitignore delete mode 100644 atomik/build.gradle.kts delete mode 100644 atomik/src/androidMain/AndroidManifest.xml delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/EditTextExtensions.kt delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/TextViewExtensions.kt delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/ViewExtensions.kt delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/AtomikTypographyExtensions.kt delete mode 100644 atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/DesignSystem.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/ExperimentalAtomik.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/Atom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/FigmaAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/ImageAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextViewAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+AtomikColorType.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+ConstrainedAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+EnablableAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+FixedSizeAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+RoundedAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomInterface.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomType.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/BorderedAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ColorAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ConstrainedAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/EnablableAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/FixedSizeAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/PaddingAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ResourceAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/RoundedAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/TextAtom.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/BaseMolecule.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextButtonMolecule.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/BaseOrganism.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/FormOrganism.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSet.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSetTyped.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorData.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorType.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/ColorSet.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySet.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySetTyped.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypography.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyType.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyWeight.kt delete mode 100644 atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/TypographySet.kt delete mode 100644 atomik/src/commonTest/kotlin/com/kevinschildhorn/atomik/AtomikColorTest.kt delete mode 100644 atomik/src/desktopMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt delete mode 100644 atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+TextAtom.kt delete mode 100644 atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt delete mode 100644 atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt delete mode 100644 atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt delete mode 100644 atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt delete mode 100644 atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+Modifier.kt delete mode 100644 atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt rename shared/src/commonMain/{resources/MR/fonts/Quicksand-Bold.ttf => composeResources/font/quicksand_bold.ttf} (100%) rename shared/src/commonMain/{resources/MR/fonts/Quicksand-Light.ttf => composeResources/font/quicksand_light.ttf} (100%) rename shared/src/commonMain/{resources/MR/fonts/Quicksand-Medium.ttf => composeResources/font/quicksand_medium.ttf} (100%) rename shared/src/commonMain/{resources/MR/fonts/Quicksand-Regular.ttf => composeResources/font/quicksand_regular.ttf} (100%) rename shared/src/commonMain/{resources/MR/fonts/Quicksand-Semibold.ttf => composeResources/font/quicksand_semibold.ttf} (100%) create mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/.DS_Store create mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/.DS_Store delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/CommonAtoms.kt create mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/.DS_Store delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikIcon.kt delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/AtomikText.kt create mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/DialogButtonText.kt create mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/.DS_Store delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryAtoms.kt delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/LoginScreenAtoms.kt delete mode 100644 shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/PlaylistScreenAtoms.kt diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 1614f358..d536b274 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -37,8 +37,8 @@ android { versionName = "1.0" } compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } kotlin { jvmToolchain(libs.versions.java.get().toInt()) diff --git a/atomik/.gitignore b/atomik/.gitignore deleted file mode 100644 index 42afabfd..00000000 --- a/atomik/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/atomik/build.gradle.kts b/atomik/build.gradle.kts deleted file mode 100644 index 56a243bd..00000000 --- a/atomik/build.gradle.kts +++ /dev/null @@ -1,133 +0,0 @@ -@file:OptIn(ExperimentalKotlinGradlePluginApi::class) - -import org.gradle.kotlin.dsl.add -import org.gradle.kotlin.dsl.get -import org.gradle.kotlin.dsl.implementation -import org.gradle.kotlin.dsl.java -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi - -plugins { - kotlin("multiplatform") - alias(libs.plugins.android.library) - alias(libs.plugins.compose.compiler) - alias(libs.plugins.jetbrains.compose) - alias(libs.plugins.ktlint) -} -/* -// Exclude compose from iOS -plugins.removeAll { it is ComposeCompilerKotlinSupportPlugin } -class ComposeNoNativePlugin : org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin by ComposeCompilerKotlinSupportPlugin() { - override fun isApplicable(kotlinCompilation: org.jetbrains.kotlin.gradle.plugin.KotlinCompilation<*>): Boolean { - return when (kotlinCompilation.target.platformType) { - org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.native -> false - else -> ComposeCompilerKotlinSupportPlugin().isApplicable(kotlinCompilation) - } - } -} -apply() // Re-adding Compose Compilers only for non-native environments -*/ -group = "io.github.kevinschildhorn" -version = "0.0.6" -android { - namespace = "com.kevinschildhorn.atomik" -} - -kotlin { - explicitApi() - applyDefaultHierarchyTemplate() - androidTarget { - publishLibraryVariants("debug", "release") - } - jvm("desktop") - /* - listOf( - iosX64(), - iosArm64(), - iosSimulatorArm64(), - ).forEach { iosTarget -> - iosTarget.binaries.framework { - baseName = "atomik" - } - }*/ - jvm("desktop") - - jvmToolchain(libs.versions.java.get().toInt()) - sourceSets { - val commonMain by getting { - - dependencies { - implementation(kotlin("stdlib-common")) - implementation(libs.kermit) - implementation(compose.runtime) - implementation(compose.foundation) - implementation(compose.material) - implementation(compose.ui) - implementation(compose.components.resources) - api(libs.bundles.moko.resources) - } - } - val commonTest by getting { - dependencies { - implementation(kotlin("test")) - } - } - val jvmMain by creating { - dependsOn(commonMain) - } - - val androidMain by getting { - dependsOn(jvmMain) - languageSettings.optIn("kotlin.ExperimentalMultiplatform") - dependencies { - api(libs.appcompat) - api(libs.core.ktx) - } - } - /* - val iosX64Main by getting - val iosArm64Main by getting - val iosSimulatorArm64Main by getting - val iosMain by getting { - dependsOn(commonMain) - iosX64Main.dependsOn(this) - iosArm64Main.dependsOn(this) - iosSimulatorArm64Main.dependsOn(this) - }*/ - - val desktopMain by getting { - dependsOn(jvmMain) - languageSettings.optIn("kotlin.ExperimentalMultiplatform") - } - } - - compilerOptions { - freeCompilerArgs.add("-Xexpect-actual-classes") - } -} - -android { - namespace = "com.kevinschildhorn.atomik" - - compileSdk = libs.versions.compileSdk.get().toInt() - - defaultConfig { - minSdk = libs.versions.minSdk.get().toInt() - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 - } - - sourceSets { - named("main") { - manifest.srcFile("src/androidMain/AndroidManifest.xml") - res.srcDirs("src/androidMain/res") - } - } - buildTypes { - release { - isMinifyEnabled = true - } - } -} diff --git a/atomik/src/androidMain/AndroidManifest.xml b/atomik/src/androidMain/AndroidManifest.xml deleted file mode 100644 index de749acb..00000000 --- a/atomik/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/EditTextExtensions.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/EditTextExtensions.kt deleted file mode 100644 index e175de86..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/EditTextExtensions.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.xml - -import android.widget.EditText -import com.kevinschildhorn.atomik.atomic.molecules.TextFieldMolecule - -public fun EditText.applyMolecule(molecule: TextFieldMolecule) { - setTextColor(molecule.textAtom.textColor.viewColor) - // setBackgroundColor(molecule.backgroundColorAtom.color.viewColor) TODO Add later - molecule.hintTextAtom?.let { - setHintTextColor(it.textColor.viewColor) - } -} diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/TextViewExtensions.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/TextViewExtensions.kt deleted file mode 100644 index b4c03cfb..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/TextViewExtensions.kt +++ /dev/null @@ -1,37 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.xml - -import android.widget.TextView -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.typography.typeFace - -/** - * Applies a [TextAtom] to a [TextView], setting the text color and size - * - * @param textAtom the [TextAtom] that will be applied to the [TextView] - */ -public fun TextView.applyTextAtom(textAtom: TextAtom?) { - textAtom?.let { - setTextColor(it.textColor.viewColor) - typeface = it.typography.typeFace - textSize = it.typography.size.toFloat() - } -} - -/** - * Applies a [ColorAtom] to a [TextView], setting the text color - * - * @param colorAtom the [ColorAtom] that will be applied to the [TextView] - * @param foreground a [Boolean] indicating whether the atom should be applied to the foreground or background [TextView] - */ -public fun TextView.applyColorAtom(colorAtom: ColorAtom?, foreground: Boolean = true) { - colorAtom?.let { - if (foreground) { - setTextColor(it.color.viewColor) - } else { - setBackgroundColor(it.color.viewColor) - } - } -} diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/ViewExtensions.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/ViewExtensions.kt deleted file mode 100644 index 2d830197..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/xml/ViewExtensions.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.xml - -import android.view.View -import android.widget.TextView -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom - -/** - * Applies a [ColorAtom] to a [TextView], setting the background color - * - * @param colorAtom the [ColorAtom] that will be applied to the [View] - */ -public fun View.applyColorAtom(colorAtom: ColorAtom?) { - colorAtom?.let { - setBackgroundColor(it.color.viewColor) - } -} diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt deleted file mode 100644 index 5e642a52..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -import androidx.compose.ui.graphics.Color - -/* - * Android implementation of [AtomikColor] - * - * @property viewColor the AtomikColor as an android graphics Color [android.graphics.Color] - * (https://developer.android.com/reference/android/graphics/Color#parseColor(java.lang.String)) - * Format is either #RRGGBB or #AARRGGBB - * @property composeColor the AtomikColor as a compose Color [androidx.compose.ui.graphics.Color] - * hex code for color (#AARRGGBB) (alpha optional) - * @property hexString The hex value of the color (#AARRGGBB) - * @property r The red Value (0-255) - * @property g The red Value (0-255) - * @property b The red Value (0-255) - * @property a The alpha Value (0-1) (Defaults to 1) - */ -public actual class AtomikColor { - public actual val hexString: String - public actual val r: Int - public actual val g: Int - public actual val b: Int - public actual val a: Float - - /* - * hex code for color (#AARRGGBB) (alpha optional) - */ - private val androidHexColor: String - public val viewColor: Int - get() = android.graphics.Color.parseColor(androidHexColor) - - public actual constructor(hex: Long) { - val data = AtomikColorData(hex) - this.hexString = data.hexString - this.androidHexColor = data.hexStringAlphaFirst - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } - - public actual constructor(r: Int, g: Int, b: Int, a: Float?) { - val data = AtomikColorData(r, g, b, a) - this.hexString = data.hexString - this.androidHexColor = data.hexStringAlphaFirst - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } -} diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/AtomikTypographyExtensions.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/AtomikTypographyExtensions.kt deleted file mode 100644 index ebaad42f..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/AtomikTypographyExtensions.kt +++ /dev/null @@ -1,26 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.typography - -import android.graphics.Typeface -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.unit.sp -import com.kevinschildhorn.atomik.typography.base.AtomikTypography -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyWeight - -public fun AtomikTypography.asComposeTextStyle(fontFamily: FontFamily): TextStyle = - TextStyle( - fontFamily = fontFamily, - fontWeight = this.weight.fontWeight, - fontSize = this.size.sp, - ) - -/* - * Converting the Weight to a Typeface - */ -public val AtomikTypography.typeFace: Typeface - get() = when (this.weight) { - AtomikTypographyWeight.BOLD -> Typeface.DEFAULT_BOLD - else -> Typeface.DEFAULT - } diff --git a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt b/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt deleted file mode 100644 index beb37ad2..00000000 --- a/atomik/src/androidMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.kevinschildhorn.atomik.typography - -/* -actual class PlatformTypographySet// actual constructor(typographySet: DefaultTypographySet) : TypographySet { - - val h1: AtomikTypography = typographySet.h1 ?: typographySet.fallbackTypography - val h2: AtomikTypography = typographySet.h2 ?: typographySet.fallbackTypography - val h3: AtomikTypography = typographySet.h3 ?: typographySet.fallbackTypography - val h4: AtomikTypography = typographySet.h4 ?: typographySet.fallbackTypography - val h5: AtomikTypography = typographySet.h5 ?: typographySet.fallbackTypography - val h6: AtomikTypography = h5 - val subtitle1: AtomikTypography = typographySet.subtitle ?: typographySet.fallbackTypography - val subtitle2: AtomikTypography = typographySet.subtitle ?: typographySet.fallbackTypography - val body: AtomikTypography = typographySet.body - val body2: AtomikTypography = body - val button: AtomikTypography = typographySet.button ?: typographySet.fallbackTypography - val caption: AtomikTypography = typographySet.caption ?: typographySet.fallbackTypography - val overline: AtomikTypography = typographySet.footnote ?: typographySet.fallbackTypography - - fun asComposeTypography(fontFamily: FontFamily) = androidx.compose.material.Typography( - h1 = h1.asComposeTextStyle(fontFamily), - h2 = h2.asComposeTextStyle(fontFamily), - h3 = h3.asComposeTextStyle(fontFamily), - h4 = h4.asComposeTextStyle(fontFamily), - h5 = h5.asComposeTextStyle(fontFamily), - h6 = h6.asComposeTextStyle(fontFamily), - subtitle1 = subtitle1.asComposeTextStyle(fontFamily), - subtitle2 = subtitle2.asComposeTextStyle(fontFamily), - body1 = body.asComposeTextStyle(fontFamily), - body2 = body2.asComposeTextStyle(fontFamily), - button = button.asComposeTextStyle(fontFamily), - caption = caption.asComposeTextStyle(fontFamily), - overline = overline.asComposeTextStyle(fontFamily), - ) - - override val fallbackTypography: AtomikTypography = typographySet.fallbackTypography - - override fun getTypography(type: AtomikTypographyType): AtomikTypography = fallbackTypography - when (type) { - AtomikTypographyType.H1 -> h1 - AtomikTypographyType.H2 -> h2 - AtomikTypographyType.H3 -> h3 - AtomikTypographyType.H4 -> h4 - AtomikTypographyType.H5 -> h5 - AtomikTypographyType.H6 -> h6 - AtomikTypographyType.Subtitle -> subtitle1 - AtomikTypographyType.Subtitle2 -> subtitle2 - AtomikTypographyType.Body -> body - AtomikTypographyType.Body2 -> body2 - AtomikTypographyType.Button -> button - AtomikTypographyType.Caption -> caption - AtomikTypographyType.Overline -> overline - else -> fallbackTypography - } -}*/ diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/DesignSystem.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/DesignSystem.kt deleted file mode 100644 index 3ea3e6c4..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/DesignSystem.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.kevinschildhorn.atomik - -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.color.CustomColorSet -import com.kevinschildhorn.atomik.color.base.ColorSet -import com.kevinschildhorn.atomik.typography.CustomTypographySet -import com.kevinschildhorn.atomik.typography.base.AtomikFontFamily -import com.kevinschildhorn.atomik.typography.base.TypographySet - -/** - * A Design System - * - * This is the core of the Atomik Library, representing a Design Systems components. - * This is based on atomic design which is included in the Design System - * - * @property colorSet the collection of colors to be used in this Design System - * @property typographySet the collection of typohraphies to be used in this Design System - * @property components the atomic components to be used in this Design System - * @property fontFamily the font family passed into the Design System from the Platform level - */ -@ExperimentalAtomik -public open class DesignSystem( - public open val colorSet: ColorSet, - public open val typographySet: TypographySet, - public open val components: Map, - public open var fontFamily: AtomikFontFamily? = null, -) -/* -@OptIn(ExperimentalAtomik::class) -public class PlatformDesignSystem( - override val colorSet: DefaultColorSet, - override val typographySet: PlatformTypographySet, - override val components: Map, - override var fontFamily: AtomikFontFamily?, -) : DesignSystem(colorSet, typographySet, components, fontFamily) - -@OptIn(ExperimentalAtomik::class) -class DefaultDesignSystem( - override val colorSet: DefaultColorSet, - override val typographySet: DefaultTypographySet, - override val components: Map, - override var fontFamily: AtomikFontFamily?, -) : DesignSystem(colorSet, typographySet, components, fontFamily) -*/ - -/** - * A Custom implementation of a Design System - * - * This inherits the [DesignSystem], and uses Custom implementations of the properties - * This is based on atomic design which is included in the Design System - * - * @property colorSet the custom collection of colors to be used in this Design System - * @property typographySet the custom collection of typohraphies to be used in this Design System - * @property components the atomic components to be used in this Design System - * @property fontFamily the font family passed into the Design System from the Platform level - */ -@OptIn(ExperimentalAtomik::class) -internal class CustomDesignSystem( - override val colorSet: CustomColorSet, - override val typographySet: CustomTypographySet, - override val components: Map, - override var fontFamily: AtomikFontFamily?, -) : DesignSystem(colorSet, typographySet, components, fontFamily) diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/ExperimentalAtomik.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/ExperimentalAtomik.kt deleted file mode 100644 index 784fd8bd..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/ExperimentalAtomik.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.kevinschildhorn.atomik - -@RequiresOptIn(message = "This API Is Experimental") -@Retention(AnnotationRetention.BINARY) -@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) -public annotation class ExperimentalAtomik diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/Atom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/Atom.kt deleted file mode 100644 index 17b517e8..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/Atom.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms - -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomInterface -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomType - -/** - * Represents an Atom from Atomic Design, as a class - * https://atomicdesign.bradfrost.com/ - * - * An abstract class that represents an Atom. While interfaces are used to specify what Atoms conform to, - * the [Atom] class provides the UI details. In Atomic Design, components contain subcomponents - * that are related to the parent component. For example Organisms contain Molecules, which contain Atoms. - * - * @property type the Type of atom being displayed, such as button or text - * @property subComponents the components related to this atom, as mentioned in description - */ -public abstract class Atom { - public abstract val type: AtomType - public open val subComponents: List = emptyList() - - /** - * Checks to see if the Atom has any subcomponents. Returns boolean - */ - public val hasSubComponents: Boolean - get() = subComponents.isNotEmpty() - - /** - * Checks to see if this Atom implements a certain [AtomInterface] and if it does returns the interface - * @return the atom as the interface - */ - @Suppress("UNCHECKED_CAST") - public fun asAtom(): T? = (this as? T) - - /** - * Finds a subComponent matching a specified [AtomInterface] if it exists - * @return the subComponent of a specified interface if it's found - */ - public inline fun subAtom(): T? = subComponents.find { it is T } as? T -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/FigmaAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/FigmaAtom.kt deleted file mode 100644 index 04050e7f..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/FigmaAtom.kt +++ /dev/null @@ -1,115 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms - -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomType -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomikConstraintX -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomikConstraintY -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ConstrainedAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.FixedSizeAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.PaddingAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.typography.base.AtomikFontFamily -import com.kevinschildhorn.atomik.typography.base.AtomikTypography - -/** - * Represents an Atom with all of the properties found in a Figma atom - * - * This atom contains the components that are configurable in a Figma file. These are the base components, - * as in Figma you can create shape and text components. There are child classes for those components. - * - * @property type the Type of atom being displayed, such as button or text - * @property width the width of the UI (in dp / pt) - * @property height the height of the UI (in dp / pt) - * @property constraintX the constraint in the X Axis (horizontal) - * @property constraintY the constraint in the Y Axis (vertical) - */ -public open class FigmaBaseAtom( - override val type: AtomType, - override val width: Int?, - override val height: Int?, - override val constraintX: AtomikConstraintX, - override val constraintY: AtomikConstraintY, -) : Atom(), FixedSizeAtom, ConstrainedAtom - -/** - * Represents an Atom with all of the properties found in a Figma Shape atom - * - * This atom contains the components that are configurable in a Figma file, for a component that has a shape. - * - * @property type the Type of atom being displayed, such as button or text - * @property subComponents the components related to this atom, as mentioned in description - * @property width the width of the UI (in dp / pt) - * @property height the height of the UI (in dp / pt) - * @property constraintX the constraint in the X Axis (horizontal) - * @property constraintY the constraint in the Y Axis (vertical) - * @property color the color of the UI. - * @property padding the horizontal padding of the atom (in dp/pt) - * @property paddingHorizontal the horizontal padding of the atom (in dp/pt) - * @property paddingVertical the vertical padding of the atom (in dp/pt) - * @property paddingLeft the padding on the left of the atom (in dp/pt) - * @property paddingRight the padding on the right of the atom (in dp/pt) - * @property paddingTop the padding on the top of the atom (in dp/pt) - * @property paddingBottom the padding on the bottom of the atom (in dp/pt) - */ -public class FigmaShapeAtom( - override val type: AtomType = AtomType.VIEW, - override val subComponents: List = emptyList(), - override val width: Int? = null, - override val height: Int? = null, - override val constraintX: AtomikConstraintX, - override val constraintY: AtomikConstraintY, - // [ColorAtom] - override val color: AtomikColor, - // [PaddingAtom] - override val padding: Int? = null, - override val paddingHorizontal: Int? = padding, - override val paddingVertical: Int? = padding, - override val paddingLeft: Int? = paddingHorizontal, - override val paddingRight: Int? = paddingHorizontal, - override val paddingTop: Int? = paddingVertical, - override val paddingBottom: Int? = paddingVertical, -) : FigmaBaseAtom(type, width, height, constraintX, constraintY), ColorAtom, PaddingAtom - -/** - * Represents an Atom with all of the properties found in a Figma Text atom - * - * This atom contains the components that are configurable in a Figma file, for a component that has text. - * - * @property type the Type of atom being displayed, such as button or text - * @property subComponents the components related to this atom, as mentioned in description - * @property width the width of the UI (in dp / pt) - * @property height the height of the UI (in dp / pt) - * @property constraintX the constraint in the X Axis (horizontal) - * @property constraintY the constraint in the Y Axis (vertical) - * @property textColor the color of the text - * @property typography the typography associated with the text - * @property fontFamily the fontFamily associated with the text - * @property padding the horizontal padding of the atom (in dp/pt) - * @property paddingHorizontal the horizontal padding of the atom (in dp/pt) - * @property paddingVertical the vertical padding of the atom (in dp/pt) - * @property paddingLeft the padding on the left of the atom (in dp/pt) - * @property paddingRight the padding on the right of the atom (in dp/pt) - * @property paddingTop the padding on the top of the atom (in dp/pt) - * @property paddingBottom the padding on the bottom of the atom (in dp/pt) - */ -public class FigmaTextAtom( - override val type: AtomType = AtomType.TEXT, - override val subComponents: List = emptyList(), - override val width: Int? = null, - override val height: Int? = null, - override val constraintX: AtomikConstraintX, - override val constraintY: AtomikConstraintY, - // TextAtom - override val textColor: AtomikColor, - override val typography: AtomikTypography, - override val fontFamily: AtomikFontFamily? = null, - // PaddingAtom - override val padding: Int? = null, - override val paddingHorizontal: Int? = padding, - override val paddingVertical: Int? = padding, - override val paddingLeft: Int? = paddingHorizontal, - override val paddingRight: Int? = paddingHorizontal, - override val paddingTop: Int? = paddingVertical, - override val paddingBottom: Int? = paddingVertical, -) : FigmaBaseAtom(type, width, height, constraintX, constraintY), TextAtom, PaddingAtom diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/ImageAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/ImageAtom.kt deleted file mode 100644 index f61d8c89..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/ImageAtom.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms - -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomType -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ResourceAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor - -public class ImageAtom( - public val color: AtomikColor, - override val image: T, -) : Atom(), ResourceAtom { - override val type: AtomType = AtomType.IMAGE -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextViewAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextViewAtom.kt deleted file mode 100644 index eb7dde12..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextViewAtom.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms - -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomType -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.PaddingAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.typography.base.AtomikFontFamily -import com.kevinschildhorn.atomik.typography.base.AtomikTypography - -public class TextViewAtom( - override val textColor: AtomikColor, - override val typography: AtomikTypography, - override val fontFamily: AtomikFontFamily? = null, - public val backgroundColor: AtomikColor? = null, - override val paddingHorizontal: Int? = null, - override val paddingVertical: Int? = null, - override val padding: Int? = null, - override val paddingLeft: Int? = null, - override val paddingRight: Int? = null, - override val paddingTop: Int? = null, - override val paddingBottom: Int? = null, -) : Atom(), TextAtom, PaddingAtom { - override val type: AtomType - get() = AtomType.TEXT -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+AtomikColorType.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+AtomikColorType.kt deleted file mode 100644 index beee947a..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+AtomikColorType.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.compose -/* -import androidx.compose.ui.graphics.Color -import com.kevinschildhorn.atomik.color.base.AtomikColorType - -/** - * gets a composable [Color] from the [AtomikColorType] - * - */ -internal val AtomikColorType.composeColor: Color - get() = color.composeColor -*/ diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+ConstrainedAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+ConstrainedAtom.kt deleted file mode 100644 index 60b794cc..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+ConstrainedAtom.kt +++ /dev/null @@ -1,57 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms - -import androidx.compose.ui.Alignment -import androidx.compose.ui.BiasAlignment -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomikConstraintX -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.AtomikConstraintY -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ConstrainedAtom - -/** - * The Vertical compose Alignment, based on the [ConstrainedAtom] - */ -public val ConstrainedAtom.alignmentVertical: Alignment.Vertical - get() = - when (this.constraintY) { - AtomikConstraintY.ALIGN_TOP -> Alignment.Top - AtomikConstraintY.ALIGN_BOTTOM -> Alignment.Bottom - AtomikConstraintY.CENTER -> Alignment.CenterVertically - AtomikConstraintY.SCALE -> Alignment.CenterVertically - } - -/** - * The Horizontal compose Alignment, based on the [ConstrainedAtom] - */ -public val ConstrainedAtom.alignmentHorizontal: Alignment.Horizontal - get() = - when (this.constraintX) { - AtomikConstraintX.ALIGN_LEFT -> Alignment.Start - AtomikConstraintX.ALIGN_RIGHT -> Alignment.End - AtomikConstraintX.CENTER -> Alignment.CenterHorizontally - AtomikConstraintX.SCALE -> Alignment.CenterHorizontally - } - -/** - * The compose Alignment, based on the [ConstrainedAtom]. Combines both vertical and horizontal - */ -public val ConstrainedAtom.alignment: Alignment - get() = BiasAlignment(horizontalBias, verticalBias) - -private val ConstrainedAtom.verticalBias: Float - get() = - when (this.constraintY) { - AtomikConstraintY.ALIGN_TOP -> -1f - AtomikConstraintY.ALIGN_BOTTOM -> 1f - AtomikConstraintY.CENTER -> 0f - AtomikConstraintY.SCALE -> 0f - } - -private val ConstrainedAtom.horizontalBias: Float - get() = - when (this.constraintX) { - AtomikConstraintX.ALIGN_LEFT -> -1f - AtomikConstraintX.ALIGN_RIGHT -> 1f - AtomikConstraintX.CENTER -> 0f - AtomikConstraintX.SCALE -> 0f - } diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+EnablableAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+EnablableAtom.kt deleted file mode 100644 index 3a7e1013..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+EnablableAtom.kt +++ /dev/null @@ -1,13 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.compose - -/* -@Composable -fun EnablableAtom.buttonColors(): ButtonColors = - ButtonDefaults.buttonColors( - backgroundColor = color.color.platformColor, - disabledBackgroundColor = disabledColor?.color?.platformColor ?: color.color.platformColor - ) - - */ diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+FixedSizeAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+FixedSizeAtom.kt deleted file mode 100644 index 1fdf5825..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+FixedSizeAtom.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms -/* -import androidx.compose.foundation.layout.height -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.FixedSizeAtom - -val FixedSizeAtom.heightModifier: Modifier - get() = height?.let { - Modifier.height(it.dp) - } ?: Modifier -*/ diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+RoundedAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+RoundedAtom.kt deleted file mode 100644 index b7cb7ba7..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+RoundedAtom.kt +++ /dev/null @@ -1,11 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms - -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.RoundedAtom - -public val RoundedAtom.shape: Shape - get() = RoundedCornerShape(radius.dp) diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt deleted file mode 100644 index a3b655c4..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/compose/+TextAtom.kt +++ /dev/null @@ -1,43 +0,0 @@ -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.compose - -import androidx.compose.runtime.Composable -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.unit.sp -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.atomik.typography.fontWeight -import dev.icerock.moko.resources.compose.fontFamilyResource - -/** - * Creates a compose [TextStyle] from the [TextAtom] - * - * Uses the default FontFamily from the atom - * @return returns a compose [TextStyle] - */ -public val TextAtom.textStyle: TextStyle - @Composable - get() { - return TextStyle( - fontFamily = fontFamilyResource(this.typography.font), - fontWeight = this.typography.weight.fontWeight, - fontSize = this.typography.size.sp, - color = this.textColor.composeColor, - ) - } - -/** - * Creates a compose [TextStyle] from the [TextAtom] - * - * @param fontFamily the [FontFamily] that can be passed in from the platform code - * @return returns a compose [TextStyle] - */ -public fun TextAtom.textStyle(fontFamily: FontFamily): TextStyle = - TextStyle( - fontFamily = fontFamily, - fontWeight = this.typography.weight.fontWeight, - fontSize = this.typography.size.sp, - color = this.textColor.composeColor, - ) diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomInterface.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomInterface.kt deleted file mode 100644 index 8cce5251..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomInterface.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -/** - * Represents an Atom from Atomic Design, as an interface - * https://atomicdesign.bradfrost.com/ - * - * A common interface that represents an Atom. These interfaces are used to specify what the - * Atoms must contain, and can be used to get specific information about an atom. - * This is the basis of Atomik. Other Atoms inherit from this interface to add UI details to the - * Atom, such as [ColorAtom] or [TextAtom]. Then a UI representation such as a [ButtonAtom] - * implements these interfaces and provides the details to correctly display the UI. - */ -public interface AtomInterface diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomType.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomType.kt deleted file mode 100644 index 31875a41..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/AtomType.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.ExperimentalAtomik - -/** - * The type of UI Element an atom is. - * https://atomicdesign.bradfrost.com/ - * - * This is used to determine what kind of UI to display based on the value - */ -@OptIn(ExperimentalAtomik::class) -public enum class AtomType { - BUTTON, - TEXT, - IMAGE, - TEXTFIELD, - VIEW, -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/BorderedAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/BorderedAtom.kt deleted file mode 100644 index 63ee44cc..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/BorderedAtom.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.ExperimentalAtomik -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.color.base.AtomikColor - -/** - * An atom that contains information about a border UI - * - * @property borderColor the color of the border surrounding the UI - */ -@OptIn(ExperimentalAtomik::class) -internal interface BorderedAtom : AtomInterface { - public val focusedBorderColor: AtomikColor - public val unFocusedBorderColor: AtomikColor -} - -/** - * Convenience function to get the atom as a bordered atom - */ -internal val Atom.borderedAtom: BorderedAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ColorAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ColorAtom.kt deleted file mode 100644 index 1b877fa5..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ColorAtom.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.color.base.AtomikColor - -/** - * An atom that contains information about the color of the UI - * - * @property color the color of the UI. - */ -public interface ColorAtom : AtomInterface { - public val color: AtomikColor -} - -/** - * Convenience function to get the atom as a color atom - */ -internal val Atom.colorAtom: ColorAtom? - get() = this.asAtom() - -/** - * Convenience class to only get the Color Atom - */ -public class SimpleColorAtom(override val color: AtomikColor) : Atom(), ColorAtom { - override val type: AtomType = AtomType.VIEW -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ConstrainedAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ConstrainedAtom.kt deleted file mode 100644 index a1621bc0..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ConstrainedAtom.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom - -/** - * An atom that contains information about the constraints of the UI(i.e. alignment) - * - * @property constraintX the constraint in the X Axis (horizontal) - * @property constraintY the constraint in the Y Axis (vertical) - */ -public interface ConstrainedAtom : AtomInterface { - public val constraintX: AtomikConstraintX - public val constraintY: AtomikConstraintY -} - -/** - * An enum that represents the horizontal constraint of the Atom - */ -public enum class AtomikConstraintX { - CENTER, - ALIGN_LEFT, - ALIGN_RIGHT, - SCALE, -} - -/** - * An enum that represents the vertical constraint of the Atom - */ -public enum class AtomikConstraintY { - CENTER, - ALIGN_TOP, - ALIGN_BOTTOM, - SCALE, -} - -/** - * Convenience function to get the atom as a constrained atom - */ -internal val Atom.constrainedAtom: ConstrainedAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/EnablableAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/EnablableAtom.kt deleted file mode 100644 index e4a38baf..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/EnablableAtom.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.color.base.AtomikColor - -/** - * An atom that can be enabled / disabled. Contains the disabled color of the UI and inherits [ColorAtom] - * - * @property disabledColor the disabled color of the UI. - */ -internal interface EnablableAtom : ColorAtom { - public val disabledColor: AtomikColor? -} - -/** - * Convenience function to get the atom as an enabled atom - */ -internal val Atom.enablableAtom: EnablableAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/FixedSizeAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/FixedSizeAtom.kt deleted file mode 100644 index 08769bbf..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/FixedSizeAtom.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom - -/** - * An atom that has a fixed size, rather than a scalable size, such as a [ConstrainedAtom] - * - * @property width the width of the UI (in dp / pt) - * @property height the height of the UI (in dp / pt) - */ -internal interface FixedSizeAtom : AtomInterface { - public val width: Int? - public val height: Int? -} - -/** - * Convenience function to get the atom as a fixed size atom - */ -internal val Atom.fixedSizeAtom: FixedSizeAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/PaddingAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/PaddingAtom.kt deleted file mode 100644 index 19e6f353..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/PaddingAtom.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom - -/** - * An atom that can has padding surrounding it. - * - * This atom can take either specific padding(i.e. left, right, top, bottom), - * or more generalized padding (vertical, horizontal, overall) - * - * Padding that is not set defaults back to a more generalized padding - * For example: paddingBottom -> paddingVertical -> padding - * - * @property padding the horizontal padding of the atom (in dp/pt) - * @property paddingHorizontal the horizontal padding of the atom (in dp/pt) - * @property paddingVertical the vertical padding of the atom (in dp/pt) - * @property paddingLeft the padding on the left of the atom (in dp/pt) - * @property paddingRight the padding on the right of the atom (in dp/pt) - * @property paddingTop the padding on the top of the atom (in dp/pt) - * @property paddingBottom the padding on the bottom of the atom (in dp/pt) - */ -internal interface PaddingAtom : AtomInterface { - public val padding: Int? - public val paddingHorizontal: Int? - public val paddingVertical: Int? - public val paddingLeft: Int? - public val paddingRight: Int? - public val paddingTop: Int? - public val paddingBottom: Int? -} - -/** - * Convenience function to get the atom as a padding atom - */ -internal val Atom.paddingAtom: PaddingAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ResourceAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ResourceAtom.kt deleted file mode 100644 index 35763550..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/ResourceAtom.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -/** - * An atom that has an image resource associated with it - * - * @property image the image associated with the atom - */ -internal interface ResourceAtom : AtomInterface { - public val image: T -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/RoundedAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/RoundedAtom.kt deleted file mode 100644 index f1eb81f9..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/RoundedAtom.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom - -/** - * An atom that has rounded edges - * - * @property radius the radius of the rounded edges (in dp / pt) - */ -public interface RoundedAtom : AtomInterface { - public val radius: Int -} - -/** - * Convenience function to get the atom as a rounded atom - */ -internal val Atom.roundedAtom: RoundedAtom? - get() = this.asAtom() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/TextAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/TextAtom.kt deleted file mode 100644 index 77d603c1..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/interfaces/TextAtom.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms.interfaces - -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.typography.base.AtomikFontFamily -import com.kevinschildhorn.atomik.typography.base.AtomikTypography - -/** - * An atom that has text - * - * @property textColor the color of the text - * @property typography the typography associated with the text - * @property fontFamily the fontFamily associated with the text - */ -public interface TextAtom : AtomInterface { - public val textColor: AtomikColor - public val typography: AtomikTypography - public val fontFamily: AtomikFontFamily? -} - -/** - * Convenience function to get the atom as a text atom - */ -public val Atom.textAtom: TextAtom? - get() = this.asAtom() - -/** - * Convenience class to only get the Text Atom - */ -public class SimpleTextAtom( - override val textColor: AtomikColor, - override val typography: AtomikTypography, - override val fontFamily: AtomikFontFamily?, -) : Atom(), TextAtom { - override val type: AtomType = AtomType.TEXT -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/BaseMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/BaseMolecule.kt deleted file mode 100644 index e1af1b2c..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/BaseMolecule.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.molecules - -import com.kevinschildhorn.atomik.atomic.atoms.Atom - -/** - * Represents a Molecule from Atomic Design, as an interface - * https://atomicdesign.bradfrost.com/ - * - * An abstract class that represents a molecule. A molecule consists of multiple atoms to create a - * robust UI element. This Base molecule contains an array of atoms used, and can be inherited for - * more specific functionality. - */ -public abstract class BaseMolecule { - public abstract val atoms: List -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt deleted file mode 100644 index e31ae0fe..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt +++ /dev/null @@ -1,86 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.molecules - -import androidx.compose.material.ContentAlpha -import androidx.compose.material.TextFieldColors -import androidx.compose.material.TextFieldDefaults -import androidx.compose.runtime.Composable -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.BorderedAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.RoundedAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.color.base.composeColor - -/** - * A molecule that contains information about a TextField - * - * @property textAtom the [TextAtom] used for the entered Text - * @property hintTextAtom the [TextAtom] used for the hint Text when the field is empty - * @property errorTextAtom the [TextAtom] used for the error Text when the field has an error - * @property disabledColorAtom the [ColorAtom] of the text if the ui is disabled - * @property backgroundColorAtom the [ColorAtom] of the background - * @property cursorColor the [AtomikColor] of the cursor - * @property errorColor the [AtomikColor] of the error, used for all error elements in the View - * @property borderColor the [AtomikColor] of the border - */ -public open class OutlinedTextFieldMolecule( - textAtom: TextAtom, - backgroundColorAtom: ColorAtom, - hintTextAtom: TextAtom? = null, - errorTextAtom: TextAtom? = null, - disabledColorAtom: ColorAtom? = null, - cursorColor: AtomikColor? = null, - errorColor: AtomikColor? = errorTextAtom?.textColor, - override val focusedBorderColor: AtomikColor, - override val unFocusedBorderColor: AtomikColor = focusedBorderColor, - override val radius: Int, -) : TextFieldMolecule( - textAtom, - backgroundColorAtom, - hintTextAtom, - errorTextAtom, - disabledColorAtom, - cursorColor, - errorColor, - ), - BorderedAtom, - RoundedAtom { - @Composable - public override fun colors(): TextFieldColors { - val textColor = textAtom.textColor.composeColor - val backgroundColor = backgroundColorAtom.color.composeColor - val disabledBackgroundColor = backgroundColor.copy(alpha = ContentAlpha.disabled) - val errorTextColor = textAtom.textColor.composeColor - - return TextFieldDefaults.outlinedTextFieldColors( - textColor = textColor, - backgroundColor = backgroundColor, - placeholderColor = - hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( - ContentAlpha.medium, - ), - cursorColor = cursorColor?.composeColor ?: textColor, - focusedBorderColor = focusedBorderColor.composeColor, - unfocusedBorderColor = unFocusedBorderColor.composeColor, - disabledTextColor = - disabledColorAtom?.color?.composeColor - ?: textColor.copy(ContentAlpha.disabled), - disabledBorderColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, - disabledLabelColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, - disabledLeadingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledPlaceholderColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledTrailingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - errorCursorColor = errorColor?.composeColor ?: errorTextColor, - errorBorderColor = errorColor?.composeColor ?: errorTextColor, - errorLabelColor = errorColor?.composeColor ?: errorTextColor, - errorLeadingIconColor = errorColor?.composeColor ?: errorTextColor, - errorTrailingIconColor = errorColor?.composeColor ?: errorTextColor, - ) - } -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextButtonMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextButtonMolecule.kt deleted file mode 100644 index e102eb81..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextButtonMolecule.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.molecules - -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.EnablableAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.RoundedAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor - -public class TextButtonMolecule( - override val color: AtomikColor, - override val disabledColor: AtomikColor, - override val radius: Int, - public val textAtom: TextAtom, -) : BaseMolecule(), EnablableAtom, RoundedAtom { - override val atoms: List = listOf(textAtom as Atom) -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt deleted file mode 100644 index b503224a..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.molecules - -import androidx.compose.material.ContentAlpha -import androidx.compose.material.TextFieldColors -import androidx.compose.material.TextFieldDefaults -import androidx.compose.runtime.Composable -import com.kevinschildhorn.atomik.atomic.atoms.Atom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.TextAtom -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.color.base.composeColor - -/** - * A molecule that contains information about a TextField - * - * @property textAtom the [TextAtom] used for the entered Text - * @property hintTextAtom the [TextAtom] used for the hint Text when the field is empty - * @property errorTextAtom the [TextAtom] used for the error Text when the field has an error - * @property disabledColorAtom the [ColorAtom] of the text if the ui is disabled - * @property backgroundColorAtom the [ColorAtom] of the background - * @property cursorColor the [AtomikColor] of the cursor - * @property errorColor the [AtomikColor] of the error, used for all error elements in the View - */ -public open class TextFieldMolecule( - public val textAtom: TextAtom, - public val backgroundColorAtom: ColorAtom, - public val hintTextAtom: TextAtom? = null, - public val errorTextAtom: TextAtom? = null, - public val disabledColorAtom: ColorAtom? = null, - public val cursorColor: AtomikColor? = null, - public val errorColor: AtomikColor? = errorTextAtom?.textColor, -) : BaseMolecule() { - override val atoms: List - get() = listOf() - - @Composable - public open fun colors(): TextFieldColors { - val textColor = textAtom.textColor.composeColor - val backgroundColor = backgroundColorAtom.color.composeColor - val disabledBackgroundColor = backgroundColor.copy(alpha = ContentAlpha.disabled) - val errorTextColor = textAtom.textColor.composeColor - - return TextFieldDefaults.textFieldColors( - textColor = textColor, - backgroundColor = backgroundColor, - placeholderColor = - hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( - ContentAlpha.medium, - ), - cursorColor = cursorColor?.composeColor ?: textColor, - disabledTextColor = - disabledColorAtom?.color?.composeColor - ?: textColor.copy(ContentAlpha.disabled), - disabledIndicatorColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledLabelColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, - disabledLeadingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledPlaceholderColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledTrailingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - errorCursorColor = errorColor?.composeColor ?: errorTextColor, - errorIndicatorColor = errorColor?.composeColor ?: errorTextColor, - errorLabelColor = errorColor?.composeColor ?: errorTextColor, - errorLeadingIconColor = errorColor?.composeColor ?: errorTextColor, - errorTrailingIconColor = errorColor?.composeColor ?: errorTextColor, - ) - } -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/BaseOrganism.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/BaseOrganism.kt deleted file mode 100644 index 29ea8d08..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/BaseOrganism.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.organisms - -import com.kevinschildhorn.atomik.atomic.molecules.BaseMolecule - -public abstract class BaseOrganism { - public abstract val molecules: List -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/FormOrganism.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/FormOrganism.kt deleted file mode 100644 index 611b7fce..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/organisms/FormOrganism.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.organisms - -import com.kevinschildhorn.atomik.atomic.molecules.BaseMolecule - -public class FormOrganism( - override val molecules: List, -) : BaseOrganism() diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSet.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSet.kt deleted file mode 100644 index 59c71aae..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSet.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.kevinschildhorn.atomik.color - -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.color.base.ColorSet - -/** - * A custom set of colors to be used in the project - * - * Is an implementation of [ColorSet] that contains a map of [AtomikColor]. - * Allows for adding colors with custom ids. - * For now this acts as a wrapper to a collection of colors - * - * @property fallbackColor the color that is passed if the requested color cannot be found - * @property colors a map of colors that are contained in this set - */ -public class CustomColorSet( - override val fallbackColor: AtomikColor, - private val colors: Map, -) : ColorSet { - /** - * Gets the color based on a type. If none is found then the fallback is returned - * @param name The name of color you want to get as a [String] - * @return the [AtomikColor] based on the name passed - */ - override fun getColor(name: String): AtomikColor = colors[name] ?: fallbackColor -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSetTyped.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSetTyped.kt deleted file mode 100644 index 7db78e18..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/CustomColorSetTyped.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.kevinschildhorn.atomik.color - -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.color.base.ColorSet - -/** - * A custom set of colors data to be used in the project - * - * Is an implementation of [ColorSet] that contains a map of [AtomikColor]. - * Allows for adding colors with custom ids, that can be referenced from a custom - * enum that is passed in. For now this acts as a wrapper to a collection of colors - * - * @property fallbackColor the color that is passed if the requested color cannot be found - * @property colors a map of colors that are contained in this set - */ -internal class CustomColorSetTyped>( - override val fallbackColor: AtomikColor, - private val colors: Map, -) : ColorSet { - /** - * Gets the color based on an enum value. If none is found then the fallback is returned - * @param type The enum associated with the typography you want to get as a [AtomikColor] - * @return the [AtomikColor] based on the type passed - */ - public fun getColor(type: E): AtomikColor = colors[type] ?: fallbackColor - - /** - * Gets the color based on a type. If none is found then the fallback is returned - * @param name The name of color you want to get as a [String] - * @return the [AtomikColor] based on the name passed - */ - override fun getColor(name: String): AtomikColor = fallbackColor // TODO -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt deleted file mode 100644 index 4bc1361c..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -import androidx.compose.ui.graphics.Color - -/** - * A common implementation of a Color - * - * This contains platform specific implementations in the actual versions. Can be created from - * either a hex Long or an RGBA value - * - * @property hexString The hex value of the color (#RRGGBBAA) - * @property r The red Value (0-255) - * @property g The red Value (0-255) - * @property b The red Value (0-255) - * @property a The alpha Value (0-1) (Defaults to 1) - */ -@Suppress("SpellCheckingInspection") -public expect class AtomikColor { - public val hexString: String - public val r: Int - public val g: Int - public val b: Int - public val a: Float - - /** - * Constructor with hex variable - * - * @constructor Creates a color based on the hex value(i.e. 0xFFFFFF) - * @param hex - The Hex Value of the color (#RRGGBBAA) - */ - public constructor(hex: Long) - - /** - * Constructor with r, g, b, a - * - * @constructor Creates a color based on the rgb values. Alpha defaults to 1. - * @param r - Red value (0-255) - * @param g - Green Value (0-255) - * @param b - Blue Value (0-255) - * @param a - Alpha value (0-1) (defaults to 1) - */ - public constructor(r: Int, g: Int, b: Int, a: Float? = null) -} - -public val AtomikColor.composeColor: Color - get() = - Color( - red = r.toFloat() / 255, - green = g.toFloat() / 255, - blue = b.toFloat() / 255, - alpha = this.a, - ) diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorData.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorData.kt deleted file mode 100644 index 29da7c78..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorData.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -import kotlin.math.roundToInt - -/** - * A common collection of Color Data - * - * This is used to share logic to create [AtomikColor], while using platform specific - * implementations of [AtomikColor] - * - * @param hexString the hex value of the color as a string, with the alpha at the end (format: #RRGGBBAA) - * @param hexStringAlphaFirst the hex value of the color as a string, with the alpha at the beginning (format: #AARRGGBB) - * @param r The red Value (0-255) - * @param g The red Value (0-255) - * @param b The red Value (0-255) - * @param a The alpha Value (0-1) (Defaults to 1) - */ -@Suppress("SpellCheckingInspection") -internal data class AtomikColorData( - val hexString: String, - val hexStringAlphaFirst: String = hexString, - val r: Int, - val g: Int, - val b: Int, - val a: Float, -) { - /** - * @constructor constructor with hex value - * @param hex hex value - **/ - constructor(hex: Long) : this( - hexString = hex.asHexString, - hexStringAlphaFirst = hex.asHexString, - r = hex.red, - g = hex.green, - b = hex.blue, - a = hex.alpha, - ) - - /** - * @constructor constructor with rgba value - * @param r red value (0-255) - * @param g green value (0-255) - * @param b blue value (0-255) - * @param a alpha value (0-1) (Defaults to 1) - **/ - constructor(r: Int, g: Int, b: Int, a: Float? = null) : this( - hexString = hexFromRGB(r, g, b, a, false), - hexStringAlphaFirst = hexFromRGB(r, g, b, a, true), - r = r, - g = g, - b = b, - a = a ?: 1F, - ) -} - -// Hex String to RGBA - -private val Long.asHexString: String - get() = "#${this.toString(16)}".uppercase() - -private val Long.red: Int - get() = if (this.asHexString.isLongFormHex) (this and 0xFF000000 shr 24).toInt() else (this and 0xFF0000 shr 16).toInt() - -private val Long.green: Int - get() = if (this.asHexString.isLongFormHex) (this and 0xFF0000 shr 16).toInt() else (this and 0xFF00 shr 8).toInt() - -private val Long.blue: Int - get() = if (this.asHexString.isLongFormHex) (this and 0xFF00 shr 8).toInt() else (this and 0xFF).toInt() - -private val Long.alpha: Float - get() = if (this.asHexString.isLongFormHex) ((this and 0xFF).toFloat() / 255).rounded else 1F - -private val String.isLongFormHex: Boolean - get() = this.length == 8 + 1 - -private fun hexFromRGB( - r: Int, - g: Int, - b: Int, - a: Float?, - alphaIsPrefix: Boolean, -): String { - val rgbString = (r.asHexString + g.asHexString + b.asHexString) - return if (alphaIsPrefix) { - "#${a.asAlphaString + rgbString}".uppercase() - } else { - "#${rgbString + a.asAlphaString}".uppercase() - } -} - -// RGBA to String - -private val Float.rounded: Float - get() = (this * 100).toInt() / 100F - -private val Int.asHexString: String - get() = toString(16).padStart(2, '0') - -private val Float?.asAlphaString: String - get() = this?.let { (it * 255).roundToInt().asHexString } ?: "" diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorType.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorType.kt deleted file mode 100644 index 123d94b4..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColorType.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -/** - * A wrapper for an AtomikColor associated with an id. - * - * @property id the id associated with the color - * @property color the color - */ -@Suppress("SpellCheckingInspection") -public interface AtomikColorType { - public val id: String - public val color: AtomikColor -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/ColorSet.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/ColorSet.kt deleted file mode 100644 index 4d7581bc..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/color/base/ColorSet.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -/** - * A set of colors to be used in the project - * - * Is an interface that is used to hold the colors used in the project. - * Implemented in [DefaultColorSet] and [CustomColorSet] - * - * @property[fallbackColor] the color that is passed if the requested color cannot be found - */ -public interface ColorSet { - public val fallbackColor: AtomikColor - - /** - * Gets the color based on a name - * @param name the name of the color - * @return the [AtomikColor] based on the name passed - */ - public fun getColor(name: String): AtomikColor -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt deleted file mode 100644 index 404eaf59..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt +++ /dev/null @@ -1,17 +0,0 @@ - -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.typography - -import androidx.compose.ui.text.font.FontWeight -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyWeight - -/** - * A composable [FontWeight] based on the [AtomikTypographyWeight] - */ -internal val AtomikTypographyWeight.fontWeight: FontWeight - get() = - when (this) { - AtomikTypographyWeight.BOLD -> FontWeight.Bold - else -> FontWeight.Normal - } diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySet.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySet.kt deleted file mode 100644 index 63a7047d..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySet.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.kevinschildhorn.atomik.typography - -import com.kevinschildhorn.atomik.typography.base.AtomikTypography -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyType -import com.kevinschildhorn.atomik.typography.base.TypographySet - -/** - * A custom set of typography data to be used in the project - * - * Is an implementation of [TypographySet] that contains a map of [AtomikTypography]. - * Allows for adding Typographies with custom ids. - * For now this acts as a wrapper to a collection of typographies - * - * @property fallbackTypography the Typography that is passed if the requested typography cannot be found - * @property typographies a map of typographies that are contained in this set - */ -internal class CustomTypographySet( - override val fallbackTypography: AtomikTypography, - private val typographies: Map, -) : TypographySet { - /** - * Gets the typography based on a type. If none is found then the fallback is returned - * @param type The type of typography you want to get as a [AtomikTypographyType] - * @return the [AtomikTypography] based on the type passed - */ - override fun getTypography(type: AtomikTypographyType): AtomikTypography = typographies[type] ?: fallbackTypography -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySetTyped.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySetTyped.kt deleted file mode 100644 index be369a17..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/CustomTypographySetTyped.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.kevinschildhorn.atomik.typography - -import com.kevinschildhorn.atomik.typography.base.AtomikTypography -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyType -import com.kevinschildhorn.atomik.typography.base.TypographySet - -/** - * A custom set of typography data to be used in the project - * - * Is an implementation of [TypographySet] that contains a map of [AtomikTypography]. - * Allows for adding Typographies with custom ids, that can be referenced from a custom - * enum that is passed in. For now this acts as a wrapper to a collection of typographies - * - * @property fallbackTypography the Typography that is passed if the requested typography cannot be found - * @property typographies a map of typographies that are contained in this set - */ -internal class CustomTypographySetTyped>( - override val fallbackTypography: AtomikTypography, - private val typographies: Map, -) : TypographySet { - /** - * Gets the typography based on an enum value. If none is found then the fallback is returned - * @param type The enum associated with the typography you want to get as a [AtomikTypographyType] - * @return the [AtomikTypography] based on the type passed - */ - public fun getTypography(type: E): AtomikTypography = typographies[type] ?: fallbackTypography - - /** - * Gets the typography based on a type. If none is found then the fallback is returned - * @param type The type of typography you want to get as a [AtomikTypographyType] - * @return the [AtomikTypography] based on the type passed - */ - override fun getTypography(type: AtomikTypographyType): AtomikTypography = fallbackTypography -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt deleted file mode 100644 index 13140ecf..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -import androidx.compose.ui.text.font.FontFamily - -/** - * A class containing the Font Family of the Design system - * - * This is either a group of UIFonts in iOS or a FontFamily in compose. It is needed to use - * platform specific font functionality - */ -@Suppress("SpellCheckingInspection") -public expect class AtomikFontFamily { - public val fontFamily: FontFamily -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypography.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypography.kt deleted file mode 100644 index 0b7f2640..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypography.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -import dev.icerock.moko.resources.FontResource - -/** - * A common implementation of a Typography, that contains data for describing a font. - * - * @property weight the weight of the text (ex. bold, thin, normal, etc) - * @property size the size of the text (in dp or pt) - * @property fontName the name of the font used, if not specified it will use the default font - */ -@Suppress("SpellCheckingInspection") -public data class AtomikTypography( - val weight: AtomikTypographyWeight = AtomikTypographyWeight.NORMAL, - val size: Int, - val font: FontResource, -) diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyType.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyType.kt deleted file mode 100644 index 34f821f6..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyType.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -/** - * A wrapper for an AtomikTypography associated with an id. - * - * @property id the id associated with the Typography - * @property typography the typography - */ -@Suppress("SpellCheckingInspection") -public interface AtomikTypographyType { - public val id: String - public val typography: AtomikTypography -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyWeight.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyWeight.kt deleted file mode 100644 index 75f4b72f..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikTypographyWeight.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -/** - * A common implementation of the weight of a text, such as bold or thin. - * Meant to cover the common Weights that would be used in UI Design - */ -@Suppress("SpellCheckingInspection") -public enum class AtomikTypographyWeight { - THIN, - EXTRALIGHT, - LIGHT, - NORMAL, - MEDIUM, - SEMIBOLD, - BOLD, - EXTRABOLD, - BLACK, -} diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/TypographySet.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/TypographySet.kt deleted file mode 100644 index 544e7ab3..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/typography/base/TypographySet.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -/** - * A set of typography data to be used in the project - * - * Is an interface that is used to hold the typographies used in the project. - * Implemented in [CustomTypographySet] - * - * @property[fallbackTypography] the Typography that is passed if the requested color cannot be found - */ -public interface TypographySet { - public val fallbackTypography: AtomikTypography - - /** - * Gets the typography based on a type. If none is found then the fallback is returned - * @param type The type of typography you want to get as a [AtomikTypographyType] - * @return the [AtomikTypography] based on the type passed - */ - public fun getTypography(type: AtomikTypographyType): AtomikTypography -} diff --git a/atomik/src/commonTest/kotlin/com/kevinschildhorn/atomik/AtomikColorTest.kt b/atomik/src/commonTest/kotlin/com/kevinschildhorn/atomik/AtomikColorTest.kt deleted file mode 100644 index 393bb1f9..00000000 --- a/atomik/src/commonTest/kotlin/com/kevinschildhorn/atomik/AtomikColorTest.kt +++ /dev/null @@ -1,103 +0,0 @@ -package com.kevinschildhorn.atomik - -import com.kevinschildhorn.atomik.color.base.AtomikColor -import kotlin.test.Test -import kotlin.test.assertEquals - -class AtomikColorTest { - data class ColorTest( - val hexColor: Long, - val hexColorString: String, - val r: Int, - val g: Int, - val b: Int, - val a: Float = 1F, - ) - - private val colorTestNoAlpha = - ColorTest( - hexColor = 0xa63028, - hexColorString = "#A63028", - r = 166, - g = 48, - b = 40, - ) - - private val colorTestAlpha = - ColorTest( - hexColor = 0xa63028E6, - hexColorString = "#A63028E6", - r = 166, - g = 48, - b = 40, - a = 0.90F, - ) - - private val colorWhite = - ColorTest( - hexColor = 0xffffffff, - hexColorString = "#FFFFFFFF", - r = 255, - g = 255, - b = 255, - a = 1F, - ) - - @Test - fun testColorRGB() { - val color = AtomikColor(colorTestNoAlpha.r, colorTestNoAlpha.g, colorTestNoAlpha.b) - assertEquals(expected = colorTestNoAlpha.a, actual = color.a) - assertEquals(expected = colorTestNoAlpha.r, actual = color.r) - assertEquals(expected = colorTestNoAlpha.g, actual = color.g) - assertEquals(expected = colorTestNoAlpha.b, actual = color.b) - assertEquals(expected = colorTestNoAlpha.hexColorString, actual = color.hexString) - assertAll(colorTestNoAlpha, color) - } - - @Test - fun testColorRGBA() { - val color = - AtomikColor( - colorTestAlpha.r, - colorTestAlpha.g, - colorTestAlpha.b, - colorTestAlpha.a, - ) - assertAll(colorTestAlpha, color) - } - - @Test - fun testColorRGBAFull() { - val color = - AtomikColor( - colorWhite.r, - colorWhite.g, - colorWhite.b, - colorWhite.a, - ) - assertAll(colorWhite, color) - } - - @Test - fun testColorHex() { - val color = AtomikColor(colorTestNoAlpha.hexColor) - assertAll(colorTestNoAlpha, color) - } - - @Test - fun testColorHexWithAlpha() { - val color = AtomikColor(colorTestAlpha.hexColor) - assertAll(colorTestAlpha, color) - } - - private fun assertAll( - ColorTest: ColorTest, - color: AtomikColor, - ) { - assertEquals(expected = ColorTest.a, actual = color.a) - assertEquals(expected = ColorTest.r, actual = color.r) - assertEquals(expected = ColorTest.g, actual = color.g) - assertEquals(expected = ColorTest.b, actual = color.b) - assertEquals(expected = ColorTest.hexColorString, actual = color.hexString) - } -} diff --git a/atomik/src/desktopMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt b/atomik/src/desktopMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt deleted file mode 100644 index 24a0ba52..00000000 --- a/atomik/src/desktopMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt +++ /dev/null @@ -1,55 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -/** - * A common implementation of a Color - * - * This contains platform specific implementations in the actual versions. Can be created from - * either a hex Long or an RGBA value - * - * @property hexString The hex value of the color (#RRGGBBAA) - * @property r The red Value (0-255) - * @property g The red Value (0-255) - * @property b The red Value (0-255) - * @property a The alpha Value (0-1) (Defaults to 1) - */ -@Suppress("SpellCheckingInspection") -public actual class AtomikColor { - public actual val hexString: String - public actual val r: Int - public actual val g: Int - public actual val b: Int - public actual val a: Float - - /** - * Constructor with hex variable - * - * @constructor Creates a color based on the hex value(i.e. 0xFFFFFF) - * @param hex - The Hex Value of the color (#RRGGBBAA) - */ - public actual constructor(hex: Long) { - val data = AtomikColorData(hex) - this.hexString = data.hexString - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } - - /** - * Constructor with r, g, b, a - * - * @constructor Creates a color based on the rgb values. Alpha defaults to 1. - * @param r - Red value (0-255) - * @param g - Green Value (0-255) - * @param b - Blue Value (0-255) - * @param a - Alpha value (0-1) (defaults to 1) - */ - public actual constructor(r: Int, g: Int, b: Int, a: Float?) { - val data = AtomikColorData(r, g, b, a) - this.hexString = data.hexString - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } -} diff --git a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+TextAtom.kt b/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+TextAtom.kt deleted file mode 100644 index df7a07d6..00000000 --- a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+TextAtom.kt +++ /dev/null @@ -1,10 +0,0 @@ - -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms - -/* -val TextAtom.uiFont: UIFont? - get() = fontFamily?.uiFonts?.get(typography.weight) - ?.fontWithSize(typography.size.toDouble()) -*/ diff --git a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt b/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt deleted file mode 100644 index fe822baf..00000000 --- a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/color/base/AtomikColor.kt +++ /dev/null @@ -1,48 +0,0 @@ -package com.kevinschildhorn.atomik.color.base - -import platform.UIKit.UIColor - -@Suppress("SpellCheckingInspection") -/* - * iOS implementation of [AtomikColor] - * - * @property uiColor the AtomikColor as an iOS UIColor [platform.UIKit.UIColor] - * @property hexString The hex value of the color (#RRGGBBAA) - * @property r The red Value (0-255) - * @property g The red Value (0-255) - * @property b The red Value (0-255) - * @property a The alpha Value (0-1) (Defaults to 1) - */ -public actual class AtomikColor { - public actual val hexString: String - public actual val r: Int - public actual val g: Int - public actual val b: Int - public actual val a: Float - - public val uiColor: UIColor - get() = UIColor( - red = r.toDouble() / 255, - green = g.toDouble() / 255, - blue = b.toDouble() / 255, - alpha = a.toDouble(), - ) - - public actual constructor(hex: Long) { - val data = AtomikColorData(hex) - this.hexString = data.hexString - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } - - public actual constructor(r: Int, g: Int, b: Int, a: Float?) { - val data = AtomikColorData(r, g, b, a) - this.hexString = data.hexString - this.r = data.r - this.g = data.g - this.b = data.b - this.a = data.a - } -} diff --git a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt b/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt deleted file mode 100644 index c8c4a00f..00000000 --- a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/+TypographyWeight.kt +++ /dev/null @@ -1,33 +0,0 @@ - -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.typography - -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyWeight -import platform.UIKit.UIFontWeight -import platform.UIKit.UIFontWeightBlack -import platform.UIKit.UIFontWeightBold -import platform.UIKit.UIFontWeightMedium -import platform.UIKit.UIFontWeightRegular -import platform.UIKit.UIFontWeightThin -import platform.UIKit.UIFontWeightUltraLight - -/** - * the UIFontWeight based on the common [AtomikTypographyWeight] - */ -@Suppress("SpellCheckingInspection") -internal val AtomikTypographyWeight.uiFontWeight: UIFontWeight - get() = when (this) { - AtomikTypographyWeight.NORMAL -> UIFontWeightRegular - AtomikTypographyWeight.BOLD -> UIFontWeightBold - AtomikTypographyWeight.BLACK, - AtomikTypographyWeight.EXTRABOLD, - -> UIFontWeightBlack - AtomikTypographyWeight.MEDIUM, - AtomikTypographyWeight.SEMIBOLD, - -> UIFontWeightMedium - AtomikTypographyWeight.THIN, - AtomikTypographyWeight.LIGHT, - -> UIFontWeightThin - AtomikTypographyWeight.EXTRALIGHT -> UIFontWeightUltraLight - } diff --git a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt b/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt deleted file mode 100644 index 56aae883..00000000 --- a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/PlatformTypographySet.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.kevinschildhorn.atomik.typography - -/* -@Suppress("unused", "usedFromiOS") -actual class PlatformTypographySet actual constructor(typographySet: DefaultTypographySet) : - TypographySet { - val largeTitle: AtomikTypography = typographySet.h1 ?: typographySet.fallbackTypography - val title: AtomikTypography = typographySet.h2 ?: typographySet.fallbackTypography - val title2: AtomikTypography = typographySet.h3 ?: typographySet.fallbackTypography - val title3: AtomikTypography = typographySet.h4 ?: typographySet.fallbackTypography - val headline: AtomikTypography = typographySet.h5 ?: typographySet.fallbackTypography - val subheadline: AtomikTypography = typographySet.subtitle ?: typographySet.fallbackTypography - val body: AtomikTypography = typographySet.body - val callout: AtomikTypography = typographySet.button ?: typographySet.fallbackTypography - val caption: AtomikTypography = typographySet.caption ?: typographySet.fallbackTypography - val caption2: AtomikTypography = caption - val footnote: AtomikTypography = typographySet.footnote ?: typographySet.fallbackTypography - - override val fallbackTypography: AtomikTypography - get() = body - - override fun getTypography(type: AtomikTypographyType): AtomikTypography = - when (type) { - AtomikTypographyType.LargeTitle -> largeTitle - AtomikTypographyType.Title -> title - AtomikTypographyType.Title2 -> title2 - AtomikTypographyType.Title3 -> title3 - AtomikTypographyType.Headline -> headline - AtomikTypographyType.Subheadline -> subheadline - AtomikTypographyType.Body -> body - AtomikTypographyType.Callout -> callout - AtomikTypographyType.Caption -> caption - AtomikTypographyType.Caption2 -> caption2 - AtomikTypographyType.Footnote -> footnote - else -> fallbackTypography - } -} -*/ diff --git a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt b/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt deleted file mode 100644 index c7f81e99..00000000 --- a/atomik/src/iosMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -import androidx.compose.ui.text.font.FontFamily -import platform.UIKit.UIFont - -/** - * A class containing the Font Family of the Design system - * - * This contains a map of UIFonts, based on the weight. Used to reference particular font files. - * - * @property uiFonts a map of UIFonts reference by [AtomikTypographyWeight] - */ -@Suppress("SpellCheckingInspection") -public actual class AtomikFontFamily(private val uiFonts: Map) { - public actual val fontFamily: FontFamily = TODO() -} diff --git a/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+Modifier.kt b/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+Modifier.kt deleted file mode 100644 index f3bd164b..00000000 --- a/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/+Modifier.kt +++ /dev/null @@ -1,18 +0,0 @@ - -@file:Suppress("ktlint:standard:filename") - -package com.kevinschildhorn.atomik.atomic.atoms.compose - -import androidx.compose.foundation.background -import androidx.compose.ui.Modifier -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.ColorAtom -import com.kevinschildhorn.atomik.color.base.composeColor - -/** - * Modifier extension to apply a Color Atom to a composable - * @param colorAtom the ColorAtom that you are applying to the composable - * @return returns a modifier - */ -@Suppress("SpellCheckingInspection") -public fun Modifier.atomikColor(colorAtom: ColorAtom): Modifier = - this.background(colorAtom.color.composeColor) diff --git a/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt b/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt deleted file mode 100644 index 70acf2bc..00000000 --- a/atomik/src/jvmMain/kotlin/com/kevinschildhorn/atomik/typography/base/AtomikFontFamily.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.kevinschildhorn.atomik.typography.base - -import androidx.compose.ui.text.font.FontFamily - -/** - * A class containing the Font Family of the Design system - * - * This is either a group of UIFonts in iOS or a FontFamily in compose. It is needed to use - * platform specific font functionality - */ -@Suppress("SpellCheckingInspection") -public actual class AtomikFontFamily { - public actual val fontFamily: FontFamily - get() = TODO("Not yet implemented") -} diff --git a/build.gradle.kts b/build.gradle.kts index 7d0d9df1..fd995e47 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,6 @@ plugins { alias(libs.plugins.compose.compiler).apply(false) alias(libs.plugins.jetbrains.compose).apply(false) alias(libs.plugins.sqldelight).apply(false) - alias(libs.plugins.resources).apply(false) alias(libs.plugins.serialization).apply(false) alias(libs.plugins.kotlinMultiplatform).apply(false) diff --git a/desktopApp/build.gradle.kts b/desktopApp/build.gradle.kts index 40940c87..4da8219e 100644 --- a/desktopApp/build.gradle.kts +++ b/desktopApp/build.gradle.kts @@ -1,7 +1,9 @@ +import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") alias(libs.plugins.compose.compiler) + alias(libs.plugins.jetbrains.compose) } kotlin { @@ -9,7 +11,7 @@ kotlin { sourceSets { val jvmMain by getting { dependencies { - //implementation(compose.desktop.currentOs) + implementation(compose.desktop.currentOs) implementation(libs.koin.core) implementation(libs.kermit) implementation(libs.multiplatform.settings) @@ -19,7 +21,7 @@ kotlin { } } } -/* + compose.desktop { application { mainClass = "MainKt" @@ -30,4 +32,4 @@ compose.desktop { packageVersion = "1.0.0" } } -}*/ +} diff --git a/desktopApp/src/jvmMain/kotlin/Main.kt b/desktopApp/src/jvmMain/kotlin/Main.kt index 61aff3c3..44a8bfbf 100644 --- a/desktopApp/src/jvmMain/kotlin/Main.kt +++ b/desktopApp/src/jvmMain/kotlin/Main.kt @@ -1,5 +1,6 @@ import androidx.compose.ui.window.Window import androidx.compose.ui.window.application +import co.touchlab.kermit.Logger import com.kevinschildhorn.fotopresenter.UseCaseFactory import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel @@ -9,12 +10,12 @@ import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel object KoinPurse { val loginViewModel = - LoginViewModel(UseCaseFactory.baseLogger, UseCaseFactory.credentialsRepository) + LoginViewModel(Logger.withTag("LoginViewModel"), UseCaseFactory.credentialsRepository) val directoryViewModel = - DirectoryViewModel(UseCaseFactory.playlistRepository, UseCaseFactory.baseLogger) - val slideshowViewModel = SlideshowViewModel(UseCaseFactory.baseLogger) + DirectoryViewModel(UseCaseFactory.playlistRepository, Logger.withTag("DirectoryViewModel")) + val slideshowViewModel = SlideshowViewModel(Logger.withTag("SlideshowViewModel")) val playlistViewModel = - PlaylistViewModel(UseCaseFactory.playlistRepository, UseCaseFactory.baseLogger) + PlaylistViewModel(UseCaseFactory.playlistRepository, Logger.withTag("PlaylistViewModel")) } fun main() = application { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 57a818b8..a7874c79 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,7 +31,7 @@ sqlite-driver = "2.0.1" turbine = "1.0.0" ## SDK Versions -minSdk = "23" +minSdk = "26" targetSdk = "34" compileSdk = "34" java = "21" @@ -57,8 +57,6 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa ktlint = { module = "com.twitter.compose.rules:ktlint", version.ref = "ktlint" } multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatform-settings" } multiplatform-settings-test = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatform-settings-test" } -moko-resource = { module = "dev.icerock.moko:resources", version.ref = "resources-version" } -moko-resource-compose = { module = "dev.icerock.moko:resources-compose", version.ref = "resources-version" } security-crypto = { module = "androidx.security:security-crypto", version.ref = "security-crypto" } smbj = { module = "com.hierynomus:smbj", version.ref = "smbj" } sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlite-driver" } @@ -75,8 +73,4 @@ google-services = { id = "com.google.gms.google-services", version.ref = "google crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-plugin" } sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } -resources = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "resources"} -serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } - -[bundles] -moko-resources = ["moko-resource", "moko-resource-compose"] \ No newline at end of file +serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 8f47dbe6..92c48c3c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -19,4 +19,3 @@ rootProject.name = "FotoPresenter" include(":androidApp") include(":shared") include(":desktopApp") -include(":atomik") \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 90c337ce..dd964183 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -2,7 +2,6 @@ import org.gradle.kotlin.dsl.get import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi -import kotlin.collections.plusAssign plugins { alias(libs.plugins.kotlinMultiplatform) @@ -12,7 +11,6 @@ plugins { alias(libs.plugins.ktlint) alias(libs.plugins.sqldelight) //alias(libs.plugins.crashlytics) - alias(libs.plugins.resources) alias(libs.plugins.serialization) } @@ -39,7 +37,6 @@ kotlin { val commonMain by getting { dependencies { implementation(kotlin("stdlib-common")) - implementation(project(":atomik")) implementation(compose.runtime) implementation(compose.foundation) implementation(compose.material) @@ -55,7 +52,6 @@ kotlin { implementation(libs.multiplatform.settings) implementation(libs.kotlinx.datetime) implementation(libs.kim) - api(libs.bundles.moko.resources) } } val commonTest by getting { @@ -129,18 +125,14 @@ android { minSdk = libs.versions.minSdk.get().toInt() } compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } kotlin { jvmToolchain(libs.versions.java.get().toInt()) } } -multiplatformResources { - multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required -} - dependencies { ktlintRuleset(libs.ktlint) } diff --git a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageConverter.kt b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageConverter.kt index 275475aa..11070236 100644 --- a/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageConverter.kt +++ b/shared/src/androidMain/kotlin/com/kevinschildhorn/fotopresenter/ui/shared/SharedImageConverter.kt @@ -26,7 +26,7 @@ actual object SharedImageConverter { val stream = ByteArrayOutputStream() this.compress(Bitmap.CompressFormat.PNG, 100, stream) val byteArray = stream.toByteArray() - if (this != null && !this.isRecycled()) { + if (!this.isRecycled) { this.recycle(); } return byteArray diff --git a/shared/src/commonMain/resources/MR/fonts/Quicksand-Bold.ttf b/shared/src/commonMain/composeResources/font/quicksand_bold.ttf similarity index 100% rename from shared/src/commonMain/resources/MR/fonts/Quicksand-Bold.ttf rename to shared/src/commonMain/composeResources/font/quicksand_bold.ttf diff --git a/shared/src/commonMain/resources/MR/fonts/Quicksand-Light.ttf b/shared/src/commonMain/composeResources/font/quicksand_light.ttf similarity index 100% rename from shared/src/commonMain/resources/MR/fonts/Quicksand-Light.ttf rename to shared/src/commonMain/composeResources/font/quicksand_light.ttf diff --git a/shared/src/commonMain/resources/MR/fonts/Quicksand-Medium.ttf b/shared/src/commonMain/composeResources/font/quicksand_medium.ttf similarity index 100% rename from shared/src/commonMain/resources/MR/fonts/Quicksand-Medium.ttf rename to shared/src/commonMain/composeResources/font/quicksand_medium.ttf diff --git a/shared/src/commonMain/resources/MR/fonts/Quicksand-Regular.ttf b/shared/src/commonMain/composeResources/font/quicksand_regular.ttf similarity index 100% rename from shared/src/commonMain/resources/MR/fonts/Quicksand-Regular.ttf rename to shared/src/commonMain/composeResources/font/quicksand_regular.ttf diff --git a/shared/src/commonMain/resources/MR/fonts/Quicksand-Semibold.ttf b/shared/src/commonMain/composeResources/font/quicksand_semibold.ttf similarity index 100% rename from shared/src/commonMain/resources/MR/fonts/Quicksand-Semibold.ttf rename to shared/src/commonMain/composeResources/font/quicksand_semibold.ttf diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoColors.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoColors.kt index 06208c03..14f3c527 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoColors.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoColors.kt @@ -1,19 +1,33 @@ package com.kevinschildhorn.fotopresenter.ui.atoms -import com.kevinschildhorn.atomik.color.base.AtomikColor +import androidx.compose.foundation.shape.CornerBasedShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Colors +import androidx.compose.material.Shapes +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp -object FotoColors { - val primary = AtomikColor(0xFFA500) - val background = AtomikColor(0xFFFFFF) - val surface = AtomikColor(0xFFFFFF) - val error = AtomikColor(0xFF0000) - val primaryText = AtomikColor(0x402900) - val secondary = AtomikColor(0xFFD383) - val secondaryText = AtomikColor(0xC1872E) - val backgroundText = AtomikColor(0x25231F) - val surfaceText = AtomikColor(0xC2882E) - val errorText = AtomikColor(0x9E1F1F) - val disabled = AtomikColor(0xE0E0E0) +val fotoColors = Colors( + primary = Color(0xFFFFA500), + primaryVariant = Color(0xFFFFA500), + secondary = Color(0xFFFFD383), + secondaryVariant = Color(0xFFFFD383), + background = Color(0xFFFFFFFF), + surface = Color(0xFFFFFFFF), + error = Color(0xFFFF0000), + onPrimary = Color(0xFF402900), + onSecondary = Color(0xFFC1872E), + onBackground = Color(0xFF25231F), + onSurface = Color(0xFFC2882E), + onError = Color(0xFF9E1F1F), + isLight = true +) - val shadow = AtomikColor(r = 0, g = 0, b = 0, a = 0.25f) -} +val disabled = Color(0xE0E0E0) +val shadow = Color(red = 0f, green = 0f, blue = 0f, alpha = 0.25f) + +val fotoShapes = Shapes( + small = RoundedCornerShape(5.dp), + medium = RoundedCornerShape(10.dp), + large = RoundedCornerShape(20.dp), +) \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoTypography.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoTypography.kt index 796af466..05aeca68 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoTypography.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/FotoTypography.kt @@ -1,28 +1,43 @@ package com.kevinschildhorn.fotopresenter.ui.atoms -import com.kevinschildhorn.atomik.typography.base.AtomikTypography -import com.kevinschildhorn.atomik.typography.base.AtomikTypographyWeight -import com.kevinschildhorn.fotopresenter.MR -import dev.icerock.moko.resources.FontResource +import androidx.compose.material.Typography +import androidx.compose.runtime.Composable +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp +import fotopresenter.shared.generated.resources.Res +import fotopresenter.shared.generated.resources.quicksand_bold +import fotopresenter.shared.generated.resources.quicksand_light +import fotopresenter.shared.generated.resources.quicksand_medium +import fotopresenter.shared.generated.resources.quicksand_regular +import fotopresenter.shared.generated.resources.quicksand_semibold +import org.jetbrains.compose.resources.ExperimentalResourceApi +import org.jetbrains.compose.resources.Font -private val fontregularMoko: FontResource = MR.fonts.Quicksand.regular -private val fontBoldMoko: FontResource = MR.fonts.Quicksand.bold +@OptIn(ExperimentalResourceApi::class) +@Composable +fun QuicksandFontFamily() = FontFamily( + Font(Res.font.quicksand_light, weight = FontWeight.Light), + Font(Res.font.quicksand_regular, weight = FontWeight.Normal), + Font(Res.font.quicksand_medium, weight = FontWeight.Medium), + Font(Res.font.quicksand_semibold, weight = FontWeight.SemiBold), + Font(Res.font.quicksand_bold, weight = FontWeight.Bold) +) -object FotoTypography { - val h1 = - AtomikTypography(size = 96, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val h2 = - AtomikTypography(size = 48, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val h3 = - AtomikTypography(size = 36, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val h4 = - AtomikTypography(size = 24, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val subtitle = - AtomikTypography(size = 16, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val button = - AtomikTypography(size = 14, weight = AtomikTypographyWeight.BOLD, font = fontBoldMoko) - val body = - AtomikTypography(size = 16, weight = AtomikTypographyWeight.NORMAL, font = fontregularMoko) - val caption = - AtomikTypography(size = 14, weight = AtomikTypographyWeight.BOLD, font = fontBoldMoko) -} +@Composable +fun FotoTypography() = Typography().run { + val fontFamily = QuicksandFontFamily() + this.copy( + h1 = TextStyle(fontSize = 96.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + h2 = TextStyle(fontSize = 48.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + h3 = TextStyle(fontSize = 36.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + h4 = TextStyle(fontSize = 24.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + subtitle1 = TextStyle(fontSize = 16.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + subtitle2 = TextStyle(fontSize = 16.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + button = TextStyle(fontSize = 14.sp, fontWeight = FontWeight.Bold, fontFamily = fontFamily), + body1 = TextStyle(fontSize = 16.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + body2 = TextStyle(fontSize = 16.sp, fontWeight = FontWeight.Normal, fontFamily = fontFamily), + caption = TextStyle(fontSize = 14.sp, fontWeight = FontWeight.Bold, fontFamily = fontFamily), + ) +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/.DS_Store b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..29af7cd6a9166458e14faccf5f6d34befe2d4aae GIT binary patch literal 6148 zcmeHK-AcnS6h3j&wG5#b3W7HQZzry@;l!I#=LVd=H<; zbCPU0+_i|D1Ic%Ce$wQFCOH5g!b$7{cmUvFBNU{p5i+lJZP;Lehz;j>gaQ)0*iR}R!3B{G9prF3;2*3fIBYWCu{E~Ex3oMof UX%@2UbVPm#XhOJS27ZBoFVl!e5C8xG literal 0 HcmV?d00001 diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/.DS_Store b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cd92b95a296448cd1da410e65b6f69c7a2454935 GIT binary patch literal 6148 zcmeHKQA@)x5WZ~Fbqt{o3gT11*NK~sq4-kf`~z0>L1ngfV6kh)y3vO*=nv38H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Unit, content: @Composable RowScope.() -> Unit, ) { - val molecule = LoginScreenAtoms.primaryButton Button( onClick = onClick, modifier = modifier.height(44.dp), enabled = buttonState.enabled, colors = ButtonDefaults.buttonColors( - backgroundColor = molecule.color.composeColor, - disabledBackgroundColor = molecule.disabledColor.composeColor, + backgroundColor = fotoColors.primary, + disabledBackgroundColor = disabled, ), ) { if (buttonState.loading) { CircularProgressIndicator( modifier = Modifier.width(30.dp), - color = molecule.textAtom.textColor.composeColor, + color = fotoColors.onPrimary, ) } else { content() diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt index ec1bc121..7c236463 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/PrimaryTextButton.kt @@ -4,8 +4,8 @@ package com.kevinschildhorn.fotopresenter.ui.screens.common.composables import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors @Composable fun PrimaryTextButton( @@ -14,12 +14,12 @@ fun PrimaryTextButton( buttonState: ButtonState = ButtonState.ENABLED, onClick: () -> Unit, ) { - val molecule = LoginScreenAtoms.primaryButton PrimaryButton(modifier = modifier, buttonState = buttonState, onClick = onClick) { Text( title, - style = molecule.textAtom.textStyle, + style = FotoTypography().button, + color = fotoColors.onPrimary, ) } } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt index c414599a..fa2463b2 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/TitleView.kt @@ -2,14 +2,11 @@ package com.kevinschildhorn.fotopresenter.ui.screens.common.composables import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography -import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms.title @Composable fun TitleView( value: String, modifier: Modifier = Modifier, ) { - val atom = title(typography = FotoTypography.h3) - AtomikText(value, atom, modifier) + DialogButtonText(value, modifier) } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt index 547b7fba..b47fe337 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/common/composables/ToastOverlay.kt @@ -21,11 +21,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors import com.kevinschildhorn.fotopresenter.ui.atoms.Padding -import com.kevinschildhorn.fotopresenter.ui.screens.common.CommonAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import kotlinx.coroutines.delay @Composable @@ -60,17 +57,15 @@ fun ToastOverlay( Box( modifier = Modifier .clip(RoundedCornerShape(25.dp)) - .background(FotoColors.secondary.composeColor), + .background(fotoColors.secondary), ) { - Text( + ToastMessage( text, modifier = Modifier .padding( horizontal = Padding.STANDARD.dp, vertical = Padding.MEDIUM.dp ), - color = CommonAtoms.toastOverlay.textColor.composeColor, - style = CommonAtoms.toastOverlay.textStyle, ) } Spacer(Modifier.height(25.dp)) diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/.DS_Store b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 - get() = listOf(imageAtom, textAtom) - } -} diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt index 0345e49d..ab3ee5a1 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/DirectoryScreen.kt @@ -20,12 +20,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.data.ImageSlideshowDetails import com.kevinschildhorn.fotopresenter.ui.UiState -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors +import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography import com.kevinschildhorn.fotopresenter.ui.atoms.Padding +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import com.kevinschildhorn.fotopresenter.ui.screens.common.ActionSheetAction import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.ActionSheet import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.ConfirmationDialog @@ -33,7 +32,6 @@ import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.ErrorView import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.FilterDialog import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.ImagePreviewOverlay import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.LoadingOverlay -import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms.ImageTicker import com.kevinschildhorn.fotopresenter.ui.screens.directory.composables.grid.DirectoryGrid import com.kevinschildhorn.fotopresenter.ui.screens.directory.composables.navbar.DirectoryNavigationBar import com.kevinschildhorn.fotopresenter.ui.screens.directory.composables.navrail.DirectoryTitleBarButton @@ -111,8 +109,8 @@ fun DirectoryScreen( uiState.imageCountString, modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center, - style = ImageTicker.textStyle, - color = ImageTicker.textColor.composeColor + style = FotoTypography().caption, + color = fotoColors.onBackground, ) LinearProgressIndicator( progress = uiState.currentImageCount.toFloat() / uiState.totalImageCount.toFloat(), @@ -120,7 +118,7 @@ fun DirectoryScreen( .height(25.dp) .padding(horizontal = Padding.EXTRA_LARGE.dp, vertical = Padding.SMALL.dp) .clip(RoundedCornerShape(5.dp)), - color = FotoColors.primary.composeColor, + color = fotoColors.primary, ) } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt index eda2ef93..8ff22b6f 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/DirectoryGridCell.kt @@ -13,15 +13,13 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors -import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors @Composable fun DirectoryGridCell( modifier: Modifier = Modifier, - backgroundColor: Color = FotoColors.surface.composeColor, + backgroundColor: Color = fotoColors.surface, content: @Composable BoxScope.() -> Unit, ) { Box( @@ -39,10 +37,10 @@ fun DirectoryGridCellText( text: String, modifier: Modifier = Modifier, ) { - val molecule: DirectoryAtoms.EmptyPhotoMolecule = DirectoryAtoms.emptyDirectory Text( text = text, - style = molecule.textAtom.textStyle, + style = FotoTypography().button, + color = fotoColors.onSurface, textAlign = TextAlign.Center, modifier = modifier diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/FolderDirectoryGridCell.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/FolderDirectoryGridCell.kt index bec09c2f..e244af3e 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/FolderDirectoryGridCell.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/FolderDirectoryGridCell.kt @@ -6,21 +6,23 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material.Icon +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Edit import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import com.kevinschildhorn.fotopresenter.ui.screens.directory.FolderDirectoryGridCellState +import compose.icons.EvaIcons +import compose.icons.evaicons.Fill +import compose.icons.evaicons.fill.Folder @Composable fun FolderDirectoryGridCell( folderState: FolderDirectoryGridCellState, modifier: Modifier = Modifier, ) { - val molecule: DirectoryAtoms.EmptyPhotoMolecule = DirectoryAtoms.emptyDirectory - DirectoryGridCell(modifier) { Column( modifier = @@ -29,13 +31,13 @@ fun FolderDirectoryGridCell( .padding(5.dp), ) { Icon( - imageVector = molecule.imageAtom.image, + imageVector = EvaIcons.Fill.Folder, contentDescription = "Folder", modifier = Modifier .fillMaxWidth() .fillMaxHeight(0.66f), - tint = molecule.imageAtom.color.composeColor, + tint = fotoColors.onSurface, ) DirectoryGridCellText( folderState.name, diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/ImageDirectoryGridCell.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/ImageDirectoryGridCell.kt index 989aaa0a..5b1fc4f2 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/ImageDirectoryGridCell.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/grid/ImageDirectoryGridCell.kt @@ -12,8 +12,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import com.kevinschildhorn.fotopresenter.ui.screens.directory.ImageDirectoryGridCellState import compose.icons.EvaIcons import compose.icons.evaicons.Fill @@ -30,7 +29,7 @@ fun ImageDirectoryGridCell( bitmap = it, contentDescription = imageContent.name, contentScale = ContentScale.Crop, - modifier = Modifier.fillMaxSize().background(FotoColors.surface.composeColor), + modifier = Modifier.fillMaxSize().background(fotoColors.surface), ) }.onError { Column( @@ -52,7 +51,7 @@ fun ImageDirectoryGridCell( }.onLoading { CircularProgressIndicator( modifier = Modifier.width(33.dp).align(Alignment.Center), - color = FotoColors.primary.composeColor, + color = fotoColors.primary, ) } } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationBar.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationBar.kt index f412e9d0..c76e4190 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationBar.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationBar.kt @@ -10,8 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import compose.icons.EvaIcons import compose.icons.evaicons.Fill import compose.icons.evaicons.fill.ChevronRight @@ -34,7 +33,7 @@ fun DirectoryNavigationBar( itemsIndexed(directories){ index, item -> Icon( EvaIcons.Fill.ChevronRight, - tint = FotoColors.secondaryText.composeColor, + tint = fotoColors.onSecondary, contentDescription = null, modifier = Modifier.height(44.dp) ) diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationHome.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationHome.kt index 0b0b0d5c..ce1f514e 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationHome.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationHome.kt @@ -6,33 +6,31 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Button import androidx.compose.material.ButtonDefaults +import androidx.compose.material.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText -import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.disabled +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import compose.icons.EvaIcons import compose.icons.evaicons.Fill import compose.icons.evaicons.fill.Home @Composable fun DirectoryNavigationHome(onClick: () -> Unit) { - val molecule = DirectoryAtoms.navigationItem Button( onClick = onClick, - modifier = Modifier.height(44.dp).width(44.dp).clip(RoundedCornerShape(molecule.radius.dp)), + modifier = Modifier.height(44.dp).width(44.dp).clip(RoundedCornerShape(10.dp)), colors = ButtonDefaults.buttonColors( - backgroundColor = molecule.color.composeColor, - disabledBackgroundColor = molecule.disabledColor.composeColor, + backgroundColor = fotoColors.secondary, + disabledBackgroundColor = disabled, ), ) { - AtomikIcon( - EvaIcons.Fill.Home, - atom = molecule.textAtom, + Icon( + imageVector = EvaIcons.Fill.Home, + tint = fotoColors.onSecondary, contentDescription = "Home", modifier = Modifier.size(44.dp) ) diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationItem.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationItem.kt index 4da17099..f60bb366 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationItem.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navbar/DirectoryNavigationItem.kt @@ -1,8 +1,6 @@ package com.kevinschildhorn.fotopresenter.ui.screens.directory.composables.navbar -import androidx.compose.foundation.background import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Button import androidx.compose.material.ButtonDefaults @@ -10,25 +8,20 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText -import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors +import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.DialogButtonText @Composable fun DirectoryNavigationItem(title: String, onClick: () -> Unit) { - val molecule = DirectoryAtoms.navigationItem Button( onClick = onClick, - modifier = Modifier.height(44.dp).clip(RoundedCornerShape(molecule.radius.dp)), + modifier = Modifier.height(44.dp).clip(RoundedCornerShape(10.dp)), colors = ButtonDefaults.buttonColors( - backgroundColor = molecule.color.composeColor, - disabledBackgroundColor = molecule.disabledColor.composeColor, + backgroundColor = fotoColors.secondary, + disabledBackgroundColor = fotoColors.onSecondary, ), ) { - AtomikText( - title, - atom = molecule.textAtom, - ) + DialogButtonText(title) } } \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/DirectoryTitleBarButton.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/DirectoryTitleBarButton.kt index 52fa5eef..42400840 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/DirectoryTitleBarButton.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/DirectoryTitleBarButton.kt @@ -4,11 +4,10 @@ import androidx.compose.material.Icon import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors import androidx.compose.ui.Modifier import androidx.compose.foundation.layout.size import androidx.compose.ui.graphics.vector.ImageVector +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors @Composable fun DirectoryTitleBarButton( @@ -22,7 +21,7 @@ fun DirectoryTitleBarButton( Icon( imageVector, contentDescription = "Menu", - tint = FotoColors.backgroundText.composeColor + tint = fotoColors.onBackground ) } } \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/NavigationRailOverlay.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/NavigationRailOverlay.kt index 9ed096fc..698d2fd0 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/NavigationRailOverlay.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/directory/composables/navrail/NavigationRailOverlay.kt @@ -8,8 +8,7 @@ import androidx.compose.material.NavigationRail import androidx.compose.material.NavigationRailItem import androidx.compose.material.Text import androidx.compose.runtime.Composable -import com.kevinschildhorn.atomik.color.base.composeColor -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.Overlay import compose.icons.EvaIcons import compose.icons.evaicons.Fill @@ -33,17 +32,17 @@ fun NavigationRailOverlay( ) { Row { NavigationRail( - backgroundColor = FotoColors.surface.composeColor + backgroundColor = fotoColors.surface ) { NavigationRailItem( label = { - Text("Playlists", color = FotoColors.surfaceText.composeColor) + Text("Playlists", color = fotoColors.onSurface) }, icon = { Icon( EvaIcons.Outline.Monitor, contentDescription = "Playlists", - tint = FotoColors.surfaceText.composeColor + tint = fotoColors.onSurface ) }, selected = true, @@ -51,13 +50,13 @@ fun NavigationRailOverlay( ) NavigationRailItem( label = { - Text("Logout", color = FotoColors.surfaceText.composeColor) + Text("Logout", color = fotoColors.onSurface) }, icon = { Icon( EvaIcons.Fill.LogOut, contentDescription = "Logout", - tint = FotoColors.surfaceText.composeColor + tint = fotoColors.onSurface ) }, selected = true, diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/LoginScreenAtoms.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/LoginScreenAtoms.kt deleted file mode 100644 index a3dc66da..00000000 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/LoginScreenAtoms.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.kevinschildhorn.fotopresenter.ui.screens.login - -import com.kevinschildhorn.atomik.atomic.atoms.TextViewAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.SimpleColorAtom -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.SimpleTextAtom -import com.kevinschildhorn.atomik.atomic.molecules.OutlinedTextFieldMolecule -import com.kevinschildhorn.atomik.atomic.molecules.TextButtonMolecule -import com.kevinschildhorn.atomik.color.base.AtomikColor -import com.kevinschildhorn.atomik.typography.base.AtomikTypography -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography -import com.kevinschildhorn.fotopresenter.ui.atoms.Padding - -object LoginScreenAtoms { - fun title( - textColor: AtomikColor = FotoColors.backgroundText, - typography: AtomikTypography = FotoTypography.h1, - ) = SimpleTextAtom( - textColor = textColor, - typography = typography, - fontFamily = null, - ) - - val errorView = - TextViewAtom( - textColor = FotoColors.errorText, - typography = FotoTypography.body, - backgroundColor = FotoColors.error, - paddingHorizontal = Padding.MEDIUM.rawValue, - paddingVertical = Padding.MEDIUM.rawValue, - ) - - val primaryButton = - TextButtonMolecule( - color = FotoColors.primary, - disabledColor = FotoColors.disabled, - radius = 15, - textAtom = - SimpleTextAtom( - textColor = FotoColors.primaryText, - typography = FotoTypography.button, - fontFamily = null, - ), - ) - val textFieldMolecule = - OutlinedTextFieldMolecule( - textAtom = textAtom(FotoColors.primaryText), - backgroundColorAtom = SimpleColorAtom(FotoColors.surface), - hintTextAtom = textAtom(FotoColors.surfaceText), - errorTextAtom = textAtom(FotoColors.errorText), - disabledColorAtom = SimpleColorAtom(FotoColors.surface), - focusedBorderColor = FotoColors.backgroundText, - radius = 5, - ) - - private fun textAtom(color: AtomikColor) = - SimpleTextAtom( - textColor = color, - typography = FotoTypography.subtitle, - fontFamily = null, - ) -} diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt index e9475a2d..c52f5383 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginPasswordTextField.kt @@ -3,8 +3,6 @@ package com.kevinschildhorn.fotopresenter.ui.screens.login.composables import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Icon import androidx.compose.material.IconButton -import androidx.compose.material.OutlinedTextField -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -14,9 +12,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation -import com.kevinschildhorn.atomik.atomic.atoms.shape -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms import compose.icons.EvaIcons import compose.icons.evaicons.Fill import compose.icons.evaicons.fill.Eye @@ -29,22 +24,13 @@ fun LoginPasswordTextField( placeholder: String, modifier: Modifier = Modifier, ) { - val molecule = LoginScreenAtoms.textFieldMolecule var passwordVisible by rememberSaveable { mutableStateOf(false) } - OutlinedTextField( + LoginTextField( value = value, onValueChange = onValueChange, + placeholder = placeholder, visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(), - placeholder = { - Text( - placeholder, - style = molecule.hintTextAtom?.textStyle ?: molecule.textAtom.textStyle, - ) - }, - colors = molecule.colors(), - shape = molecule.shape, - textStyle = molecule.textAtom.textStyle, modifier = modifier, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), trailingIcon = { diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt index 23d4412f..ef4e703f 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/login/composables/LoginTextField.kt @@ -1,12 +1,17 @@ package com.kevinschildhorn.fotopresenter.ui.screens.login.composables +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.text.KeyboardOptions.Companion import androidx.compose.material.OutlinedTextField import androidx.compose.material.Text +import androidx.compose.material.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import com.kevinschildhorn.atomik.atomic.atoms.shape -import com.kevinschildhorn.atomik.atomic.atoms.compose.textStyle -import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreenAtoms +import androidx.compose.ui.text.input.VisualTransformation +import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography +import com.kevinschildhorn.fotopresenter.ui.atoms.disabled +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoShapes @Composable fun LoginTextField( @@ -14,20 +19,29 @@ fun LoginTextField( onValueChange: (String) -> Unit, placeholder: String, modifier: Modifier = Modifier, + visualTransformation: VisualTransformation = VisualTransformation.None, + keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + trailingIcon: @Composable (() -> Unit)? = null, ) { - val molecule = LoginScreenAtoms.textFieldMolecule OutlinedTextField( value = value, onValueChange = onValueChange, + visualTransformation = visualTransformation, placeholder = { Text( placeholder, - style = molecule.hintTextAtom?.textStyle ?: molecule.textAtom.textStyle, + color = fotoColors.onSurface, + style = FotoTypography().subtitle1, ) }, - colors = molecule.colors(), - shape = molecule.shape, - textStyle = molecule.textAtom.textStyle, + colors = TextFieldDefaults.outlinedTextFieldColors( + textColor = fotoColors.onPrimary, + disabledTextColor = disabled, + ), + shape = fotoShapes.small, + textStyle = FotoTypography().subtitle1, + keyboardOptions = keyboardOptions, + trailingIcon = trailingIcon, modifier = modifier, ) } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/PlaylistScreenAtoms.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/PlaylistScreenAtoms.kt deleted file mode 100644 index b09a80e5..00000000 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/PlaylistScreenAtoms.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.kevinschildhorn.fotopresenter.ui.screens.playlist - -import com.kevinschildhorn.atomik.atomic.atoms.interfaces.SimpleTextAtom -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoTypography - -object PlaylistScreenAtoms { - - val title:SimpleTextAtom = SimpleTextAtom( - textColor = FotoColors.secondaryText, - typography = FotoTypography.h4, - fontFamily = null, - ) - - val rowTitle:SimpleTextAtom = SimpleTextAtom( - textColor = FotoColors.secondaryText, - typography = FotoTypography.button, - fontFamily = null, - ) -} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistColumn.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistColumn.kt index fe820d26..caf49a1c 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistColumn.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistColumn.kt @@ -12,12 +12,10 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp -import com.kevinschildhorn.atomik.color.base.composeColor import com.kevinschildhorn.fotopresenter.data.PlaylistDetails -import com.kevinschildhorn.fotopresenter.ui.atoms.FotoColors import com.kevinschildhorn.fotopresenter.ui.atoms.Padding -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText -import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors +import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.DialogButtonText @Composable fun PlaylistColumn( @@ -29,19 +27,15 @@ fun PlaylistColumn( onDelete: (Long) -> Unit, modifier: Modifier = Modifier, ) { - val atom = PlaylistScreenAtoms.title Column( modifier .fillMaxWidth() .padding(Padding.STANDARD.dp) .clip(RoundedCornerShape(10.dp)) - .background(FotoColors.secondary.composeColor) + .background(fotoColors.secondary) ) { Column(Modifier.fillMaxWidth().padding(Padding.MEDIUM.dp)) { - AtomikText( - "Playlists", - atom = atom - ) + DialogButtonText("Playlists") LazyColumn { items(options) { PlaylistScreenPlaylistRow( @@ -62,7 +56,7 @@ fun PlaylistColumn( Divider( startIndent = 0.dp, thickness = 1.dp, - color = FotoColors.secondaryText.composeColor + color = fotoColors.onSecondary ) } } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt index 2967f69a..70cbeee7 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenCreateRow.kt @@ -5,15 +5,15 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width +import androidx.compose.material.Icon import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.kevinschildhorn.fotopresenter.ui.atoms.Padding -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText -import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors +import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.DialogButtonText import compose.icons.EvaIcons import compose.icons.evaicons.Outline import compose.icons.evaicons.outline.PlusCircle @@ -23,7 +23,6 @@ fun PlaylistScreenCreateRow( modifier: Modifier = Modifier, onClick: () -> Unit, ) { - val atom = PlaylistScreenAtoms.rowTitle Row( modifier = modifier.fillMaxWidth().height(55.dp), verticalAlignment = Alignment.CenterVertically, @@ -32,13 +31,13 @@ fun PlaylistScreenCreateRow( modifier = Modifier.fillMaxWidth(), onClick = onClick ) { - AtomikIcon( + Icon( EvaIcons.Outline.PlusCircle, - atom, + tint = fotoColors.onSecondary, contentDescription = "Create", ) Spacer(Modifier.width(Padding.SMALL.dp)) - AtomikText("Create", atom) + DialogButtonText("Create") Spacer(Modifier.fillMaxWidth()) } } diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt index 920f33db..cd4d7fd4 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/screens/playlist/composables/PlaylistScreenPlaylistRow.kt @@ -8,14 +8,14 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width +import androidx.compose.material.Icon import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikIcon -import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.AtomikText -import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreenAtoms +import com.kevinschildhorn.fotopresenter.ui.atoms.fotoColors +import com.kevinschildhorn.fotopresenter.ui.screens.common.composables.DialogButtonText import compose.icons.EvaIcons import compose.icons.evaicons.Outline import compose.icons.evaicons.outline.Edit @@ -30,7 +30,6 @@ fun PlaylistScreenPlaylistRow( onEdit: () -> Unit, onDelete: () -> Unit, ) { - val atom = PlaylistScreenAtoms.rowTitle Row( modifier = Modifier.fillMaxWidth().height(55.dp), verticalAlignment = Alignment.CenterVertically, @@ -40,7 +39,7 @@ fun PlaylistScreenPlaylistRow( onClick = onClick, modifier = Modifier.fillMaxSize(0.7f) ) { - AtomikText(title, atom) + DialogButtonText(title) Spacer(Modifier.fillMaxWidth()) } Row(modifier = Modifier.fillMaxHeight()) { @@ -48,9 +47,9 @@ fun PlaylistScreenPlaylistRow( modifier = Modifier.width(44.dp), onClick = onDetails ) { - AtomikIcon( + Icon( EvaIcons.Outline.Info, - atom, + tint = fotoColors.onSecondary, contentDescription = "Details", ) } @@ -58,9 +57,9 @@ fun PlaylistScreenPlaylistRow( modifier = Modifier.width(44.dp), onClick = onEdit ) { - AtomikIcon( + Icon( EvaIcons.Outline.Edit, - atom, + tint = fotoColors.onSecondary, contentDescription = "Edit", ) } @@ -68,9 +67,9 @@ fun PlaylistScreenPlaylistRow( modifier = Modifier.width(44.dp), onClick = onDelete, ) { - AtomikIcon( + Icon( EvaIcons.Outline.Trash, - atom, + tint = fotoColors.onSecondary, contentDescription = "Trash" ) } diff --git a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/KoinTest.kt b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/KoinTest.kt index 13b5995e..6f12fc5f 100644 --- a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/KoinTest.kt +++ b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/KoinTest.kt @@ -10,7 +10,7 @@ import com.russhwolf.settings.MapSettings import com.russhwolf.settings.Settings import org.koin.dsl.module -private val baseLogger = Logger(LoggerConfig.default) +private val baseLogger = Logger.withTag("Test") fun testingModule(settings: MapSettings = MapSettings()) = module { diff --git a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/SaveCredentialsUseCaseTest.kt b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/SaveCredentialsUseCaseTest.kt index 396f6628..3c7e0411 100644 --- a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/SaveCredentialsUseCaseTest.kt +++ b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/SaveCredentialsUseCaseTest.kt @@ -22,7 +22,7 @@ class SaveCredentialsUseCaseTest : KoinTest { @BeforeTest fun startTest() { - val baseLogger = Logger(LoggerConfig.default) + val baseLogger = Logger.withTag("Test") startKoin { modules(testingModule())