Skip to content

Commit 4053f93

Browse files
authored
Merge pull request #82 from compose-fluent/dev
[Release] 0.1.0
2 parents 7618b39 + 158e19f commit 4053f93

File tree

7,763 files changed

+278220
-255434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,763 files changed

+278220
-255434
lines changed

.github/workflows/deploy-gh-pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
with:
3535
cache-disabled: true
3636
- name: Build wasm target
37+
env:
38+
PROJECT_BUILD_TYPE: release
3739
run: ./gradlew :gallery:wasmJsBrowserDistribution
3840
- name: Setup Pages
3941
uses: actions/configure-pages@v5

.github/workflows/gradle-publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
- name: Publish to Maven Central
3838
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
3939
with:
40-
arguments: publish
40+
arguments: publishToMavenCentral --no-configuration-cache
4141
env:
42-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
43-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
44-
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
45-
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
46-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
42+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
43+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
44+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_KEY }}
45+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_SIGNING_KEY_ID }}
46+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
6+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
7+
8+
name: Multiplatform Snapshot Build
9+
10+
on:
11+
push:
12+
branches:
13+
- dev
14+
paths-ignore:
15+
- 'assets/**'
16+
- '**.md'
17+
- 'LICENSE'
18+
- '**.gitignore'
19+
20+
pull_request_review:
21+
types: submitted
22+
23+
jobs:
24+
build:
25+
strategy:
26+
matrix:
27+
type: [PublishLibrary, Android, Windows, Linux, macOS, iOS, WasmJs, Js]
28+
include:
29+
- type: PublishLibrary
30+
publish: release
31+
os: macos-latest
32+
- type: Android
33+
android: apk
34+
os: ubuntu-latest
35+
- type: Windows
36+
desktop: msi
37+
os: windows-latest
38+
- type: Linux
39+
desktop: deb
40+
os: ubuntu-latest
41+
- type: macOS
42+
desktop: dmg
43+
os: macos-latest
44+
- type: iOS
45+
iOS: ipa
46+
# workaround runner version for iPhoneOS sdk 18.2
47+
os: macos-15
48+
- type: WasmJs
49+
js: wasmJs
50+
os: windows-latest
51+
- type: Js
52+
js: js
53+
os: ubuntu-latest
54+
55+
runs-on: ${{ matrix.os }}
56+
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
57+
permissions:
58+
contents: read
59+
packages: write
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
ref: ${{ github.ref }}
66+
- name: Set up JDK 17
67+
uses: actions/setup-java@v4
68+
with:
69+
java-version: '17'
70+
distribution: 'temurin'
71+
72+
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
73+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
74+
- name: Setup Gradle
75+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
76+
77+
# Publish Snapshot Library
78+
- name: Publish Library
79+
if: ${{ github.ref == 'refs/heads/dev' && github.event_name == 'push' && matrix.type == 'PublishLibrary' }}
80+
run: |
81+
./gradlew publishToMavenLocal
82+
./gradlew publishToMavenCentral --no-configuration-cache
83+
env:
84+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
85+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
86+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_KEY }}
87+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_SIGNING_KEY_ID }}
88+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
89+
90+
- name: Upload Library Artifact
91+
if: ${{ github.event_name == 'push' && matrix.type == 'PublishLibrary' }}
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: Repository-${{ github.run_id }}
95+
path: ~/.m2/repository
96+
97+
# Android Build Action
98+
- name: Build Gallery for ${{ matrix.type }}
99+
if: ${{ matrix.android }}
100+
run: |
101+
echo "$ANDROID_KEYSTORE" | base64 --decode > ${{ github.workspace }}/android_sign_key.jks
102+
./gradlew :gallery:assembleRelease
103+
env:
104+
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
105+
ANDROID_SIGNING_FILE: ${{ github.workspace }}/android_sign_key.jks
106+
ANDROID_SIGNING_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
107+
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
108+
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
109+
110+
- name: Upload android build artifacts
111+
if: ${{ matrix.android }}
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
115+
path: ${{github.workspace}}/gallery/build/outputs/**/*.${{ matrix.android }}
116+
117+
# Desktop Build Action
118+
- name: Build Gallery for ${{ matrix.type }}
119+
if: ${{ matrix.desktop }}
120+
run: |
121+
./gradlew :gallery:packageReleaseDistributionForCurrentOS
122+
123+
- name: Upload desktop build artifacts
124+
if: ${{ matrix.desktop }}
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
128+
path: ${{github.workspace}}/gallery/build/compose/binaries/main-release/${{ matrix.desktop }}/*.${{ matrix.desktop }}
129+
130+
# iOS Build Action, Note: Due to the long build time, the iOS build only build the debug version.
131+
- name: Set up Xcode
132+
if: ${{ matrix.iOS }}
133+
uses: maxim-lobanov/setup-xcode@v1
134+
with:
135+
xcode-version: 'latest-stable'
136+
137+
- name: Build Gallery for iOS
138+
if: ${{ matrix.iOS }}
139+
run: |
140+
xcodebuild -scheme iosApp -configuration Debug -sdk iphoneos -archivePath gallery/iosApp/build/Gallery.xcarchive archive -workspace gallery/iosApp/iosApp.xcodeproj/project.xcworkspace CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
141+
142+
- name: Upload iOS Artifact
143+
if: ${{ matrix.iOS }}
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
147+
path: ${{ github.workspace }}/gallery/iosApp/build/
148+
149+
# Js and WasmJs Build Action
150+
- name: Build Gallery for ${{ matrix.type }}
151+
if: ${{ matrix.js }}
152+
run: |
153+
./gradlew :gallery:${{ matrix.js }}BrowserDistribution
154+
155+
- name: Upload ${{ matrix.type }} build artifacts
156+
if: ${{ matrix.js }}
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: Gallery-${{ matrix.type }}-${{ github.run_id }}
160+
path: ./gallery/build/dist/${{ matrix.js }}/productionExecutable

CONTRIBUTION.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Contributing to Compose-Fluent-UI
2+
3+
Hello and welcome! 🎉
4+
5+
**Our project components are designed using the [Windows UI Kit Figma guidelines](https://www.figma.com/community/file/1440832812269040007/windows-ui-kit). Therefore, the layout and style of the components must strictly adhere to this design guide. Additionally, the components showcased in the Gallery should align as closely as possible with this design guide.**
6+
7+
We are thrilled to have you considering contributing to Compose-Fluent-UI. Contributions are what make the open-source community such an incredible place to learn, inspire, and create. Here are some guidelines to help you get started:
8+
9+
## Getting Started
10+
11+
- **Fork this repository**: Click on the "Fork" button at the top right of this page. This will create a copy of the repository in your account.
12+
- **Select the Dev branch**: Choose the `dev` branch as your base branch.
13+
- **Create a new branch**: Create a new branch from `dev` for your feature or bug fix using `git checkout -b your-branch-name`.
14+
- **Base all development work on your new branch**: Ensure that all your development work is committed to the branch you just created from `dev`.
15+
16+
## Developing Components
17+
18+
- **Create the source code**: In the `fluent/components` directory, create the source code for the component that corresponds to the Windows UI Kit.
19+
```Kotlin
20+
// Button.kt
21+
package io.github.composefluent.components
22+
```
23+
- **Handle internal classes**: If your component involves internal classes that may be used by other components (such as `OverflowRow`), create the relevant classes in the appropriate package (e.g., `/layout`).
24+
```Kotlin
25+
// OverflowRow.kt
26+
package io.github.composefluent.layout.overflow
27+
28+
@Composable
29+
internal fun OverflowRow(
30+
modifier: Modifier = Modifier,
31+
overflow: OverflowPosition = OverflowPosition.End,
32+
state: OverflowRowState = rememberOverflowRowState(),
33+
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
34+
verticalAlignment: Alignment.Vertical = Alignment.CenterVertically,
35+
overflowAction: @Composable OverflowActionScope.() -> Unit = {},
36+
contentPadding: PaddingValues = PaddingValues(),
37+
alwaysShowOverflowAction: Boolean = false,
38+
content: OverflowRowScope.() -> Unit
39+
)
40+
```
41+
- **Adhere to guidelines**: When developing, strictly follow the Windows UI Kit for layout, typography, and color.
42+
- **Include TODOs for animations**: If your component involves animations and you're unsure of the specific parameters to use, add a `TODO` note.
43+
44+
## Testing and Showcasing Components
45+
46+
The Gallery app uses KSP and KotlinPoet to automatically generate a navigation tree and Kotlin example source code. Below are the steps to add a component example page in the Gallery:
47+
48+
1. **Create [YourComponent]Screen.kt**: In the package corresponding to the component group, create a `[YourComponent]Screen.kt` file.
49+
```Kotlin
50+
// ButtonScreen.kt
51+
package io.github.composefluent.gallery.screen.basicinput
52+
```
53+
2. **Create a method with @Component annotation**: Create a method named `[YourComponent]Screen` and annotate it with `@Component`, providing the relevant `description` and `index`.
54+
```Kotlin
55+
// ButtonScreen.kt
56+
@Component(index = 0, description = "A control that responds to user input")
57+
@Composable
58+
fun ButtonScreen() {
59+
60+
}
61+
```
62+
63+
3. **Use GalleryPage method**: In this method, use the `GalleryPage` method to create a uniform component example page layout. The `GalleryPage` method takes `componentPath` and `galleryPath` as parameters, which are provided by the `FluentSourceFile` and `ComponentPagePath` classes generated by KSP, indicating the source code path of the component and the corresponding Gallery example code path.
64+
```Kotlin
65+
// ButtonScreen.kt
66+
@Component(index = 0, description = "A control that responds to user input")
67+
@Composable
68+
fun ButtonScreen() {
69+
GalleryPage(
70+
componentPath = FluentSourceFile.Button,
71+
galleryPath = ComponentPagePath.ButtonScreen,
72+
) {
73+
// Sample sections.
74+
}
75+
}
76+
```
77+
4. **Use Section method in GalleryPage**: Within `GalleryPage`, use the `Section` method for each component example. The `Section` method provides `output` and `options` parameters for adjusting options and display output. The `sourceCode` parameter should be the global variable generated by the `@Sample` annotation (which contains the component source code).
78+
```Kotlin
79+
// ButtonScreen.kt
80+
@Component(index = 0, description = "A control that responds to user input")
81+
@Composable
82+
fun ButtonScreen() {
83+
GalleryPage(
84+
componentPath = FluentSourceFile.Button,
85+
galleryPath = ComponentPagePath.ButtonScreen,
86+
) {
87+
val clickTextContent = remember { mutableStateOf("") }
88+
val buttonEnabled = remember { mutableStateOf(true) }
89+
Section(
90+
title = "A simple Button with text content.",
91+
content = {
92+
ButtonSample(enabled = buttonEnabled.value) { clickTextContent.value = "You clicked: Button 1" }
93+
},
94+
output = {
95+
if (clickTextContent.value.isNotBlank()) {
96+
Text(clickTextContent.value)
97+
}
98+
},
99+
options = {
100+
CheckBox(
101+
checked = !buttonEnabled.value,
102+
onCheckStateChange = { buttonEnabled.value = !it },
103+
label = "Disable button"
104+
)
105+
},
106+
sourceCode = sourceCodeOfButtonSample
107+
)
108+
}
109+
}
110+
```
111+
5. **Create an example**: In the `[YourComponent]Screen.kt` file, add a new method named `[YourComponentCase]Sample` with a private visibility modifier, and annotate this method with `@Sample`. This will generate a global variable `sourceCodeOf[YourComponentCase]Sample`, which should be assigned to the `sourceCode` parameter in the corresponding `Section`.
112+
```Kotlin
113+
//ButtonScreen.kt
114+
@Sample
115+
@Composable
116+
private fun ButtonSample(enabled: Boolean = true, onClick: () -> Unit) {
117+
Button(disabled = !enabled, onClick = onClick) {
118+
Text("Standard Compose Button")
119+
}
120+
}
121+
```
122+
6. **Add new groups if needed**: If you cannot find the appropriate group for the component, add a new group in the `ComponentGroupInfo` object, following the format of the existing groups. After adding the group, place the Screen file in the corresponding package.
123+
```Kotlin
124+
// ComponentGrupInfo.kt
125+
package io.github.composefluent.gallery.component
126+
127+
object ComponentGroupInfo {
128+
prival const val screenPackage: String = "io.github.composefluent.gallery.screen"
129+
130+
// Basic Input is group name, ChckboxChecked is icon, packageMap is the component screens under this group were placed, like ButtonScreen
131+
@ComponentGroup("CheckboxChecked", index = 2, packageMap = "$screenPackage.basicinput")
132+
const val BasicInput = "Basic input"
133+
134+
//other groups
135+
//....
136+
}
137+
```
138+
139+
7. At the end, you should see the component example page you've created in the Gallery, ready for demonstration and testing.
140+
![Sample Page](/assets/sample_page_screenshot.png)
141+
142+
8. **Debugging components with scale mode if needed**: If you need to debug your component with scale mode, you can test it in `TestComponentScreen`. Navigate to this test page in the Gallery app through `Settings > Test Component`.
143+
![Test Component Screen](/assets/test_component_screenshot.png)
144+
145+
## Need Help?
146+
147+
If you have any questions or need assistance, feel free to open an issue or reach out to the maintainers. We’re here to help!
148+
149+
Thank you for considering contributing to **Compose-Fluent-UI**. We can’t wait to see what you’ll create!

0 commit comments

Comments
 (0)