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 ## 0.0.7
Rewrite project onto multiplatform paradigm and return back varargs instead of most `Array<UIKitModifier>`
## 0.0.6 ## 0.0.6
Changes in signatures of text field and list Changes in signatures of text field and list

View File

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

View File

@ -18,5 +18,5 @@ buildscript-gh-release = { module = "com.github.breadmoirai:github-release", ver
[plugins] [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" } jb-compose = { id = "org.jetbrains.compose", version.ref = "jb-compose" }

View File

@ -1,72 +1,57 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
task javadocJar(type: Jar) { task javadocsJar(type: Jar) {
classifier = 'javadoc' classifier = 'javadoc'
} }
task sourcesJar(type: Jar) {
kotlin.sourceSets.all {
from(kotlin)
}
classifier = 'sources'
}
publishing { publishing {
publications { publications.all {
maven(MavenPublication) { artifact javadocsJar
kotlin.js().components.forEach {
from(it) 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 developers {
artifact sourcesJar
developer {
pom { id = "InsanusMokrassar"
resolveStrategy = Closure.DELEGATE_FIRST 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)) { licenses {
maven {
name = "sonatype" license {
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") name = "Apache Software License 2.0"
credentials { url = "https://opensource.org/licenses/Apache-2.0"
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')
} }
}
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')
} }
} }
} }
} }
} }
} }
if (project.hasProperty("signing.gnupg.keyName")) { if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing' apply plugin: 'signing'

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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