Compare commits

6 Commits

Author SHA1 Message Date
0e1c1cd99f Version 1.1.0, add oklch color option
- Update publish plugin
2025-05-03 10:49:00 +02:00
996a8f385e version 1.0.11-SNAPSHOT 2024-10-23 14:00:59 +02:00
d2349c9308 version 1.0.10 2024-10-23 13:50:36 +02:00
e0a4ff54de v. 1.0.8 update Kotlin to 1.9.22, gradle to 8.5 and test-logger to 4.0.0 2024-01-27 12:04:24 +01:00
3f5f1c6543 Example
Took 15 minutes
2023-07-24 10:34:20 +02:00
ac491761d9 v. 1.0.7, kotlin v. 1.7.20, gradle 7.5.1
Took 24 minutes
2022-10-15 11:11:11 +02:00
8 changed files with 135 additions and 105 deletions

View File

@@ -1,13 +1,17 @@
@file:OptIn(ExperimentalWasmDsl::class)
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
kotlin("multiplatform") version "1.6.10"
`maven-publish`
kotlin("multiplatform") version "2.1.10"
id("com.vanniktech.maven.publish") version "0.31.0"
signing
id("org.jetbrains.dokka") version "1.5.31"
id("com.adarshr.test-logger") version "3.0.0"
id("org.jetbrains.dokka") version "2.0.0"
}
group = "nl.astraeus"
version = "1.0.7-SNAPSHOT"
version = "1.1.0"
repositories {
mavenCentral()
@@ -15,23 +19,30 @@ repositories {
kotlin {
jvm()
js(BOTH) {
js(IR) {
browser {
testTask {
useKarma {
useFirefox()
//useChrome()
}
}
/* testTask {
// work around, browser test is broken atm
enabled = false
}*/
}
}
wasmJs {
//moduleName = project.name
browser()
mavenPublication {
groupId = group as String
pom { name = "${project.name}-wasm-js" }
}
}
sourceSets {
val commonMain by getting {}
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(kotlin("test"))
}
}
val jvmTest by getting {
@@ -39,101 +50,28 @@ kotlin {
implementation(kotlin("test-junit"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val jsMain by getting
val wasmJsMain by getting
}
}
testlogger {
showStandardStreams = true
}
extra["PUBLISH_GROUP_ID"] = group
extra["PUBLISH_VERSION"] = version
extra["PUBLISH_ARTIFACT_ID"] = name
// Stub secrets to let the project sync and build without the publication values set up
val signingKeyId: String by project
val signingPassword: String by project
val signingSecretKeyRingFile: String by project
val ossrhUsername: String by project
val ossrhPassword: String by project
extra["signing.keyId"] = signingKeyId
extra["signing.password"] = signingPassword
extra["signing.secretKeyRingFile"] = signingSecretKeyRingFile
extra["ossrhUsername"] = ossrhUsername
extra["ossrhPassword"] = ossrhPassword
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing {
repositories {
mavenLocal()
maven {
name = "releases"
// change to point to your repo, e.g. http://my.org/repo
url = uri("https://nexus.astraeus.nl/nexus/content/repositories/releases")
credentials {
val nexusUsername: String by project
val nexusPassword: String by project
name = "gitea"
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
username = nexusUsername
password = nexusPassword
}
}
maven {
name = "snapshots"
// change to point to your repo, e.g. http://my.org/repo
url = uri("https://nexus.astraeus.nl/nexus/content/repositories/snapshots")
credentials {
val nexusUsername: String by project
val nexusPassword: String by project
credentials() {
val giteaUsername: kotlin.String? by project
val giteaPassword: kotlin.String? by project
username = nexusUsername
password = nexusPassword
}
}
maven {
name = "sonatype"
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())
// Provide artifacts information requited by Maven Central
pom {
name.set("kotlin-css-generator")
description.set("Kotlin css generator")
url.set("https://github.com/rnentjes/kotlin-css-generator")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("rnentjes")
name.set("Rien Nentjes")
email.set("info@nentjes.com")
}
}
scm {
url.set("https://github.com/rnentjes/kotlin-css-generator")
username = giteaUsername
password = giteaPassword
}
}
}
@@ -142,3 +80,39 @@ publishing {
signing {
sign(publishing.publications)
}
tasks.withType<AbstractPublishToMaven> {
dependsOn(tasks.withType<Sign>())
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates(group.toString(), name, version.toString())
pom {
name = "kotlin-css-generator"
description = "Kotlin css generator"
inceptionYear = "2020"
url = "https://github.com/rnentjes/kotlin-css-generator"
licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "rnentjes"
name = "Rien Nentjes"
email = "info@nentjes.com"
}
}
scm {
url = "https://github.com/rnentjes/kotlin-css-generator"
}
}
}

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -17,7 +17,7 @@ Include in build.gradle.kts:
val commonMain by getting {
dependencies {
api("nl.astraeus:kotlin-css-generator:1.0.2")
api("nl.astraeus:kotlin-css-generator:1.0.9")
}
}
```

View File

@@ -1,11 +1,20 @@
pluginManagement {
repositories {
google()
mavenCentral()
maven { setUrl("https://plugins.gradle.org/m2/") }
gradlePluginPortal()
}
}
rootProject.name = "kotlin-css-generator"
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
//enableFeaturePreview("GRADLE_METADATA")
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
rootProject.name = "kotlin-css-generator"

View File

@@ -585,6 +585,8 @@ fun rgb(red: Int, green: Int, blue: Int) = Color("rgb($red, $green, $blue)")
fun rgba(red: Int, green: Int, blue: Int, alpha: Double) = Color("rgba($red, $green, $blue, ${formatAlpha(alpha)})")
fun hsl(hue: Int, saturation: Int, lightness: Int) = Color("hsl($hue, $saturation%, $lightness%)")
fun hsla(hue: Int, saturation: Int, lightness: Int, alpha: Double) = Color("hsla($hue, $saturation%, $lightness%, ${formatAlpha(alpha)})")
fun oklch(lightness: Int, chroma: Double, hue: Double) = Color("oklch($lightness% $chroma $hue)")
fun oklch(lightness: Int, chroma: Double, hue: Double, alpha: Double) = Color("oklch($lightness% $chroma $hue / ${formatAlpha(alpha)})")
fun blackAlpha(alpha: Double) = Color.black.withAlpha(alpha)
fun whiteAlpha(alpha: Double) = Color.white.withAlpha(alpha)

View File

@@ -0,0 +1,20 @@
package nl.astraeus.css
import nl.astraeus.css.properties.oklch
import kotlin.test.Test
class ColorTest {
@Test
fun testColor() {
val css = style {
select("body") {
color(oklch(100, 0.5, 0.5))
backgroundColor(oklch(100, 0.5, 0.5, 0.25))
}
}
println(css.generateCss())
}
}

View File

@@ -2,6 +2,8 @@ package nl.astraeus.css
import nl.astraeus.css.properties.BorderStyle
import nl.astraeus.css.properties.Color
import nl.astraeus.css.properties.FontStyle
import nl.astraeus.css.properties.FontWeight
import nl.astraeus.css.properties.Measurement
import nl.astraeus.css.properties.em
import nl.astraeus.css.properties.hsla
@@ -128,4 +130,28 @@ class Examples {
combineEqualBlocks = true
))
}
@Test
fun testFontFace() {
val css = style {
select("*") {
fontFace {
fontFamily("UbuntuCondensed")
fontStyle(FontStyle.normal)
fontWeight(FontWeight.normal)
//fontDisplay("auto")
src("fonts/ubuntu.condensed.ttf")
}
}
}
val cssTxt = css.generateCss(
minified = false,
sortProperties = true,
combineEqualBlocks = true
)
println(cssTxt)
}
}

View File

@@ -187,7 +187,6 @@ class TestCssBuilder {
println(css2.generateCss())
}
@Test
fun testOr() {
val css = style {