Skip to content

Commit

Permalink
Release of 0.9.0 (#32)
Browse files Browse the repository at this point in the history
* Upgraded kotlin to 1.9.22 and other dependencies (#23)

* Upgraded kotlin to 1.9.22 and other dependencies

* Cleaned code

* support kotlin 2.0.20 (#31)

Co-authored-by: Tomasz Kądziołka <tmax0135@gmail.com>

* gradle 8.9 (#30)

Co-authored-by: Tomasz Kądziołka <tmax0135@gmail.com>

* Update highlights to 1.0.0 and use new async API (#33)

* Updated highlights dependency to 1.0.0

* Added new API for desktop example

* Corrected split desktop view

* Cleaned desktop example

* Designed annotated string persistence

* Refactored new logic

* Corrected SwiftUI component

* Updated base edit text component

* Updated readme for 0.9.0 (#34)

---------

Co-authored-by: xJac0b <85969059+xJac0b@users.noreply.github.com>
  • Loading branch information
tmaxxdd and xJac0b authored Nov 3, 2024
1 parent b5a1308 commit d43dbd5
Show file tree
Hide file tree
Showing 22 changed files with 766 additions and 599 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
.externalNativeBuild
.cxx
local.properties
/.kotlin/
2 changes: 1 addition & 1 deletion .run/iosExample.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iosExample" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" EXEC_TARGET_ID="645C2113-7E25-482E-9F32-B612B7A046E0" XCODE_PROJECT="$PROJECT_DIR$/iosExample/iosExample.xcodeproj" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="iosExample">
<configuration default="false" name="iosExample" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" EXEC_TARGET_ID="726A8064-1CB8-4F0E-A381-CABB326B938F" XCODE_PROJECT="$PROJECT_DIR$/iosExample/iosExample.xcodeproj" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="iosExample">
<method v="2">
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
</method>
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [0.9.0]

### Changed
- minimum SDK to 25
- Gradle to 8.9
- Kotlin version to 2.0.20
- Highlights library version to 1.0.0
- `translateTabToSpaces` param name to `handleIndentations`
- desktop example to support side by side view

### Fixed
- blocking main UI thread on input change

## [0.8.0]

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![kodeview_banner_opaque](https://github.com/SnipMeDev/KodeView/assets/8405055/59c6a2af-1b32-4a02-998f-ecae2296363a)

[![Maven Central](https://img.shields.io/maven-central/v/dev.snipme/kodeview)](https://mvnrepository.com/artifact/dev.snipme)
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.20-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)

# KodeView
Expand All @@ -21,7 +21,7 @@ repositories {
```

```shell
implementation("dev.snipme:kodeview:0.8.0")
implementation("dev.snipme:kodeview:0.9.0")
```

## Features ✨
Expand Down
11 changes: 6 additions & 5 deletions androidExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp) apply false
alias(libs.plugins.compose)
alias(libs.plugins.compose.compiler)
}

android {
namespace = "dev.snipme.androidexample"
compileSdk = 34

defaultConfig {
minSdk = 24
minSdk = 25

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -48,15 +49,15 @@ android {

dependencies {
// Core
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation(libs.core.ktx)
implementation(libs.appcompat)
// Compose
implementation("androidx.activity:activity-compose:1.8.2")
implementation(libs.activity.compose)
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.materialIconsExtended)
implementation(libs.kodeview)
implementation(project(":kodeview"))
}
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ plugins {
kotlin("android") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
alias(libs.plugins.compose) apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
alias(libs.plugins.compose.compiler) apply false
}

apply(from = "publish-root.gradle")
3 changes: 2 additions & 1 deletion desktopExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
plugins {
alias(libs.plugins.jvm)
alias(libs.plugins.compose)
alias(libs.plugins.compose.compiler)
}

dependencies {
Expand All @@ -14,7 +15,7 @@ dependencies {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(compose.desktop.currentOs)
implementation(libs.kodeview)
implementation(project(":kodeview"))
}

compose.desktop {
Expand Down
72 changes: 34 additions & 38 deletions desktopExample/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ package dev.snipme.desktopexample

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.VerticalDivider
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
Expand All @@ -31,10 +31,8 @@ import dev.snipme.highlights.model.SyntaxLanguage
import dev.snipme.highlights.model.SyntaxTheme
import dev.snipme.highlights.model.SyntaxThemes
import dev.snipme.highlights.model.SyntaxThemes.useDark
import dev.snipme.kodeview.view.material3.CodeEditText
import dev.snipme.kodeview.view.CodeTextView

private val windowSize = 600.dp
import dev.snipme.kodeview.view.material3.CodeEditText

private val sampleCode =
"""
Expand Down Expand Up @@ -72,18 +70,14 @@ fun main() = application {
Window(
onCloseRequest = ::exitApplication,
title = "KodeView example",
state = rememberWindowState(
width = windowSize,
height = windowSize,
)
state = rememberWindowState()
) {
Surface {
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
horizontalAlignment = Alignment.Start,
verticalArrangement = Arrangement.SpaceBetween
verticalArrangement = Arrangement.Center,
) {
Spacer(Modifier.height(8.dp))

Expand All @@ -106,36 +100,38 @@ fun main() = application {

Spacer(modifier = Modifier.size(16.dp))

CodeTextView(highlights = highlights)

Spacer(modifier = Modifier.size(16.dp))

Divider()

Spacer(modifier = Modifier.size(16.dp))

Text("Edit this...")
CodeEditText(
highlights = highlights,
onValueChange = { textValue ->
highlightsState.value = highlights.getBuilder()
.code(textValue)
.build()
},
colors = TextFieldDefaults.colors(
unfocusedContainerColor = Color.Transparent,
focusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent,
errorIndicatorColor = Color.Transparent,
),
)
Row(
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
) {
CodeTextView(
modifier = Modifier.weight(1f),
highlights = highlights,
)
VerticalDivider(Modifier.padding(8.dp))
CodeEditText(
modifier = Modifier.weight(1f),
label = { Text("Edit code") },
highlights = highlights,
onValueChange = { textValue ->
highlightsState.value = highlights.getBuilder()
.code(textValue)
.build()
},
colors = TextFieldDefaults.colors(
unfocusedContainerColor = Color.Transparent,
focusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent,
errorIndicatorColor = Color.Transparent,
),
)
}

Spacer(modifier = Modifier.size(16.dp))

Spacer(modifier = Modifier.weight(1f))

Dropdown(
options = SyntaxThemes.getNames(),
selected = SyntaxThemes.themes().keys.indexOf(highlights.getTheme().key),
Expand Down
23 changes: 16 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
[versions]
activityCompose = "1.9.2"
appcompat = "1.7.0"
coreKtx = "1.13.1"
jvmTarget = "1.8"
gradlePlugin = "8.1.0"
kotlin = "1.9.21"

kotlin = "2.0.20"
ksp = "1.8.10-1.0.9"
kotlinCompilerExtensionVersion = "1.5.3"
kotlinAndroid = "1.9.21"
kotlinMultiplatform = "1.9.21"
compose = "1.5.11"
androidLibrary = "8.1.1"

kotlinAndroid = "2.0.20"
kotlinMultiplatform = "2.0.20"
compose = "1.6.11"
androidLibrary = "8.6.1"
kodeview = "0.8.0"
highlights = "0.7.1"
composeMaterial = "1.2.1"
highlights = "1.0.0"
composeMaterial = "1.4.0"

[libraries]
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
kodeview = { group = "dev.snipme", name = "kodeview", version.ref = "kodeview" }
highlights = { group = "dev.snipme", name = "highlights", version.ref = "highlights" }
compose-material = { group = "androidx.wear.compose", name = "compose-material", version.ref = "composeMaterial" }
Expand All @@ -22,6 +30,7 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlinMultiplatform" }
jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinAndroid" }
android-application = { id = "com.android.application" }
android-library = { id = "com.android.library", version.ref = "androidLibrary" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Sun Apr 16 12:11:59 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit d43dbd5

Please sign in to comment.