Compare commits
6 Commits
0d8157cabf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e1c1cd99f | |||
| 996a8f385e | |||
| d2349c9308 | |||
| e0a4ff54de | |||
| 3f5f1c6543 | |||
| ac491761d9 |
170
build.gradle.kts
170
build.gradle.kts
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
20
src/commonTest/kotlin/nl/astraeus/css/ColorTest.kt
Normal file
20
src/commonTest/kotlin/nl/astraeus/css/ColorTest.kt
Normal 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())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ class TestCssBuilder {
|
||||
println(css2.generateCss())
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testOr() {
|
||||
val css = style {
|
||||
|
||||
Reference in New Issue
Block a user