now project is multiplatform and correctly working

This commit is contained in:
InsanusMokrassar 2022-01-13 19:56:39 +06:00
parent 5880db3db1
commit 0beb781e2c
46 changed files with 92 additions and 98 deletions

View File

@ -1,5 +1,7 @@
## 0.0.7
Rewrite project onto multiplatform paradigm and return back varargs instead of most `Array<UIKitModifier>`
## 0.0.6
Changes in signatures of text field and list

View File

@ -15,35 +15,44 @@ buildscript {
}
plugins {
alias(libs.plugins.kt.js)
alias(libs.plugins.kt.multiplatform)
alias(libs.plugins.jb.compose)
}
project.version = "$version"
project.group = "$group"
allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
}
repositories {
mavenLocal()
mavenCentral()
google()
}
kotlin {
js(IR) {
browser()
binaries.executable()
}
}
sourceSets {
commonMain {
dependencies {
implementation libs.kt.stdlib
implementation compose.runtime
}
}
jsMain {
dependencies {
implementation compose.web.core
}
}
dependencies {
implementation libs.kt.stdlib
implementation compose.web.core
implementation compose.runtime
testImplementation libs.kt.test.js
testImplementation libs.kt.test.junit
jsTest {
dependencies {
implementation libs.kt.test.js
implementation libs.kt.test.junit
}
}
}
}
apply from: "./github_release.gradle"

View File

@ -18,5 +18,5 @@ buildscript-gh-release = { module = "com.github.breadmoirai:github-release", ver
[plugins]
kt-js = { id = "org.jetbrains.kotlin.js", version.ref = "kt" }
kt-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kt" }
jb-compose = { id = "org.jetbrains.compose", version.ref = "jb-compose" }

View File

@ -1,65 +1,50 @@
apply plugin: 'maven-publish'
task javadocJar(type: Jar) {
task javadocsJar(type: Jar) {
classifier = 'javadoc'
}
task sourcesJar(type: Jar) {
kotlin.sourceSets.all {
from(kotlin)
}
classifier = 'sources'
}
publishing {
publications {
maven(MavenPublication) {
kotlin.js().components.forEach {
from(it)
publications.all {
artifact javadocsJar
pom {
description = "${project.name}"
name = "${project.name}"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
}
artifact javadocJar
artifact sourcesJar
developers {
pom {
resolveStrategy = Closure.DELEGATE_FIRST
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
description = "${project.name}"
name = "${project.name}"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
}
developers {
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
}
licenses {
license {
name = "Apache Software License 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
repositories {
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
licenses {
license {
name = "Apache Software License 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
repositories {
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
}
}

View File

@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JS"}
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}

View File

@ -12,7 +12,7 @@ import org.w3c.dom.events.Event
@Composable
fun DefaultButton(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
onClick: ((SyntheticMouseEvent) -> Unit)? = null,
@ -37,14 +37,14 @@ fun DefaultButton(
@Composable
fun DefaultButton(
text: String,
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
preTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
afterTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
onClick: ((SyntheticMouseEvent) -> Unit)? = null
) = DefaultButton(modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick, attributesCustomizer = attributesCustomizer) {
) = DefaultButton(*modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick, attributesCustomizer = attributesCustomizer) {
preTextContentAllocator ?.apply { preTextContentAllocator() }
Text(text)
afterTextContentAllocator ?.apply { afterTextContentAllocator() }
@ -53,7 +53,7 @@ fun DefaultButton(
@Composable
fun UploadButton(
text: String,
buttonModifiers: Array<UIKitModifier> = emptyArray(),
vararg buttonModifiers: UIKitModifier,
containerModifiers: Array<UIKitModifier> = emptyArray(),
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,

View File

@ -26,7 +26,7 @@ private class DialogDisposableEffectResult(
@Composable
fun Dialog(
title: String? = null,
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
hide: (() -> Unit)? = null,
hidden: (() -> Unit)? = null,
footerBuilder: (@Composable () -> Unit)? = null,

View File

@ -9,7 +9,7 @@ import org.w3c.dom.HTMLDivElement
@Composable
fun Dropdown(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
toggle: String? = null,
pos: UIKitDropdown.Position? = null,
mode: UIKitDropdown.Mode? = null,

View File

@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
@Composable
fun Flex(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
filler: @Composable ElementScope<HTMLDivElement>.() -> Unit
) {

View File

@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
@Composable
fun GridColumn(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
) {
@ -24,7 +24,7 @@ fun GridColumn(
@Composable
fun Grid(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
masonry: Boolean = false,
parallax: Int? = null,
marginClass: String? = null,

View File

@ -204,7 +204,7 @@ sealed class Icon(val name: String) {
@Composable
operator fun invoke(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
type: UIKitIconType = UIKitIconType.Default,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
@ -228,17 +228,17 @@ sealed class Icon(val name: String) {
@Composable
fun drawAsButton(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
) = invoke(*modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun drawAsIcon(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
}

View File

@ -10,9 +10,9 @@ sealed interface Label {
val suffix: String
@Composable
operator fun invoke(
fun draw(
text: String,
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLSpanElement> = {},
) = Span(
{

View File

@ -12,7 +12,7 @@ import org.w3c.dom.HTMLUListElement
fun <T> List(
title: String,
data: SnapshotStateList<T>,
titleModifiers: Array<UIKitModifier> = emptyArray(),
vararg titleModifiers: UIKitModifier,
ulModifiers: Array<UIKitModifier> = emptyArray(),
besidesTitleAndList: (@Composable () -> Unit)? = null,
titleCustomizer: AttrBuilderContext<HTMLHeadingElement> = {},

View File

@ -10,7 +10,7 @@ import org.w3c.dom.HTMLUListElement
@Composable
fun Nav(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
@ -37,7 +37,7 @@ fun Nav(
@Composable
fun NavElement(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
contentAllocator: ContentBuilder<HTMLLIElement>
) {

View File

@ -11,7 +11,7 @@ fun Navbar(
leftBuilder: NavbarNavBuilder? = null,
centerBuilder: NavbarNavBuilder? = null,
rightBuilder: NavbarNavBuilder? = null,
navModifiers: Array<UIKitModifier> = emptyArray(),
vararg navModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLElement> = {},
) {
Nav(

View File

@ -10,7 +10,7 @@ import org.w3c.dom.HTMLProgressElement
@Composable
fun Progress(
value: Int,
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
max: Int = 100,
attributesCustomizer: AttrBuilderContext<HTMLProgressElement> = {}
) {

View File

@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
@Composable
fun Spinner(
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {}
) {
@ -23,6 +23,4 @@ fun Spinner(
}
@Composable
fun DefaultSpinner() = Spinner(
arrayOf(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Center)
)
fun DefaultSpinner() = Spinner(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Center)

View File

@ -11,7 +11,7 @@ import org.w3c.dom.HTMLTableElement
fun <T> DefaultTable(
heading: List<String>,
dataList: SnapshotStateList<T>,
tableModifiers: Array<UIKitModifier> = emptyArray(),
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
cellFiller: @Composable (i: Int, t: T) -> Unit
) {

View File

@ -14,7 +14,7 @@ fun <T> TextField(
state: MutableState<T>,
disabledState: State<Boolean>? = null,
placeholder: String? = null,
modifiers: Array<UIKitModifier> = emptyArray(),
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
) {
Input(type) {