Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Kotlin/kotlinx.html
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.11.0
Choose a base ref
...
head repository: Kotlin/kotlinx.html
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.12.0
Choose a head ref
Loading
Showing with 7,380 additions and 3,242 deletions.
  1. +15 −0 .github/workflows/auto-assign.yml
  2. +16 −6 .github/workflows/gradle.yml
  3. +1 −0 .gitignore
  4. +44 −20 README.md
  5. +609 −343 api/kotlinx-html.api
  6. +46 −86 build.gradle.kts
  7. +2 −3 buildSrc/build.gradle.kts
  8. +8 −11 buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt
  9. +14 −3 buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt
  10. +21 −9 buildSrc/src/main/kotlin/kotlinx/html/generate/enums.kt
  11. +2 −1 buildSrc/src/main/kotlin/kotlinx/html/generate/humanizer.kt
  12. +29 −39 buildSrc/src/main/kotlin/kotlinx/html/generate/main.kt
  13. +9 −1 buildSrc/src/main/kotlin/kotlinx/html/generate/model.kt
  14. +1 −1 buildSrc/src/main/kotlin/kotlinx/html/generate/parent-ifaces-gen.kt
  15. +50 −12 buildSrc/src/main/kotlin/kotlinx/html/generate/rules.kt
  16. +3 −3 buildSrc/src/main/kotlin/kotlinx/html/generate/tag-builders.kt
  17. +163 −81 buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt
  18. +59 −15 buildSrc/src/main/kotlin/kotlinx/html/generate/xsdparser.kt
  19. +130 −9 buildSrc/src/main/resources/html_5.xsd
  20. +0 −2 gradle.properties
  21. +1 −1 gradle/wrapper/gradle-wrapper.properties
  22. +291 −248 kotlin-js-store/yarn.lock
  23. +304 −278 src/commonMain/kotlin/generated/gen-attr-traits.kt
  24. +6 −0 src/commonMain/kotlin/generated/gen-attributes.kt
  25. +722 −236 src/commonMain/kotlin/generated/gen-consumer-tags.kt
  26. +285 −190 src/commonMain/kotlin/generated/gen-enums.kt
  27. +6 −0 src/commonMain/kotlin/generated/gen-parent-traits.kt
  28. +155 −27 src/commonMain/kotlin/generated/gen-tag-groups.kt
  29. +705 −114 src/commonMain/kotlin/generated/gen-tag-unions.kt
  30. +64 −41 src/commonMain/kotlin/generated/gen-tags-a.kt
  31. +58 −55 src/commonMain/kotlin/generated/gen-tags-b.kt
  32. +28 −21 src/commonMain/kotlin/generated/gen-tags-c.kt
  33. +29 −10 src/commonMain/kotlin/generated/gen-tags-d.kt
  34. +11 −8 src/commonMain/kotlin/generated/gen-tags-e.kt
  35. +40 −25 src/commonMain/kotlin/generated/gen-tags-f.kt
  36. +66 −21 src/commonMain/kotlin/generated/gen-tags-h.kt
  37. +96 −93 src/commonMain/kotlin/generated/gen-tags-i.kt
  38. +15 −12 src/commonMain/kotlin/generated/gen-tags-k.kt
  39. +27 −20 src/commonMain/kotlin/generated/gen-tags-l.kt
  40. +25 −22 src/commonMain/kotlin/generated/gen-tags-m.kt
  41. +3 −0 src/commonMain/kotlin/generated/gen-tags-n.kt
  42. +56 −41 src/commonMain/kotlin/generated/gen-tags-o.kt
  43. +32 −13 src/commonMain/kotlin/generated/gen-tags-p.kt
  44. +5 −2 src/commonMain/kotlin/generated/gen-tags-q.kt
  45. +13 −2 src/commonMain/kotlin/generated/gen-tags-r.kt
  46. +91 −57 src/commonMain/kotlin/generated/gen-tags-s.kt
  47. +131 −57 src/commonMain/kotlin/generated/gen-tags-t.kt
  48. +8 −1 src/commonMain/kotlin/generated/gen-tags-u.kt
  49. +24 −17 src/commonMain/kotlin/generated/gen-tags-v.kt
  50. +6 −9 src/commonMain/kotlin/measure-consumer.kt
  51. +10 −15 src/commonMain/kotlin/stream.kt
  52. +1 −1 src/commonMain/kotlin/trace-consumer.kt
  53. +0 −2 src/commonMain/kotlin/util.kt
  54. +52 −2 src/commonTest/kotlin/AttributesTest.kt
  55. +29 −15 src/jsMain/kotlin/dom-js.kt
  56. +723 −252 src/jsMain/kotlin/generated/gen-consumer-tags-js.kt
  57. +385 −0 src/jsMain/kotlin/generated/gen-event-attrs-js.kt
  58. +0 −5 src/jsMain/kotlin/utilsImpl-js.kt
  59. +122 −112 src/jsTest/kotlin/generated/gen-tag-tests.kt
  60. +5 −6 src/jsTest/kotlin/injector.kt
  61. +70 −25 src/jsTest/kotlin/trees.kt
  62. +49 −31 src/jvmMain/kotlin/dom-jvm.kt
  63. +0 −3 src/jvmMain/kotlin/utilsImpl-jvm.kt
  64. +0 −1 src/jvmTest/kotlin/custom-tag.kt
  65. +49 −20 src/jvmTest/kotlin/dom-trees.kt
  66. +2 −3 src/jvmTest/kotlin/html5-tags.kt
  67. +2 −2 src/jvmTest/kotlin/huge.kt
  68. +59 −58 src/jvmTest/kotlin/streaming.kt
  69. +1 −2 src/jvmTest/kotlin/unsafe.kt
  70. +0 −13 src/nativeMain/kotlin/utilNative.kt
  71. +17 −11 src/wasmJsMain/kotlin/dom-js.kt
  72. +723 −251 src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt
  73. +385 −0 src/wasmJsMain/kotlin/generated/gen-event-attrs-wasm-js.kt
  74. +0 −8 src/wasmJsMain/kotlin/utilsImpl-js.kt
  75. +122 −112 src/wasmJsTest/kotlin/generated/gen-tag-tests.kt
  76. +5 −6 src/wasmJsTest/kotlin/injector.kt
  77. +36 −20 src/wasmJsTest/kotlin/trees.kt
  78. +8 −0 src/wasmWasiMain/kotlin/Event.wasmWasi.kt
15 changes: 15 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Assign Reviewer to PR

on:
pull_request:
types: [opened]

jobs:
assign-reviewer:
runs-on: ubuntu-latest
steps:
- name: Assign reviewer
uses: kentaro-m/auto-assign-action@v2.0.0
with:
reviewers: 'e5l'
repo-token: '${{ secrets.GITHUB_TOKEN }}'
22 changes: 16 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -22,17 +22,27 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

name: Build on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}
strategy:
fail-fast: false
matrix:
os:
- runner: windows-latest
shell: msys2 {0}
- runner: ubuntu-latest
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4.2.1
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
uses: gradle/actions/setup-gradle@v3.3.2
with:
arguments: jvmTest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
target
build
.gradle
.kotlin
*~
*.versionsBackup
**/karma/node_modules
64 changes: 44 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,65 @@
[![Kotlin Stable](https://kotl.in/badges/stable.svg)](https://kotlinlang.org/docs/components-stability.html)
[![Official JetBrains Project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-green.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![TeamCity (simple build status)](https://teamcity.jetbrains.com/app/rest/builds/aggregated/strob:\(branch:\(buildType:\(id:KotlinTools_KotlinxHtml_BuildGradleMasterBranch\),policy:active_history_and_active_vcs_branches\),locator:\(buildType:\(id:KotlinTools_KotlinxHtml_BuildGradleMasterBranch\)\)\)/statusIcon.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=KotlinTools_KotlinxHtml_BuildGradleMasterBranch&branch_Kotlin_KotlinX=%3Cdefault%3E&tab=buildTypeStatusDiv&guest=1)
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.0-blue.svg?logo=kotlin)](http://kotlinlang.org)

# kotlinx.html

A kotlinx.html library provides DSL to build HTML to [Writer](https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html)/[Appendable](https://docs.oracle.com/javase/8/docs/api/java/lang/Appendable.html) or DOM. Available to all Kotlin Multiplatform targets and browser(or other JavaScript engine) for better [Kotlin programming](https://kotlinlang.org) for Web.
The kotlinx.html library provides a DSL
to build HTML
to [Writer](https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html)/[Appendable](https://docs.oracle.com/javase/8/docs/api/java/lang/Appendable.html)
or DOM.
Available to all Kotlin Multiplatform targets and browsers (or other WasmJS or JavaScript engines)
for better [Kotlin programming](https://kotlinlang.org) for Web.

# Get started

See [Getting started](https://github.com/kotlin/kotlinx.html/wiki/Getting-started) page for details how to include the library.
See [Getting started](https://github.com/kotlin/kotlinx.html/wiki/Getting-started) page for details how to include the
library.

# DOM
You can build DOM tree with JVM and JS naturally

See example for JavaScript-targeted Kotlin
You can build a DOM tree with JVM, JS, and WASM.
The following example shows how to build the DOM for WasmJs-targeted Kotlin:

```kotlin
window.setInterval({
val myDiv = document.create.div("panel") {
p {
+"Here is "
a("https://kotlinlang.org") { +"official Kotlin site" }
}
}

document.getElementById("container")!!.appendChild(myDiv)
import kotlinx.browser.document
import kotlinx.browser.window
import kotlinx.html.a
import kotlinx.html.div
import kotlinx.html.dom.append
import kotlinx.html.dom.create
import kotlinx.html.p

document.getElementById("container")!!.append {
fun main() {
val body = document.body ?: error("No body")
body.append {
div {
+"added it"
p {
+"Here is "
a("https://kotlinlang.org") { +"official Kotlin site" }
}
}
}
}, 1000L)

val timeP = document.create.p {
+"Time: 0"
}

body.append(timeP)

var time = 0
window.setInterval({
time++
timeP.textContent = "Time: $time"

return@setInterval null
}, 1000)
}
```

# Stream

You can build HTML directly to Writer (JVM) or Appendable (Multiplatform)

```kotlin
@@ -56,6 +79,7 @@ System.out.appendHTML().html {

See [wiki](https://github.com/kotlin/kotlinx.html/wiki) pages

# Building
See [development](https://github.com/kotlin/kotlinx.html/wiki/Development) page for details.
# Building

See the [development](https://github.com/kotlin/kotlinx.html/wiki/Development) page for details.

Loading