File tree Expand file tree Collapse file tree 9 files changed +72
-50
lines changed
common/src/commonMain/kotlin/dev/suresh Expand file tree Collapse file tree 9 files changed +72
-50
lines changed Original file line number Diff line number Diff line change
1
+ package dev.suresh
2
+
3
+ import BuildConfig
4
+ import kotlinx.datetime.Clock
5
+ import kotlinx.datetime.TimeZone
6
+ import kotlinx.datetime.toLocalDateTime
7
+ import kotlinx.io.bytestring.*
8
+ import kotlinx.serialization.encodeToString
9
+ import kotlinx.serialization.json.Json
10
+
11
+ class Greeting {
12
+
13
+ val json = Json {
14
+ isLenient = true
15
+ prettyPrint = true
16
+ }
17
+
18
+ fun greeting () =
19
+ """
20
+ | ${BuildConfig .time} - ${KData (" Foo" , 20 , " test" )} : Kotlin $platform : ${KotlinVersion .CURRENT } !
21
+ | ${kotlinxTests()}
22
+ """
23
+ .trimMargin()
24
+
25
+ private fun kotlinxTests (): String {
26
+ val ba = " Kotlinx" .encodeToByteArray()
27
+ val bs1 = ByteString (ba)
28
+ val bs2 = " IO" .encodeToByteString()
29
+
30
+ val bs = buildByteString {
31
+ append(bs1)
32
+ append(bs2)
33
+ }
34
+
35
+ return """
36
+ |${Clock .System .now().toLocalDateTime(TimeZone .currentSystemDefault())}
37
+ |${json.encodeToString(KData (" Bar" , 22 , " test" ))}
38
+ |${bs.decodeToString()}
39
+ """
40
+ .trimMargin()
41
+ }
42
+ }
Original file line number Diff line number Diff line change 1
1
package dev.suresh
2
2
3
- import BuildConfig
4
- import kotlinx.datetime.Clock
5
- import kotlinx.datetime.TimeZone
6
- import kotlinx.datetime.toLocalDateTime
7
- import kotlinx.io.bytestring.*
8
- import kotlinx.serialization.encodeToString
9
- import kotlinx.serialization.json.Json
10
-
11
3
expect val platform: String
12
-
13
- class Greeting {
14
-
15
- val json = Json {
16
- isLenient = true
17
- prettyPrint = true
18
- }
19
-
20
- fun greeting () =
21
- """
22
- | ${BuildConfig .time} - ${KData (" Foo" , 123 , " test" )} : Kotlin $platform : ${KotlinVersion .CURRENT } !
23
- | ${kotlinxTests()}
24
- """
25
- .trimMargin()
26
-
27
- private fun kotlinxTests (): String {
28
- val ba = " Kotlinx" .encodeToByteArray()
29
- val bs1 = ByteString (ba)
30
- val bs2 = " IO" .encodeToByteString()
31
-
32
- val bs = buildByteString {
33
- append(bs1)
34
- append(bs2)
35
- }
36
-
37
- return """
38
- |${Clock .System .now().toLocalDateTime(TimeZone .currentSystemDefault())}
39
- |${json.encodeToString(KData (" Bar" , 123 , " test" ))}
40
- |${bs.decodeToString()}
41
- """
42
- .trimMargin()
43
- }
44
- }
Original file line number Diff line number Diff line change
1
+ ### Run Web app
2
+
3
+ ``` bash
4
+ $ ./gradlew :web:jsBrowserProductionRun -t
5
+ ```
6
+
7
+ ### Resources
8
+
9
+ - [ Kotlin Multiplatform Package Search] ( https://package-search.jetbrains.com/search?query=http&onlyMpp=true )
10
+ - [ Compose Lint Rules] ( https://slackhq.github.io/compose-lints/rules/ )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ kotlinx.atomicfu.enableJsIrTransformation=true
22
22
23
23
# MPP
24
24
kotlin.mpp.enableCInteropCommonization =true
25
+ # kotlin.js.ir.output.granularity=whole-program
25
26
26
27
# Compose
27
28
org.jetbrains.compose.experimental.uikit.enabled =true
Original file line number Diff line number Diff line change 1308
1308
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
1309
1309
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
1310
1310
1311
+
1312
+ version "11.8.0"
1313
+ resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.8.0.tgz#966518ea83257bae2e7c9a48596231856555bb65"
1314
+ integrity sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==
1315
+
1311
1316
hpack.js@^2.1.6 :
1312
1317
version "2.1.6"
1313
1318
resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2"
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ junit = "5.10.0-RC1"
47
47
ktor = " 2.3.2"
48
48
koin = " 3.4.1"
49
49
kotest = " 5.6.2"
50
- ksp-auto-service = " 1.0 .0"
50
+ ksp-auto-service = " 1.1 .0"
51
51
ksp-redacted = " 1.6.0"
52
52
ksp-powerassert = " 0.13.0"
53
53
slf4j = " 2.0.7"
Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ dependencies {
27
27
28
28
jsMainImplementation(projects.common)
29
29
jsMainImplementation(libs.kotlinx.html)
30
+ jsMainImplementation(npm(" highlight.js" , " 11.8.0" ))
30
31
// jsMainImplementation(npm("kotlin-playground", "1.28.0"))
31
- // jsMainImplementation(npm("highlight.js", "11.8.0"))
32
32
// jsMainImplementation(npm("xterm", "5.2.1"))
33
33
// jsMainImplementation(npm("vega-lite", "5.13.0"))
34
34
}
Original file line number Diff line number Diff line change @@ -10,22 +10,26 @@ import kotlinx.html.div
10
10
import kotlinx.html.dom.append
11
11
import kotlinx.html.dom.create
12
12
import kotlinx.html.progress
13
+ import org.w3c.dom.HTMLDivElement
13
14
import org.w3c.dom.HTMLProgressElement
14
15
import org.w3c.dom.Node
15
16
16
17
suspend fun main () {
17
18
val text = Greeting ().greeting()
18
- val root = document.getElementById(" root" )
19
+ val root = document.getElementById(" root" ) as HTMLDivElement
19
20
20
21
text.lines().forEach {
21
22
println (it)
22
- root? .appendText(it)
23
- root? .appendChild(document.createElement(" br" ))
23
+ root.appendText(it)
24
+ root.appendChild(document.createElement(" br" ))
24
25
}
25
26
27
+ // HighlightJs.highlightElement(root)
28
+
29
+ // Javascript Promise
26
30
delay(1 .seconds)
27
31
val promise = Promise .resolve(" Promise" )
28
- root? .appendText(promise.await())
32
+ root.appendText(promise.await())
29
33
30
34
topLevelJsFun()
31
35
runCoroutines()
Original file line number Diff line number Diff line change 35
35
href ="
https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected] ,100..700,0..1,-50..200 "
/>
36
36
37
37
<!-- HighlightJS styles -->
38
- <!-- < link class="codestyle" rel="stylesheet" href="css/hljs/github.min.css">-- >
38
+ < link class ="codestyle " rel ="stylesheet " href ="css/hljs/github.min.css ">
39
39
<!-- <link class="codestyle" rel="prefetch alternate stylesheet" href="css/hljs/github-dark.min.css">-->
40
40
41
41
<!-- Style for XTerm terminal -->
@@ -85,7 +85,7 @@ <h1 class="title">
85
85
86
86
< div class ="card ">
87
87
< div class ="card-content ">
88
- < div id ="root "> </ div >
88
+ < div id ="root " class =" language-json " > </ div >
89
89
</ div >
90
90
</ div >
91
91
</ div >
@@ -104,7 +104,8 @@ <h1 class="title">
104
104
< hr >
105
105
< p class ="subtitle ">
106
106
< a href ="https://kotlinlang.org/docs/coroutines-guide.html "> Kotlin Coroutines</ a > demo.
107
- Click on progressBar to < mark > cancel</ mark >
107
+ Click on progress bar to
108
+ < mark > cancel</ mark >
108
109
</ p >
109
110
110
111
< div class ="box " id ="coroutines ">
You can’t perform that action at this time.
0 commit comments