Refactor CssName and update build configuration.
Revised `CssName` to support optional override names and adjusted usage across multiple components for consistency. Updated build.gradle.kts to increment version and enable source maps in the browser configuration.
This commit is contained in:
@@ -9,7 +9,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "1.2.0"
|
version = "2.0.0-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -27,7 +27,11 @@ kotlin {
|
|||||||
target.set("es2015")
|
target.set("es2015")
|
||||||
}
|
}
|
||||||
binaries.library()
|
binaries.library()
|
||||||
browser {}
|
browser {
|
||||||
|
commonWebpackConfig {
|
||||||
|
sourceMaps = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
jvm {
|
jvm {
|
||||||
withJava()
|
withJava()
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ open class BaseKnobComponent(
|
|||||||
+renderedValue
|
+renderedValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* span(KnobMidiValueCls.name) {
|
||||||
|
+midiValue
|
||||||
|
}*/
|
||||||
|
|
||||||
onWheelFunction = ::wheelFunction
|
onWheelFunction = ::wheelFunction
|
||||||
|
|
||||||
onMouseDownFunction = {
|
onMouseDownFunction = {
|
||||||
@@ -305,14 +309,14 @@ open class BaseKnobComponent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object : CssId("knob") {
|
companion object : CssId("knob") {
|
||||||
object KnobCls : CssName
|
object KnobCls : CssName()
|
||||||
object KnobSvgCls : CssName
|
object KnobSvgCls : CssName()
|
||||||
object KnobTextCls : CssName
|
object KnobTextCls : CssName()
|
||||||
object KnobValueCls : CssName
|
object KnobValueCls : CssName()
|
||||||
object KnobBackgroundCls : CssName
|
object KnobBackgroundCls : CssName()
|
||||||
|
|
||||||
object KnobVolumeCls : CssName
|
object KnobVolumeCls : CssName()
|
||||||
object KnobVolumeBackgroundCls : CssName
|
object KnobVolumeBackgroundCls : CssName()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
defineCss {
|
defineCss {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class KeyboardInputComponent : Komponent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object : CssId("keyboard-input") {
|
companion object : CssId("keyboard-input") {
|
||||||
object KeyboardInputCss : CssName
|
object KeyboardInputCss : CssName()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
defineCss {
|
defineCss {
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package nl.astraeus.vst.ui.css
|
package nl.astraeus.vst.ui.css
|
||||||
|
|
||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import nl.astraeus.css.properties.*
|
import nl.astraeus.css.properties.Color
|
||||||
|
import nl.astraeus.css.properties.Measurement
|
||||||
|
import nl.astraeus.css.properties.UserSelect
|
||||||
|
import nl.astraeus.css.properties.hsl
|
||||||
|
import nl.astraeus.css.properties.hsla
|
||||||
|
import nl.astraeus.css.properties.px
|
||||||
import nl.astraeus.css.style
|
import nl.astraeus.css.style
|
||||||
import nl.astraeus.css.style.ConditionalStyle
|
import nl.astraeus.css.style.ConditionalStyle
|
||||||
import nl.astraeus.css.style.DescriptionProvider
|
import nl.astraeus.css.style.DescriptionProvider
|
||||||
@@ -17,15 +22,9 @@ class StyleDefinition(
|
|||||||
val buttonBorderWidth : Measurement = 1.px,
|
val buttonBorderWidth : Measurement = 1.px,
|
||||||
)
|
)
|
||||||
|
|
||||||
object NoTextSelectCls : CssName {
|
object NoTextSelectCls : CssName("no-text-select")
|
||||||
override val name = "no-text-select"
|
object SelectedCls : CssName("selected")
|
||||||
}
|
object ActiveCls : CssName( "active")
|
||||||
object SelectedCls : CssName {
|
|
||||||
override val name = "selected"
|
|
||||||
}
|
|
||||||
object ActiveCls : CssName {
|
|
||||||
override val name = "active"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Color.hover(): Color = if (Css.currentStyle == Css.darkStyle) {
|
fun Color.hover(): Color = if (Css.currentStyle == Css.darkStyle) {
|
||||||
this.lighten(15)
|
this.lighten(15)
|
||||||
|
|||||||
@@ -25,24 +25,31 @@ object CssSettings {
|
|||||||
var minified = false
|
var minified = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val idCharacters = ('a'..'z') + ('A'..'Z')
|
||||||
private fun nextShortId(): String {
|
private fun nextShortId(): String {
|
||||||
var id = nextCssId++
|
var id = nextCssId++
|
||||||
val result = StringBuilder()
|
val result = StringBuilder()
|
||||||
|
|
||||||
while (id > 0) {
|
while (id > 0) {
|
||||||
val ch = ((id % 26) + 'a'.code).toChar()
|
result.append(idCharacters[id % idCharacters.size])
|
||||||
result.append(ch)
|
|
||||||
|
|
||||||
id /= 26
|
id /= idCharacters.size
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CssName : DescriptionProvider {
|
abstract class CssName(
|
||||||
val name: String
|
overrideName: String? = null
|
||||||
get() = if (CssSettings.shortId) {
|
) : DescriptionProvider {
|
||||||
nextShortId()
|
val name: String = if (overrideName != null) {
|
||||||
|
if (CssSettings.preFix.isNotBlank()) {
|
||||||
|
"${CssSettings.preFix}-$overrideName"
|
||||||
|
} else {
|
||||||
|
overrideName
|
||||||
|
}
|
||||||
|
} else if (CssSettings.shortId) {
|
||||||
|
"${CssSettings.preFix}-${nextShortId()}"
|
||||||
} else {
|
} else {
|
||||||
"${CssSettings.preFix}-${this::class.simpleName?.hyphenize() ?: this::class}"
|
"${CssSettings.preFix}-${this::class.simpleName?.hyphenize() ?: this::class}"
|
||||||
}
|
}
|
||||||
@@ -60,6 +67,7 @@ open class CssId(name: String) : DescriptionProvider {
|
|||||||
} else {
|
} else {
|
||||||
"daw-$name-css"
|
"daw-$name-css"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun description() = name
|
override fun description() = name
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ class BaseVstView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
object BaseVstCss : CssId("base-vst-view") {
|
object BaseVstCss : CssId("base-vst-view") {
|
||||||
object BaseVstCss : CssName
|
object BaseVstCss : CssName()
|
||||||
object StartSplashCss : CssName
|
object StartSplashCss : CssName()
|
||||||
object StartBoxCss : CssName
|
object StartBoxCss : CssName()
|
||||||
object StartButtonCss : CssName
|
object StartButtonCss : CssName()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
defineCss {
|
defineCss {
|
||||||
|
|||||||
Reference in New Issue
Block a user