Skip to content

Commit 487fc7c

Browse files
committed
Extract compose codeviewer into separate module
1 parent 3506291 commit 487fc7c

44 files changed

Lines changed: 149 additions & 64 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public final class io/github/composegears/valkyrie/compose/codeviewer/KotlinCodeViewerKt {
2+
public static final fun KotlinCodeViewer (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V
3+
}
4+
5+
public final class io/github/composegears/valkyrie/compose/codeviewer/core/CodeEditorKt {
6+
public static final fun CodeEditor (Ldev/snipme/highlights/Highlights;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;ZZZLandroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;ZIILandroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/ui/graphics/Shape;Landroidx/compose/material3/TextFieldColors;Landroidx/compose/runtime/Composer;IIII)V
7+
}
8+
9+
public final class io/github/composegears/valkyrie/compose/codeviewer/core/CodeViewerKt {
10+
public static final fun CodeViewer (Ldev/snipme/highlights/Highlights;Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V
11+
}
12+
13+
public final class io/github/composegears/valkyrie/compose/codeviewer/core/CommonKt {
14+
public static final fun getEmphasisLocations (Ljava/lang/String;Ljava/lang/String;)[Ldev/snipme/highlights/model/PhraseLocation;
15+
public static final fun rememberCodeHighlight (Ljava/lang/String;[Ldev/snipme/highlights/model/PhraseLocation;Landroidx/compose/runtime/Composer;I)Ldev/snipme/highlights/Highlights;
16+
}
17+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Klib ABI Dump
2+
// Targets: [wasmJs]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <valkyrie.compose:codeviewer>
9+
final fun io.github.composegears.valkyrie.compose.codeviewer.core/CodeEditor(dev.snipme.highlights/Highlights, kotlin/Function1<kotlin/String, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Boolean, kotlin/Boolean, kotlin/Boolean, androidx.compose.ui.text/TextStyle?, kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>?, kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>?, kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>?, kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>?, kotlin/Boolean, androidx.compose.ui.text.input/VisualTransformation?, androidx.compose.foundation.text/KeyboardOptions?, androidx.compose.foundation.text/KeyboardActions?, kotlin/Boolean, kotlin/Int, kotlin/Int, androidx.compose.foundation.interaction/MutableInteractionSource?, androidx.compose.ui.graphics/Shape?, androidx.compose.material3/TextFieldColors?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.codeviewer.core/CodeEditor|CodeEditor(dev.snipme.highlights.Highlights;kotlin.Function1<kotlin.String,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Boolean;kotlin.Boolean;kotlin.Boolean;androidx.compose.ui.text.TextStyle?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;kotlin.Boolean;androidx.compose.ui.text.input.VisualTransformation?;androidx.compose.foundation.text.KeyboardOptions?;androidx.compose.foundation.text.KeyboardActions?;kotlin.Boolean;kotlin.Int;kotlin.Int;androidx.compose.foundation.interaction.MutableInteractionSource?;androidx.compose.ui.graphics.Shape?;androidx.compose.material3.TextFieldColors?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int;kotlin.Int){}[0]
10+
final fun io.github.composegears.valkyrie.compose.codeviewer.core/CodeViewer(dev.snipme.highlights/Highlights, androidx.compose.ui/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.codeviewer.core/CodeViewer|CodeViewer(dev.snipme.highlights.Highlights;androidx.compose.ui.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
11+
final fun io.github.composegears.valkyrie.compose.codeviewer.core/getEmphasisLocations(kotlin/String, kotlin/String): kotlin/Array<dev.snipme.highlights.model/PhraseLocation> // io.github.composegears.valkyrie.compose.codeviewer.core/getEmphasisLocations|getEmphasisLocations(kotlin.String;kotlin.String){}[0]
12+
final fun io.github.composegears.valkyrie.compose.codeviewer.core/rememberCodeHighlight(kotlin/String, kotlin/Array<out dev.snipme.highlights.model/PhraseLocation>..., androidx.compose.runtime/Composer?, kotlin/Int): dev.snipme.highlights/Highlights // io.github.composegears.valkyrie.compose.codeviewer.core/rememberCodeHighlight|rememberCodeHighlight(kotlin.String;kotlin.Array<out|dev.snipme.highlights.model.PhraseLocation>...;androidx.compose.runtime.Composer?;kotlin.Int){}[0]
13+
final fun io.github.composegears.valkyrie.compose.codeviewer/KotlinCodeViewer(kotlin/String, androidx.compose.ui/Modifier?, kotlin/Function1<kotlin/String, kotlin/Unit>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.codeviewer/KotlinCodeViewer|KotlinCodeViewer(kotlin.String;androidx.compose.ui.Modifier?;kotlin.Function1<kotlin.String,kotlin.Unit>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
alias(libs.plugins.valkyrie.kmp)
3+
alias(libs.plugins.valkyrie.compose)
4+
}
5+
6+
kotlin {
7+
sourceSets {
8+
commonMain.dependencies {
9+
implementation(projects.compose.core)
10+
implementation(projects.compose.ui)
11+
implementation(projects.compose.util)
12+
13+
implementation(compose.material3)
14+
api(libs.highlights)
15+
}
16+
}
17+
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/KotlinCodeViewer.kt renamed to compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/compose/codeviewer/KotlinCodeViewer.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
package io.github.composegears.valkyrie.ui.foundation.highlights
1+
package io.github.composegears.valkyrie.compose.codeviewer
22

3-
import androidx.compose.desktop.ui.tooling.preview.Preview
43
import androidx.compose.material3.MaterialTheme
54
import androidx.compose.material3.TextFieldDefaults
65
import androidx.compose.runtime.Composable
@@ -12,10 +11,9 @@ import androidx.compose.ui.unit.sp
1211
import dev.snipme.highlights.Highlights
1312
import dev.snipme.highlights.model.SyntaxLanguage
1413
import dev.snipme.highlights.model.SyntaxThemes
14+
import io.github.composegears.valkyrie.compose.codeviewer.core.CodeEditor
1515
import io.github.composegears.valkyrie.compose.core.rememberMutableState
16-
import io.github.composegears.valkyrie.ui.foundation.highlights.core.CodeEditor
17-
import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme
18-
import io.github.composegears.valkyrie.ui.foundation.theme.isLight
16+
import io.github.composegears.valkyrie.compose.util.isLight
1917

2018
@Composable
2119
fun KotlinCodeViewer(
@@ -54,9 +52,9 @@ fun KotlinCodeViewer(
5452
)
5553
}
5654

57-
@Preview
55+
// @Preview - not working without Android target
5856
@Composable
59-
private fun CodePreview() = PreviewTheme {
57+
private fun CodePreview() {
6058
KotlinCodeViewer(
6159
text = """
6260
val ValkyrieIcons.EmptyImageVector: ImageVector

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/core/CodeEditor.kt renamed to compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/compose/codeviewer/core/CodeEditor.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.composegears.valkyrie.ui.foundation.highlights.core
1+
package io.github.composegears.valkyrie.compose.codeviewer.core
22

33
import androidx.compose.foundation.horizontalScroll
44
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -38,9 +38,9 @@ import androidx.compose.ui.unit.sp
3838
import dev.snipme.highlights.Highlights
3939
import io.github.composegears.valkyrie.compose.core.rememberMutableIntState
4040
import io.github.composegears.valkyrie.compose.core.rememberMutableState
41-
import io.github.composegears.valkyrie.compose.ui.util.disabled
42-
import io.github.composegears.valkyrie.ui.foundation.HorizontalScrollbar
43-
import io.github.composegears.valkyrie.ui.foundation.VerticalScrollbar
41+
import io.github.composegears.valkyrie.compose.ui.foundation.HorizontalScrollbar
42+
import io.github.composegears.valkyrie.compose.ui.foundation.VerticalScrollbar
43+
import io.github.composegears.valkyrie.compose.util.disabled
4444

4545
@Composable
4646
fun CodeEditor(

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/core/CodeViewer.kt renamed to compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/compose/codeviewer/core/CodeViewer.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
package io.github.composegears.valkyrie.ui.foundation.highlights.core
1+
package io.github.composegears.valkyrie.compose.codeviewer.core
22

3-
import androidx.compose.desktop.ui.tooling.preview.Preview
43
import androidx.compose.material3.MaterialTheme
54
import androidx.compose.material3.Text
65
import androidx.compose.runtime.Composable
76
import androidx.compose.ui.Modifier
87
import androidx.compose.ui.text.font.FontFamily
98
import dev.snipme.highlights.Highlights
109
import dev.snipme.highlights.model.PhraseLocation
11-
import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme
1210

1311
@Composable
1412
fun CodeViewer(
@@ -22,9 +20,9 @@ fun CodeViewer(
2220
)
2321
}
2422

25-
@Preview
23+
// @Preview - not working without Android target
2624
@Composable
27-
private fun CodeTextViewPreview() = PreviewTheme {
25+
private fun CodeTextViewPreview() {
2826
val highlights = rememberCodeHighlight(
2927
codeBlock = """
3028
package io.github.composegears.valkyrie

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/core/Common.kt renamed to compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/compose/codeviewer/core/Common.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.composegears.valkyrie.ui.foundation.highlights.core
1+
package io.github.composegears.valkyrie.compose.codeviewer.core
22

33
import androidx.compose.material3.MaterialTheme
44
import androidx.compose.runtime.Composable
@@ -14,9 +14,9 @@ import dev.snipme.highlights.model.ColorHighlight
1414
import dev.snipme.highlights.model.PhraseLocation
1515
import dev.snipme.highlights.model.SyntaxLanguage
1616
import dev.snipme.highlights.model.SyntaxThemes
17-
import io.github.composegears.valkyrie.ui.foundation.theme.isLight
17+
import io.github.composegears.valkyrie.compose.util.isLight
1818

19-
fun Highlights.buildAnnotatedString() = buildAnnotatedString {
19+
internal fun Highlights.buildAnnotatedString() = buildAnnotatedString {
2020
append(getCode())
2121

2222
getHighlights()

compose/ui/api/ui.api

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ public final class io/github/composegears/valkyrie/compose/ui/InfoCardKt {
22
public static final fun InfoCard (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/graphics/vector/ImageVector;Ljava/lang/String;Ljava/lang/String;Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V
33
}
44

5-
public final class io/github/composegears/valkyrie/compose/ui/util/ColorKt {
6-
public static final fun dim-8_81llA (J)J
7-
public static final fun disabled-8_81llA (J)J
5+
public final class io/github/composegears/valkyrie/compose/ui/foundation/ScrollbarKt {
6+
public static final fun HorizontalScrollbar (Landroidx/compose/foundation/layout/BoxScope;Landroidx/compose/foundation/v2/ScrollbarAdapter;Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V
7+
public static final fun VerticalScrollbar (Landroidx/compose/foundation/layout/BoxScope;Landroidx/compose/foundation/v2/ScrollbarAdapter;Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V
88
}
99

compose/ui/api/ui.klib.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// - Show declarations: true
77

88
// Library unique name: <valkyrie.compose:ui>
9-
final fun (androidx.compose.ui.graphics/Color).io.github.composegears.valkyrie.compose.ui.util/dim(): androidx.compose.ui.graphics/Color // io.github.composegears.valkyrie.compose.ui.util/dim|dim@androidx.compose.ui.graphics.Color(){}[0]
10-
final fun (androidx.compose.ui.graphics/Color).io.github.composegears.valkyrie.compose.ui.util/disabled(): androidx.compose.ui.graphics/Color // io.github.composegears.valkyrie.compose.ui.util/disabled|disabled@androidx.compose.ui.graphics.Color(){}[0]
9+
final fun (androidx.compose.foundation.layout/BoxScope).io.github.composegears.valkyrie.compose.ui.foundation/HorizontalScrollbar(androidx.compose.foundation.v2/ScrollbarAdapter, androidx.compose.ui/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.ui.foundation/HorizontalScrollbar|HorizontalScrollbar@androidx.compose.foundation.layout.BoxScope(androidx.compose.foundation.v2.ScrollbarAdapter;androidx.compose.ui.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
10+
final fun (androidx.compose.foundation.layout/BoxScope).io.github.composegears.valkyrie.compose.ui.foundation/VerticalScrollbar(androidx.compose.foundation.v2/ScrollbarAdapter, androidx.compose.ui/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.ui.foundation/VerticalScrollbar|VerticalScrollbar@androidx.compose.foundation.layout.BoxScope(androidx.compose.foundation.v2.ScrollbarAdapter;androidx.compose.ui.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
1111
final fun io.github.composegears.valkyrie.compose.ui/InfoCard(kotlin/Function0<kotlin/Unit>, androidx.compose.ui.graphics.vector/ImageVector, kotlin/String, kotlin/String, androidx.compose.ui/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.github.composegears.valkyrie.compose.ui/InfoCard|InfoCard(kotlin.Function0<kotlin.Unit>;androidx.compose.ui.graphics.vector.ImageVector;kotlin.String;kotlin.String;androidx.compose.ui.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]

compose/ui/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kotlin {
77
sourceSets {
88
commonMain.dependencies {
99
implementation(projects.compose.core)
10+
implementation(projects.compose.util)
1011

1112
implementation(compose.material3)
1213
}

0 commit comments

Comments
 (0)