Skip to content

Commit

Permalink
Version bump 1.5.12
Browse files Browse the repository at this point in the history
This change includes bunch of misc tech debt cleaning.

- Use Compose Multiplatform dependencies instead of Google's Compose artifacts
- Removed Previews from richtext-ui.
- Renamed CodeBlock platform files.
- Kotlin updated to 1.9.22
- Compose compiler update to 1.5.8
- Changed MarkdownSample to use CommonmarkAstNodeParser and do synchronous Markdown rendering.
  • Loading branch information
halilozercan committed Feb 9, 2024
1 parent db4de67 commit 67865da
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 318 deletions.
9 changes: 5 additions & 4 deletions android-sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.application")
kotlin("android")
id("org.jetbrains.compose") version Compose.desktopVersion
}

android {
Expand Down Expand Up @@ -36,8 +37,8 @@ dependencies {
implementation(project(":slideshow"))
implementation(AndroidX.appcompat)
implementation(Compose.activity)
implementation(Compose.foundation)
implementation(Compose.icons)
implementation(Compose.material)
implementation(Compose.tooling)
implementation(compose.foundation)
implementation(compose.materialIconsExtended)
implementation(compose.material)
implementation(compose.uiTooling)
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.em
import com.halilibo.richtext.commonmark.Markdown
import com.halilibo.richtext.commonmark.CommonmarkAstNodeParser
import com.halilibo.richtext.commonmark.MarkdownParseOptions
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.RichTextStyle
import com.halilibo.richtext.ui.material.RichText
import com.halilibo.richtext.ui.resolveDefaults
Expand Down Expand Up @@ -104,13 +105,19 @@ import com.halilibo.richtext.ui.resolveDefaults
SelectionContainer {
Column(Modifier.verticalScroll(rememberScrollState())) {
ProvideTextStyle(TextStyle(lineHeight = 1.3.em)) {
val parser = remember(markdownParseOptions) {
CommonmarkAstNodeParser(markdownParseOptions)
}
val astNode = remember(parser) {
parser.parse(sampleMarkdown)
}

RichText(
style = richTextStyle,
modifier = Modifier.padding(8.dp),
) {
Markdown(
content = sampleMarkdown,
markdownParseOptions = markdownParseOptions,
astNode = astNode,
onLinkClicked = {
Toast.makeText(context, it, Toast.LENGTH_SHORT).show()
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ subprojects {
allWarningsAsErrors = true
}

freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn", "-Xexpect-actual-classes")
}
}

Expand Down
15 changes: 4 additions & 11 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object Network {

object Kotlin {
// keep in sync with buildSrc/build.gradle.kts
val version = "1.9.20"
val version = "1.9.22"
val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:0.9.0"
val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"

Expand All @@ -31,19 +31,12 @@ val ktlint = "org.jlleitschuh.gradle:ktlint-gradle:10.0.0"

object Compose {
val version = "1.5.4"
val compilerVersion = "1.5.4"
val desktopVersion = "1.5.11"
val compilerVersion = "1.5.8"
val desktopVersion = "1.5.12"
val activity = "androidx.activity:activity-compose:1.7.2"
val foundation = "androidx.compose.foundation:foundation:$version"
val material = "androidx.compose.material:material:$version"
val material3 = "androidx.compose.material3:material3:1.0.1"
val icons = "androidx.compose.material:material-icons-extended:$version"
val test = "androidx.ui:ui-test:$version"
val tooling = "androidx.compose.ui:ui-tooling:$version"
val toolingData = "androidx.compose.ui:ui-tooling-data:$version"
val desktopPreview = "org.jetbrains.compose.ui:ui-tooling-preview-desktop:$desktopVersion"
val multiplatformUiUtil = "org.jetbrains.compose.ui:ui-util:$desktopVersion"
val coil = "io.coil-kt:coil-compose:2.4.0"
val coil = "io.coil-kt:coil-compose:2.5.0"
}

object Commonmark {
Expand Down
2 changes: 1 addition & 1 deletion docs/richtext-ui-material3.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Richtext UI Material
# Richtext UI Material 3

[![Android Library](https://img.shields.io/badge/Platform-Android-green.svg?style=for-the-badge)](https://developer.android.com/studio/build/dependencies)
[![JVM Library](https://img.shields.io/badge/Platform-JVM-red.svg?style=for-the-badge)](https://kotlinlang.org/docs/mpp-intro.html)
Expand Down
7 changes: 4 additions & 3 deletions printing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
plugins {
id("richtext-android-library")
id("org.jetbrains.dokka")
id("org.jetbrains.compose") version Compose.desktopVersion
}

android {
namespace = "com.zachklipp.richtext.ui.printing"
}

dependencies {
implementation(Compose.foundation)
implementation(Compose.tooling)
implementation(compose.foundation)
implementation(compose.uiTooling)
// For slot table analysis.
implementation(Compose.toolingData)
implementation(Compose.activity)

// TODO Migrate off this.
implementation(Compose.material)
implementation(compose.material)
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java).all {
Expand Down
4 changes: 2 additions & 2 deletions richtext-markdown/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
POM_NAME=Compose Richtext Commonmark
POM_DESCRIPTION=A library for rendering markdown in Compose using the Commonmark library.
POM_NAME=Compose Richtext Markdown
POM_DESCRIPTION=A library for rendering markdown represented as an AST in Compose.
4 changes: 0 additions & 4 deletions richtext-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ kotlin {
}
val jvmMain by getting {
kotlin.srcDir("src/commonJvmAndroid/kotlin")
dependencies {
// requires installing https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support
implementation(Compose.desktopPreview)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:JvmName("CodeBlockAndroid")
package com.halilibo.richtext.ui

import androidx.compose.foundation.horizontalScroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import androidx.compose.foundation.gestures.GestureCancellationException
import androidx.compose.foundation.gestures.PressGestureScope
import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.AwaitPointerEventScope
import androidx.compose.ui.input.pointer.PointerEventTimeoutCancellationException
import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.PointerEventTimeoutCancellationException
import androidx.compose.ui.input.pointer.PointerInputChange
import androidx.compose.ui.input.pointer.PointerInputScope
import androidx.compose.ui.input.pointer.changedToUp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@file:JvmName("CodeBlockJvm")
package com.halilibo.richtext.ui

import androidx.compose.foundation.HorizontalScrollbar
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 67865da

Please sign in to comment.