Skip to content

Commit af75f59

Browse files
committed
CiC 1.4.0: Kotlin 1.8.20 & Maven Central release!
1 parent 34b4d99 commit af75f59

File tree

15 files changed

+589
-72
lines changed

15 files changed

+589
-72
lines changed

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and deploy a release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
create-staging-repository:
9+
name: Create staging repository
10+
runs-on: ubuntu-latest
11+
outputs:
12+
repository_id: ${{ steps.create.outputs.repository_id }}
13+
steps:
14+
- id: create
15+
uses: nexus-actions/create-nexus-staging-repo@v1.1
16+
with:
17+
base_url: https://s01.oss.sonatype.org/service/local/
18+
username: ${{ secrets.SONATYPE_USERNAME }}
19+
password: ${{ secrets.SONATYPE_PASSWORD }}
20+
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
21+
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
22+
23+
build-upload:
24+
needs: create-staging-repository
25+
runs-on: ubuntu-latest
26+
env:
27+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
28+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
29+
GPG_PRIVATE_KEY: ${{ secrets.PGP_SIGNING_KEY }}
30+
GPG_PRIVATE_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
31+
steps:
32+
- name: Check out
33+
uses: actions/checkout@v2
34+
- name: Cached Gradle
35+
uses: actions/cache@v2
36+
with:
37+
path: ~/.gradle
38+
key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
39+
restore-keys: gradle-
40+
- name: Set up JDK 11
41+
uses: actions/setup-java@v1
42+
with:
43+
java-version: 11
44+
- name: Check
45+
run: ./gradlew build check
46+
shell: bash
47+
- name: Upload
48+
run: ./gradlew publishAllPublicationsToOssrhStagingRepository -Porg.kodein.sonatype.repositoryId=${{ needs.create-staging-repository.outputs.repository_id }}
49+
shell: bash
50+
51+
drop-or-release:
52+
needs: [create-staging-repository, build-upload]
53+
runs-on: ubuntu-20.04
54+
if: ${{ needs.create-staging-repository.result == 'success' }}
55+
steps:
56+
- name: Drop
57+
if: ${{ needs.build-upload.result != 'success' }}
58+
uses: nexus-actions/drop-nexus-staging-repo@v1
59+
with:
60+
base_url: https://s01.oss.sonatype.org/service/local/
61+
username: ${{ secrets.SONATYPE_USERNAME }}
62+
password: ${{ secrets.SONATYPE_PASSWORD }}
63+
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}
64+
- name: Release
65+
if: ${{ needs.build-upload.result == 'success' }}
66+
uses: nexus-actions/release-nexus-staging-repo@v1
67+
with:
68+
base_url: https://s01.oss.sonatype.org/service/local/
69+
username: ${{ secrets.SONATYPE_USERNAME }}
70+
password: ${{ secrets.SONATYPE_PASSWORD }}
71+
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }}

.github/workflows/snapshot.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and deploy a snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'snapshot/*'
8+
- 'kotlin-*'
9+
paths-ignore:
10+
- '**.md'
11+
- '**.adoc'
12+
- '**/.gitignore'
13+
- './github/**'
14+
- '!./github/workflow/snapshot.yml'
15+
16+
env:
17+
SONATYPE_USERNAME: ${{ secrets.sonatype_username }}
18+
SONATYPE_PASSWORD: ${{ secrets.sonatype_password }}
19+
20+
jobs:
21+
build-upload:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out
25+
uses: actions/checkout@v2
26+
- name: Cached Gradle
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.gradle
30+
key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
31+
restore-keys: gradle-
32+
- name: Set up JDK 11
33+
uses: actions/setup-java@v1
34+
with:
35+
java-version: 11
36+
- name: Check
37+
run: ./gradlew build check
38+
shell: bash
39+
- name: Upload
40+
run: ./gradlew publishAllPublicationsToOssrhStagingRepository -PgitRef=${{ github.ref }} -Psnapshot=true
41+
shell: bash

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: check
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- '**.md'
7+
- '**.adoc'
8+
- '**/.gitignore'
9+
- './github/**'
10+
- '!./github/workflow/test.yml'
11+
12+
jobs:
13+
14+
check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v2
19+
- name: Cached Gradle
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.gradle
23+
key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
24+
restore-keys: gradle-
25+
- name: Set up JDK 11
26+
uses: actions/setup-java@v1
27+
with:
28+
java-version: 11
29+
- name: Build & Check
30+
run: ./gradlew build check
31+
shell: bash

Readme.adoc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
= Css In Composable
2+
3+
This library is meant to be used with https://github.com/JetBrains/compose-multiplatform#compose-html[Compose-HTML].
4+
5+
CiC allows you to define CSS (as opposed to Style) directly into HTML Composables.
6+
It basically does the same thing as https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-styled-next:[Kotlin Wrapper Styled Components], but for Compose-HTML.
7+
8+
In addition to regular element style, it allows you to style children and pseudo-classes.
9+
10+
Have a look at that example:
11+
12+
[source,kotlin]
13+
----
14+
@Composable
15+
fun ColoredDiv(text: String) {
16+
Div({
17+
css {
18+
//<1>
19+
backgroundColor(Color.blue)
20+
padding(1.em)
21+
textAlign("center")
22+
23+
(self + hover) { //<2>
24+
backgroundColor(Color.red)
25+
}
26+
27+
"a" { //<3>
28+
backgroundColor(Color.orange)
29+
textDecoration("none")
30+
}
31+
}
32+
}) {
33+
Text(text)
34+
}
35+
}
36+
----
37+
<1> Basic style
38+
<2> Self + pseudo-class
39+
<3> Children
40+
41+
You should only use `css` for "immutable" style.
42+
As a new CSS class is generated every time the content changes, you should use `style` for regularly changing style.

build.gradle.kts

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,8 @@
1-
@Suppress("DSL_SCOPE_VIOLATION")
21
plugins {
3-
alias(libs.plugins.kotlin.multiplatform)
4-
alias(libs.plugins.compose)
5-
`maven-publish`
2+
kodein.root
63
}
74

8-
group = "org.kodein.cic"
9-
version = "1.3.0"
10-
115
allprojects {
12-
repositories {
13-
mavenCentral()
14-
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
15-
google()
16-
}
17-
}
18-
19-
kotlin {
20-
explicitApi()
21-
22-
js(IR) {
23-
browser()
24-
}
25-
26-
sourceSets {
27-
named("jsMain") {
28-
dependencies {
29-
implementation(compose.web.core)
30-
implementation(compose.web.svg)
31-
implementation(compose.runtime)
32-
}
33-
}
34-
35-
all {
36-
languageSettings {
37-
optIn("org.jetbrains.compose.web.ExperimentalComposeWebApi")
38-
optIn("kotlin.time.ExperimentalTime")
39-
}
40-
}
41-
}
6+
group = "org.kodein.cic"
7+
version = "1.4.0"
428
}

css-in-composable/build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
plugins {
2+
kodein.library.mpp
3+
alias(libs.plugins.compose)
4+
}
5+
6+
kotlin.kodein {
7+
jsEnvBrowserOnly()
8+
js {
9+
sources.mainDependencies {
10+
implementation(kotlin.compose.html.core)
11+
implementation(kotlin.compose.runtime)
12+
}
13+
}
14+
}
15+
16+
kotlin.sourceSets.all {
17+
languageSettings {
18+
optIn("org.jetbrains.compose.web.ExperimentalComposeWebApi")
19+
optIn("kotlin.time.ExperimentalTime")
20+
}
21+
}
22+
23+
kodeinUpload {
24+
name = "Css-In-Composable"
25+
description = "Css classes generated in Compose-HTML composables"
26+
}

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[versions]
2-
kotlin = "1.8.0"
3-
compose = "1.3.0"
2+
compose = "1.4.0"
43

54
[plugins]
6-
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
75
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)