mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2026-09-01 13:59:29 +00:00
Compare commits
14 Commits
19f3a59a79
...
v0.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
| fad48715b4 | |||
| f6bfef4b89 | |||
| 432a5744b3 | |||
| 5dff8d69f2 | |||
| e6ebc70578 | |||
| 0eba5d10f7 | |||
| ffb7f41328 | |||
| 77dabb5553 | |||
| 8c086eb3eb | |||
| 0d55505e09 | |||
| eefdb5fda1 | |||
| 0c281aa653 | |||
| 17ae0b119b | |||
| 36214aeba5 |
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
@@ -1,15 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 11
|
|
||||||
- name: Build with Gradle
|
|
||||||
run: ./gradlew build
|
|
||||||
26
.github/workflows/build_and_publish.yml
vendored
Normal file
26
.github/workflows/build_and_publish.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 11
|
||||||
|
- name: Rewrite version
|
||||||
|
run: |
|
||||||
|
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||||
|
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||||
|
rm gradle.properties
|
||||||
|
mv gradle.properties.tmp gradle.properties
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew build
|
||||||
|
- name: Publish
|
||||||
|
continue-on-error: true
|
||||||
|
run: ./gradlew publishAllPublicationsToGiteaRepository
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.4.3
|
||||||
|
|
||||||
|
* Add opportunity to now show dialog automatically
|
||||||
|
|
||||||
|
## 0.4.2
|
||||||
|
|
||||||
|
* `Compose`: `1.2.2`
|
||||||
|
|
||||||
|
## 0.4.1
|
||||||
|
|
||||||
|
* Now it is possible to use `StandardInput` with simple `T` types instead of states
|
||||||
|
* `List` may accept any `Iterable`
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
* `Kotlin`: `1.7.20`
|
* `Kotlin`: `1.7.20`
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.4.0
|
version=0.4.3
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kt = "1.7.20"
|
kt = "1.7.20"
|
||||||
jb-compose = "1.2.1"
|
jb-compose = "1.2.2"
|
||||||
jb-dokka = "1.7.20"
|
jb-dokka = "1.7.20"
|
||||||
gh-release = "2.4.1"
|
gh-release = "2.4.1"
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,32 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
|
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
||||||
|
maven {
|
||||||
|
name = "GITEA"
|
||||||
|
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
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')
|
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"}}}
|
{"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":"GITEA","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -36,6 +36,7 @@ fun Dialog(
|
|||||||
footerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
|
footerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
|
||||||
footerBuilder: ContentBuilder<HTMLDivElement>? = null,
|
footerBuilder: ContentBuilder<HTMLDivElement>? = null,
|
||||||
bodyAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
|
bodyAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
|
||||||
|
autoShow: Boolean = true,
|
||||||
bodyBuilder: ContentBuilder<HTMLDivElement>
|
bodyBuilder: ContentBuilder<HTMLDivElement>
|
||||||
) {
|
) {
|
||||||
Div(
|
Div(
|
||||||
@@ -99,7 +100,9 @@ fun Dialog(
|
|||||||
}
|
}
|
||||||
htmlElement.addEventListener("hidden", wrapper)
|
htmlElement.addEventListener("hidden", wrapper)
|
||||||
|
|
||||||
UIKit.modal("#${htmlElement.id}") ?.show()
|
if (autoShow) {
|
||||||
|
UIKit.modal("#${htmlElement.id}") ?.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,6 +115,7 @@ fun Dialog(
|
|||||||
hidden: (() -> Unit)? = null,
|
hidden: (() -> Unit)? = null,
|
||||||
footerBuilder: (@Composable () -> Unit)? = null,
|
footerBuilder: (@Composable () -> Unit)? = null,
|
||||||
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
||||||
|
autoShow: Boolean = true,
|
||||||
bodyBuilder: @Composable () -> Unit
|
bodyBuilder: @Composable () -> Unit
|
||||||
) = Dialog(
|
) = Dialog(
|
||||||
modifiers = modifiers,
|
modifiers = modifiers,
|
||||||
@@ -130,6 +134,7 @@ fun Dialog(
|
|||||||
attributesCustomizer = {
|
attributesCustomizer = {
|
||||||
attributesCustomizer()
|
attributesCustomizer()
|
||||||
},
|
},
|
||||||
|
autoShow = autoShow,
|
||||||
bodyBuilder = {
|
bodyBuilder = {
|
||||||
bodyBuilder()
|
bodyBuilder()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,60 +202,62 @@ sealed class Icon(val name: String) {
|
|||||||
object Youtube : Brands("youtube")
|
object Youtube : Brands("youtube")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
operator fun invoke(
|
|
||||||
vararg modifiers: UIKitModifier,
|
|
||||||
type: UIKitIconType = UIKitIconType.Default,
|
|
||||||
ratio: Float? = null,
|
|
||||||
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
|
||||||
onClick: ((Event) -> Unit)? = null
|
|
||||||
) {
|
|
||||||
val configurer: AttrBuilderContext<out HTMLElement> = {
|
|
||||||
include(*modifiers, type, UIKitIcon)
|
|
||||||
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
|
|
||||||
onClick ?.let { _ ->
|
|
||||||
onClick { onClick(it.nativeEvent) }
|
|
||||||
}
|
|
||||||
attributesCustomizer()
|
|
||||||
}
|
|
||||||
when (type) {
|
|
||||||
UIKitIconType.Default -> Span(configurer)
|
|
||||||
UIKitIconType.Link -> A(href = "#", configurer)
|
|
||||||
UIKitIconType.Button -> Button(configurer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Custom(name: String) : Icon(name)
|
class Custom(name: String) : Icon(name)
|
||||||
|
|
||||||
@Composable
|
companion object {
|
||||||
fun drawAsButton(
|
}
|
||||||
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)
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun drawAsIcon(
|
|
||||||
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)
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun drawAsLink(
|
|
||||||
vararg modifiers: UIKitModifier,
|
|
||||||
ratio: Float? = null,
|
|
||||||
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
|
||||||
onClick: ((Event) -> Unit)? = null
|
|
||||||
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun drawAsFormInputPart(
|
|
||||||
vararg modifiers: UIKitModifier,
|
|
||||||
ratio: Float? = null,
|
|
||||||
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
|
||||||
onClick: ((Event) -> Unit)? = null
|
|
||||||
) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
|
||||||
}
|
}
|
||||||
|
@Composable
|
||||||
|
operator fun Icon.invoke(
|
||||||
|
vararg modifiers: UIKitModifier,
|
||||||
|
type: UIKitIconType = UIKitIconType.Default,
|
||||||
|
ratio: Float? = null,
|
||||||
|
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||||
|
onClick: ((Event) -> Unit)? = null
|
||||||
|
) {
|
||||||
|
val configurer: AttrBuilderContext<out HTMLElement> = {
|
||||||
|
include(*modifiers, type, UIKitIcon)
|
||||||
|
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
|
||||||
|
onClick ?.let { _ ->
|
||||||
|
onClick { onClick(it.nativeEvent) }
|
||||||
|
}
|
||||||
|
attributesCustomizer()
|
||||||
|
}
|
||||||
|
when (type) {
|
||||||
|
UIKitIconType.Default -> Span(configurer)
|
||||||
|
UIKitIconType.Link -> A(href = "#", configurer)
|
||||||
|
UIKitIconType.Button -> Button(configurer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Icon.drawAsButton(
|
||||||
|
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)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Icon.drawAsIcon(
|
||||||
|
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)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Icon.drawAsLink(
|
||||||
|
vararg modifiers: UIKitModifier,
|
||||||
|
ratio: Float? = null,
|
||||||
|
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||||
|
onClick: ((Event) -> Unit)? = null
|
||||||
|
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Icon.drawAsFormInputPart(
|
||||||
|
vararg modifiers: UIKitModifier,
|
||||||
|
ratio: Float? = null,
|
||||||
|
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||||
|
onClick: ((Event) -> Unit)? = null
|
||||||
|
) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.w3c.dom.HTMLUListElement
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> List(
|
fun <T> List(
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
ukAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
|
ukAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
|
||||||
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -29,7 +29,7 @@ fun <T> List(
|
|||||||
@Composable
|
@Composable
|
||||||
fun <T> ListWithTitle(
|
fun <T> ListWithTitle(
|
||||||
title: String,
|
title: String,
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
vararg titleModifiers: UIKitModifier,
|
vararg titleModifiers: UIKitModifier,
|
||||||
ulModifiers: Array<UIKitModifier> = emptyArray(),
|
ulModifiers: Array<UIKitModifier> = emptyArray(),
|
||||||
besidesTitleAndList: (@Composable () -> Unit)? = null,
|
besidesTitleAndList: (@Composable () -> Unit)? = null,
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ import org.jetbrains.compose.web.dom.Input
|
|||||||
import org.w3c.dom.HTMLInputElement
|
import org.w3c.dom.HTMLInputElement
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> StandardInput(
|
fun <T> DefaultInput(
|
||||||
type: InputType<T>,
|
type: InputType<T>,
|
||||||
state: MutableState<T>,
|
value: T,
|
||||||
disabledState: State<Boolean>? = null,
|
disabled: Boolean = false,
|
||||||
placeholder: String? = null,
|
placeholder: String? = null,
|
||||||
vararg modifiers: UIKitModifier,
|
vararg modifiers: UIKitModifier,
|
||||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||||
|
onChange: (T) -> Unit
|
||||||
) {
|
) {
|
||||||
Input(type) {
|
Input(type) {
|
||||||
classes("uk-input")
|
classes("uk-input")
|
||||||
@@ -23,7 +24,7 @@ fun <T> StandardInput(
|
|||||||
|
|
||||||
placeholder ?.let(::placeholder)
|
placeholder ?.let(::placeholder)
|
||||||
|
|
||||||
state.value.let {
|
value.let {
|
||||||
when (it) {
|
when (it) {
|
||||||
is String -> value(it)
|
is String -> value(it)
|
||||||
is Number -> value(it)
|
is Number -> value(it)
|
||||||
@@ -31,13 +32,30 @@ fun <T> StandardInput(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onInput { state.value = it.value }
|
onInput { onChange(it.value) }
|
||||||
|
|
||||||
disabledState ?.let {
|
if (disabled) {
|
||||||
if (it.value) {
|
disabled()
|
||||||
disabled()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
attributesCustomizer()
|
attributesCustomizer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun <T> StandardInput(
|
||||||
|
type: InputType<T>,
|
||||||
|
state: MutableState<T>,
|
||||||
|
disabledState: State<Boolean>? = null,
|
||||||
|
placeholder: String? = null,
|
||||||
|
vararg modifiers: UIKitModifier,
|
||||||
|
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||||
|
) = DefaultInput(
|
||||||
|
type,
|
||||||
|
state.value,
|
||||||
|
disabledState ?.value == true,
|
||||||
|
placeholder,
|
||||||
|
modifiers = modifiers,
|
||||||
|
attributesCustomizer = attributesCustomizer
|
||||||
|
) {
|
||||||
|
state.value = it
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user