mirror of
https://github.com/InsanusMokrassar/KotlinPublicationScriptsBuilder.git
synced 2024-11-24 11:08:52 +00:00
complete rework
This commit is contained in:
parent
8430e68167
commit
9fe7c458e9
@ -74,6 +74,7 @@ class MavenInfoView : VerticalView("Project information") {
|
|||||||
) { projectVcsUrlProperty = it }
|
) { projectVcsUrlProperty = it }
|
||||||
|
|
||||||
ButtonsPanel(
|
ButtonsPanel(
|
||||||
|
"Gpg signing",
|
||||||
GpgSigning.Disabled,
|
GpgSigning.Disabled,
|
||||||
GpgSigning.Optional,
|
GpgSigning.Optional,
|
||||||
GpgSigning.Enabled
|
GpgSigning.Enabled
|
||||||
|
@ -20,6 +20,7 @@ class ProjectTypeView : VerticalView("Project type") {
|
|||||||
|
|
||||||
override val content: @Composable () -> Unit = {
|
override val content: @Composable () -> Unit = {
|
||||||
ButtonsPanel(
|
ButtonsPanel(
|
||||||
|
"Project type",
|
||||||
MultiplatformProjectType,
|
MultiplatformProjectType,
|
||||||
JVMProjectType,
|
JVMProjectType,
|
||||||
JSProjectType
|
JSProjectType
|
||||||
|
@ -27,15 +27,17 @@ expect fun SwitchWithLabel(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
expect fun <T> ButtonsPanel(
|
expect fun <T> ButtonsPanel(
|
||||||
|
title: String,
|
||||||
data: Iterable<T>,
|
data: Iterable<T>,
|
||||||
itemDrawer: @Composable (T) -> Unit
|
itemDrawer: @Composable (T) -> Unit
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> ButtonsPanel(
|
fun <T> ButtonsPanel(
|
||||||
|
title: String,
|
||||||
vararg data: T,
|
vararg data: T,
|
||||||
itemDrawer: @Composable (T) -> Unit
|
itemDrawer: @Composable (T) -> Unit
|
||||||
) = ButtonsPanel(data.toList(), itemDrawer)
|
) = ButtonsPanel(title, data.toList(), itemDrawer)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
expect fun DefaultDivider()
|
expect fun DefaultDivider()
|
||||||
|
@ -4,8 +4,10 @@ import androidx.compose.runtime.Composable
|
|||||||
import dev.inmo.jsuikit.elements.DefaultButton
|
import dev.inmo.jsuikit.elements.DefaultButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitButton
|
import dev.inmo.jsuikit.modifiers.UIKitButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.GpgSigning
|
import dev.inmo.kmppscriptbuilder.core.models.GpgSigning
|
||||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
||||||
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.NoTransform
|
||||||
|
|
||||||
actual class GpgSigningOptionDrawer(
|
actual class GpgSigningOptionDrawer(
|
||||||
private val mavenInfoView: MavenInfoView
|
private val mavenInfoView: MavenInfoView
|
||||||
@ -13,9 +15,9 @@ actual class GpgSigningOptionDrawer(
|
|||||||
@Composable
|
@Composable
|
||||||
override fun GpgSigning.draw() {
|
override fun GpgSigning.draw() {
|
||||||
if (mavenInfoView.gpgSignProperty == this) {
|
if (mavenInfoView.gpgSignProperty == this) {
|
||||||
DefaultButton(name, UIKitButton.Type.Primary)
|
DefaultButton(name, UIKitButton.Type.Primary, UIKitMargin.Small.Horizontal, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded)
|
||||||
} else {
|
} else {
|
||||||
DefaultButton(name, UIKitButton.Type.Default) {
|
DefaultButton(name, UIKitButton.Type.Default, UIKitMargin.Small.Horizontal, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded) {
|
||||||
mavenInfoView.gpgSignProperty = this
|
mavenInfoView.gpgSignProperty = this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,12 @@ import dev.inmo.jsuikit.elements.DefaultButton
|
|||||||
import dev.inmo.jsuikit.elements.Divider
|
import dev.inmo.jsuikit.elements.Divider
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitButton
|
import dev.inmo.jsuikit.modifiers.UIKitButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||||
import dev.inmo.jsuikit.modifiers.builder
|
import dev.inmo.jsuikit.modifiers.builder
|
||||||
import dev.inmo.jsuikit.utils.Attrs
|
import dev.inmo.jsuikit.utils.Attrs
|
||||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.CommonTextField
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.CommonTextField
|
||||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
||||||
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.NoTransform
|
||||||
import org.jetbrains.compose.web.dom.Div
|
import org.jetbrains.compose.web.dom.Div
|
||||||
|
|
||||||
actual object LicensesDrawer : Drawer<LicensesView> {
|
actual object LicensesDrawer : Drawer<LicensesView> {
|
||||||
@ -32,7 +34,7 @@ actual object LicensesDrawer : Drawer<LicensesView> {
|
|||||||
Divider.Common()
|
Divider.Common()
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultButton("Add empty license", UIKitButton.Type.Primary, UIKitMargin.Small) {
|
DefaultButton("Add empty license", UIKitButton.Type.Primary, UIKitMargin.Small, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded) {
|
||||||
licensesListState.add(LicenseState())
|
licensesListState.add(LicenseState())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ actual object LicensesDrawer : Drawer<LicensesView> {
|
|||||||
license.url ?: "",
|
license.url ?: "",
|
||||||
"License URL",
|
"License URL",
|
||||||
) { license.url = it }
|
) { license.url = it }
|
||||||
DefaultButton("Remove", UIKitButton.Type.Danger, UIKitMargin.Small) {
|
DefaultButton("Remove", UIKitButton.Type.Default, UIKitMargin.Small, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded) {
|
||||||
licensesListState.remove(license)
|
licensesListState.remove(license)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,20 @@ import androidx.compose.runtime.Composable
|
|||||||
import dev.inmo.jsuikit.elements.DefaultButton
|
import dev.inmo.jsuikit.elements.DefaultButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitButton
|
import dev.inmo.jsuikit.modifiers.UIKitButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||||
import dev.inmo.jsuikit.modifiers.builder
|
import dev.inmo.jsuikit.modifiers.builder
|
||||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
||||||
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.NoTransform
|
||||||
import org.jetbrains.compose.web.dom.Div
|
import org.jetbrains.compose.web.dom.Div
|
||||||
|
|
||||||
actual class ListViewDrawer<T> : Drawer<ListView<T>> {
|
actual class ListViewDrawer<T> : Drawer<ListView<T>> {
|
||||||
@Composable
|
@Composable
|
||||||
override fun ListView<T>.draw() {
|
override fun ListView<T>.draw() {
|
||||||
DefaultButton(addItemText, UIKitButton.Type.Primary ) { itemsList.add(createItem()) }
|
DefaultButton(addItemText, UIKitButton.Type.Primary, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded ) { itemsList.add(createItem()) }
|
||||||
itemsList.forEach { item ->
|
itemsList.forEach { item ->
|
||||||
Div(UIKitMargin.Small.builder()) {
|
Div(UIKitMargin.Small.builder()) {
|
||||||
buildView(item)
|
buildView(item)
|
||||||
DefaultButton(removeItemText, UIKitButton.Type.Danger, UIKitMargin.Small) {
|
DefaultButton(removeItemText, UIKitButton.Type.Default, UIKitMargin.Small, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded) {
|
||||||
itemsList.remove(item)
|
itemsList.remove(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,11 @@ import androidx.compose.runtime.Composable
|
|||||||
import dev.inmo.jsuikit.elements.DefaultButton
|
import dev.inmo.jsuikit.elements.DefaultButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitButton
|
import dev.inmo.jsuikit.modifiers.UIKitButton
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
import dev.inmo.jsuikit.modifiers.UIKitMargin
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitText
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||||
import dev.inmo.kmppscriptbuilder.core.models.ProjectType
|
import dev.inmo.kmppscriptbuilder.core.models.ProjectType
|
||||||
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.Drawer
|
||||||
|
import dev.inmo.kmppscriptbuilder.core.ui.utils.NoTransform
|
||||||
|
|
||||||
actual class ProjectTypeDrawer(
|
actual class ProjectTypeDrawer(
|
||||||
private val projectTypeView: ProjectTypeView
|
private val projectTypeView: ProjectTypeView
|
||||||
@ -13,9 +16,9 @@ actual class ProjectTypeDrawer(
|
|||||||
@Composable
|
@Composable
|
||||||
override fun ProjectType.draw() {
|
override fun ProjectType.draw() {
|
||||||
if (projectTypeView.projectType == this) {
|
if (projectTypeView.projectType == this) {
|
||||||
DefaultButton(name, UIKitButton.Type.Primary)
|
DefaultButton(name, UIKitButton.Type.Primary, UIKitMargin.Small.Horizontal, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded)
|
||||||
} else {
|
} else {
|
||||||
DefaultButton(name, UIKitButton.Type.Default) {
|
DefaultButton(name, UIKitButton.Type.Default, UIKitMargin.Small.Horizontal, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded) {
|
||||||
projectTypeView.projectType = this
|
projectTypeView.projectType = this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import dev.inmo.jsuikit.elements.Icon
|
|||||||
import dev.inmo.jsuikit.elements.Label
|
import dev.inmo.jsuikit.elements.Label
|
||||||
import dev.inmo.jsuikit.elements.drawAsFormInputPart
|
import dev.inmo.jsuikit.elements.drawAsFormInputPart
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitButton
|
import dev.inmo.jsuikit.modifiers.UIKitButton
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitCustom
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitFlex
|
import dev.inmo.jsuikit.modifiers.UIKitFlex
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitForm
|
import dev.inmo.jsuikit.modifiers.UIKitForm
|
||||||
import dev.inmo.jsuikit.modifiers.UIKitInverse
|
import dev.inmo.jsuikit.modifiers.UIKitInverse
|
||||||
@ -18,6 +19,8 @@ import dev.inmo.jsuikit.modifiers.UIKitUtility
|
|||||||
import dev.inmo.jsuikit.modifiers.builder
|
import dev.inmo.jsuikit.modifiers.builder
|
||||||
import dev.inmo.jsuikit.modifiers.include
|
import dev.inmo.jsuikit.modifiers.include
|
||||||
import dev.inmo.jsuikit.utils.Attrs
|
import dev.inmo.jsuikit.utils.Attrs
|
||||||
|
import kotlinx.browser.window
|
||||||
|
import kotlinx.coroutines.withTimeout
|
||||||
import org.jetbrains.compose.web.attributes.InputType
|
import org.jetbrains.compose.web.attributes.InputType
|
||||||
import org.jetbrains.compose.web.dom.Div
|
import org.jetbrains.compose.web.dom.Div
|
||||||
import org.jetbrains.compose.web.dom.Legend
|
import org.jetbrains.compose.web.dom.Legend
|
||||||
@ -59,7 +62,12 @@ actual fun CommonTextField(
|
|||||||
placeholder = hint,
|
placeholder = hint,
|
||||||
attributesCustomizer = {
|
attributesCustomizer = {
|
||||||
onFocusIn { onFocusChanged(true) }
|
onFocusIn { onFocusChanged(true) }
|
||||||
onFocusOut { onFocusChanged(false) }
|
onFocusOut {
|
||||||
|
window.setTimeout( // avoid immediate hiding of potential interface data with additional delay
|
||||||
|
{ onFocusChanged(false) },
|
||||||
|
100
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onChange = onChange
|
onChange = onChange
|
||||||
)
|
)
|
||||||
@ -84,7 +92,7 @@ actual fun SwitchWithLabel(
|
|||||||
onCheckedChange(!checked)
|
onCheckedChange(!checked)
|
||||||
},
|
},
|
||||||
attributesCustomizer = {
|
attributesCustomizer = {
|
||||||
include(UIKitUtility.Inline)
|
include(UIKitUtility.Inline, UIKitUtility.NoTransform, UIKitUtility.Border.Rounded)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
@ -95,8 +103,13 @@ actual fun SwitchWithLabel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
actual fun <T> ButtonsPanel(data: Iterable<T>, itemDrawer: @Composable (T) -> Unit) {
|
actual fun <T> ButtonsPanel(
|
||||||
|
title: String,
|
||||||
|
data: Iterable<T>,
|
||||||
|
itemDrawer: @Composable (T) -> Unit
|
||||||
|
) {
|
||||||
Flex(UIKitFlex.Alignment.Vertical.Middle, UIKitMargin.Small) {
|
Flex(UIKitFlex.Alignment.Vertical.Middle, UIKitMargin.Small) {
|
||||||
|
Div(UIKitMargin.Small.Horizontal.builder()) { Text(title) }
|
||||||
data.forEach { itemDrawer(it) }
|
data.forEach { itemDrawer(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.kmppscriptbuilder.core.ui.utils
|
||||||
|
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitCustom
|
||||||
|
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||||
|
|
||||||
|
val ClassNoTransform = UIKitCustom(arrayOf("no-transform"))
|
||||||
|
|
||||||
|
val UIKitUtility.Companion.NoTransform
|
||||||
|
get() = ClassNoTransform
|
4
core/src/jsMain/resources/css/internal.css
Normal file
4
core/src/jsMain/resources/css/internal.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.no-transform {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@
|
|||||||
<title>Kotlin Publication Scripts Builder</title>
|
<title>Kotlin Publication Scripts Builder</title>
|
||||||
<!-- UIkit CSS -->
|
<!-- UIkit CSS -->
|
||||||
<link rel="stylesheet" href="./css/uikit.min.css" />
|
<link rel="stylesheet" href="./css/uikit.min.css" />
|
||||||
|
<link rel="stylesheet" href="./css/internal.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- <form class="uk-padding-small">-->
|
<!-- <form class="uk-padding-small">-->
|
||||||
|
@ -80,8 +80,12 @@ actual fun TitleText(text: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
actual fun <T> ButtonsPanel(data: Iterable<T>, itemDrawer: @Composable (T) -> Unit) {
|
actual fun <T> ButtonsPanel(
|
||||||
|
title: String,
|
||||||
|
data: Iterable<T>,
|
||||||
|
itemDrawer: @Composable (T) -> Unit) {
|
||||||
Row {
|
Row {
|
||||||
|
Text(title, Modifier.padding(8.dp))
|
||||||
data.forEach { itemDrawer(it) }
|
data.forEach { itemDrawer(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user