Skip to content

Commit d43dbd5

Browse files
tmaxxddxJac0b
andauthored
Release of 0.9.0 (#32)
* 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>
1 parent b5a1308 commit d43dbd5

22 files changed

Lines changed: 766 additions & 599 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
.externalNativeBuild
1111
.cxx
1212
local.properties
13+
/.kotlin/

.run/iosExample.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<component name="ProjectRunConfigurationManager">
2-
<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">
2+
<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">
33
<method v="2">
44
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
55
</method>

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [0.9.0]
2+
3+
### Changed
4+
- minimum SDK to 25
5+
- Gradle to 8.9
6+
- Kotlin version to 2.0.20
7+
- Highlights library version to 1.0.0
8+
- `translateTabToSpaces` param name to `handleIndentations`
9+
- desktop example to support side by side view
10+
11+
### Fixed
12+
- blocking main UI thread on input change
13+
114
## [0.8.0]
215

316
### Added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![kodeview_banner_opaque](https://github.com/SnipMeDev/KodeView/assets/8405055/59c6a2af-1b32-4a02-998f-ecae2296363a)
22

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

77
# KodeView
@@ -21,7 +21,7 @@ repositories {
2121
```
2222

2323
```shell
24-
implementation("dev.snipme:kodeview:0.8.0")
24+
implementation("dev.snipme:kodeview:0.9.0")
2525
```
2626

2727
## Features ✨

androidExample/build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ plugins {
44
alias(libs.plugins.kotlin.android)
55
alias(libs.plugins.ksp) apply false
66
alias(libs.plugins.compose)
7+
alias(libs.plugins.compose.compiler)
78
}
89

910
android {
1011
namespace = "dev.snipme.androidexample"
1112
compileSdk = 34
1213

1314
defaultConfig {
14-
minSdk = 24
15+
minSdk = 25
1516

1617
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1718
}
@@ -48,15 +49,15 @@ android {
4849

4950
dependencies {
5051
// Core
51-
implementation("androidx.core:core-ktx:1.12.0")
52-
implementation("androidx.appcompat:appcompat:1.6.1")
52+
implementation(libs.core.ktx)
53+
implementation(libs.appcompat)
5354
// Compose
54-
implementation("androidx.activity:activity-compose:1.8.2")
55+
implementation(libs.activity.compose)
5556
implementation(compose.runtime)
5657
implementation(compose.foundation)
5758
implementation(compose.material)
5859
implementation(compose.material3)
5960
implementation(compose.ui)
6061
implementation(compose.materialIconsExtended)
61-
implementation(libs.kodeview)
62+
implementation(project(":kodeview"))
6263
}

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ plugins {
66
kotlin("android") apply false
77
id("com.android.application") apply false
88
id("com.android.library") apply false
9-
id("org.jetbrains.compose") apply false
9+
alias(libs.plugins.compose) apply false
1010
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
11+
alias(libs.plugins.compose.compiler) apply false
1112
}
1213

1314
apply(from = "publish-root.gradle")

desktopExample/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
plugins {
33
alias(libs.plugins.jvm)
44
alias(libs.plugins.compose)
5+
alias(libs.plugins.compose.compiler)
56
}
67

78
dependencies {
@@ -14,7 +15,7 @@ dependencies {
1415
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
1516
implementation(compose.components.resources)
1617
implementation(compose.desktop.currentOs)
17-
implementation(libs.kodeview)
18+
implementation(project(":kodeview"))
1819
}
1920

2021
compose.desktop {

desktopExample/src/main/kotlin/Main.kt

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ package dev.snipme.desktopexample
22

33
import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.Row
56
import androidx.compose.foundation.layout.Spacer
67
import androidx.compose.foundation.layout.fillMaxSize
78
import androidx.compose.foundation.layout.fillMaxWidth
89
import androidx.compose.foundation.layout.height
910
import androidx.compose.foundation.layout.padding
1011
import androidx.compose.foundation.layout.size
11-
import androidx.compose.material3.Divider
1212
import androidx.compose.material3.MaterialTheme
1313
import androidx.compose.material3.Surface
1414
import androidx.compose.material3.Text
1515
import androidx.compose.material3.TextFieldDefaults
16+
import androidx.compose.material3.VerticalDivider
1617
import androidx.compose.material3.darkColorScheme
1718
import androidx.compose.material3.lightColorScheme
1819
import androidx.compose.runtime.mutableStateOf
1920
import androidx.compose.runtime.remember
20-
import androidx.compose.ui.Alignment
2121
import androidx.compose.ui.Modifier
2222
import androidx.compose.ui.graphics.Color
2323
import androidx.compose.ui.text.style.TextAlign
@@ -31,10 +31,8 @@ import dev.snipme.highlights.model.SyntaxLanguage
3131
import dev.snipme.highlights.model.SyntaxTheme
3232
import dev.snipme.highlights.model.SyntaxThemes
3333
import dev.snipme.highlights.model.SyntaxThemes.useDark
34-
import dev.snipme.kodeview.view.material3.CodeEditText
3534
import dev.snipme.kodeview.view.CodeTextView
36-
37-
private val windowSize = 600.dp
35+
import dev.snipme.kodeview.view.material3.CodeEditText
3836

3937
private val sampleCode =
4038
"""
@@ -72,18 +70,14 @@ fun main() = application {
7270
Window(
7371
onCloseRequest = ::exitApplication,
7472
title = "KodeView example",
75-
state = rememberWindowState(
76-
width = windowSize,
77-
height = windowSize,
78-
)
73+
state = rememberWindowState()
7974
) {
8075
Surface {
8176
Column(
8277
modifier = Modifier
8378
.fillMaxSize()
8479
.padding(16.dp),
85-
horizontalAlignment = Alignment.Start,
86-
verticalArrangement = Arrangement.SpaceBetween
80+
verticalArrangement = Arrangement.Center,
8781
) {
8882
Spacer(Modifier.height(8.dp))
8983

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

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

109-
CodeTextView(highlights = highlights)
110-
111-
Spacer(modifier = Modifier.size(16.dp))
112-
113-
Divider()
114-
115-
Spacer(modifier = Modifier.size(16.dp))
116-
117-
Text("Edit this...")
118-
CodeEditText(
119-
highlights = highlights,
120-
onValueChange = { textValue ->
121-
highlightsState.value = highlights.getBuilder()
122-
.code(textValue)
123-
.build()
124-
},
125-
colors = TextFieldDefaults.colors(
126-
unfocusedContainerColor = Color.Transparent,
127-
focusedContainerColor = Color.Transparent,
128-
focusedIndicatorColor = Color.Transparent,
129-
unfocusedIndicatorColor = Color.Transparent,
130-
disabledIndicatorColor = Color.Transparent,
131-
errorIndicatorColor = Color.Transparent,
132-
),
133-
)
103+
Row(
104+
modifier = Modifier
105+
.weight(1f)
106+
.fillMaxWidth(),
107+
) {
108+
CodeTextView(
109+
modifier = Modifier.weight(1f),
110+
highlights = highlights,
111+
)
112+
VerticalDivider(Modifier.padding(8.dp))
113+
CodeEditText(
114+
modifier = Modifier.weight(1f),
115+
label = { Text("Edit code") },
116+
highlights = highlights,
117+
onValueChange = { textValue ->
118+
highlightsState.value = highlights.getBuilder()
119+
.code(textValue)
120+
.build()
121+
},
122+
colors = TextFieldDefaults.colors(
123+
unfocusedContainerColor = Color.Transparent,
124+
focusedContainerColor = Color.Transparent,
125+
focusedIndicatorColor = Color.Transparent,
126+
unfocusedIndicatorColor = Color.Transparent,
127+
disabledIndicatorColor = Color.Transparent,
128+
errorIndicatorColor = Color.Transparent,
129+
),
130+
)
131+
}
134132

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

137-
Spacer(modifier = Modifier.weight(1f))
138-
139135
Dropdown(
140136
options = SyntaxThemes.getNames(),
141137
selected = SyntaxThemes.themes().keys.indexOf(highlights.getTheme().key),

gradle/libs.versions.toml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
[versions]
2+
activityCompose = "1.9.2"
3+
appcompat = "1.7.0"
4+
coreKtx = "1.13.1"
25
jvmTarget = "1.8"
36
gradlePlugin = "8.1.0"
4-
kotlin = "1.9.21"
7+
8+
kotlin = "2.0.20"
59
ksp = "1.8.10-1.0.9"
610
kotlinCompilerExtensionVersion = "1.5.3"
7-
kotlinAndroid = "1.9.21"
8-
kotlinMultiplatform = "1.9.21"
9-
compose = "1.5.11"
10-
androidLibrary = "8.1.1"
11+
12+
kotlinAndroid = "2.0.20"
13+
kotlinMultiplatform = "2.0.20"
14+
compose = "1.6.11"
15+
androidLibrary = "8.6.1"
1116
kodeview = "0.8.0"
12-
highlights = "0.7.1"
13-
composeMaterial = "1.2.1"
17+
highlights = "1.0.0"
18+
composeMaterial = "1.4.0"
1419

1520
[libraries]
21+
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
22+
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
23+
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
1624
kodeview = { group = "dev.snipme", name = "kodeview", version.ref = "kodeview" }
1725
highlights = { group = "dev.snipme", name = "highlights", version.ref = "highlights" }
1826
compose-material = { group = "androidx.wear.compose", name = "compose-material", version.ref = "composeMaterial" }
@@ -22,6 +30,7 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
2230
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlinMultiplatform" }
2331
jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
2432
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
33+
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2534
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinAndroid" }
2635
android-application = { id = "com.android.application" }
2736
android-library = { id = "com.android.library", version.ref = "androidLibrary" }

gradle/wrapper/gradle-wrapper.jar

-15.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)