From 3ce698b53098592cf782270335d2337a6d53053b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 09:10:47 +0000 Subject: [PATCH 1/5] Initial plan From 3c287b56cd6d8562c343230a847cef63d172f428 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 10:46:00 +0000 Subject: [PATCH 2/5] Fix Dokka DClass/DObject merge error for ScrollState and LazyItemScope Change `actual object ScrollState` to `actual class ScrollState` in jsMain to fix Dokka's inability to merge DClass and DObject models. Apply the same fix to `LazyItemScope` which had the same expect class/actual object mismatch. Reuse a single LazyItemScope instance since it's stateless. Co-authored-by: ShreckYe <27768951+ShreckYe@users.noreply.github.com> Agent-Logs-Url: https://github.com/huanshankeji/compose-multiplatform-html-unified/sessions/fb46b1bd-1f94-4165-b19a-6bc80235c64b --- .../kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt | 4 ++-- .../com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt | 6 ++++-- .../compose/foundation/lazy/LazyItemScope.js.kt | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt index d7007fb1..9ea03d16 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt @@ -28,10 +28,10 @@ val imitateComposeUiLayoutHorizontalScrollPlatformModifier = @Composable actual fun rememberScrollState(initial: Int): ScrollState = - ScrollState + ScrollState() @Stable -actual object ScrollState +actual class ScrollState actual fun Modifier.verticalScroll(state: ScrollState): Modifier = platformModify { verticalScroll() } diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt index ec7c1d86..020aa0b7 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt @@ -10,6 +10,8 @@ import com.huanshankeji.compose.ui.Modifier import com.huanshankeji.compose.ui.PlatformModifier import com.huanshankeji.compose.ui.toCommonModifier +private val lazyItemScope = LazyItemScope() + /* @LazyScopeMarker @JvmDefaultWithCompatibility @@ -29,7 +31,7 @@ actual class LazyListScope { contentType: Any?, content: @Composable LazyItemScope.() -> Unit, ) = - addComposable { LazyItemScope.content() } + addComposable { lazyItemScope.content() } actual fun items( count: Int, @@ -39,7 +41,7 @@ actual class LazyListScope { ) = addComposable { repeat(count) { index -> - LazyItemScope.itemContent(index) + lazyItemScope.itemContent(index) } } } diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt index 03ba111e..adf9b81a 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt @@ -12,7 +12,7 @@ import com.huanshankeji.compose.ui.Modifier @LazyScopeMarker @JvmDefaultWithCompatibility */ -actual object LazyItemScope { +actual class LazyItemScope { // I am not sure whether these implementations work perfectly. actual fun Modifier.fillParentMaxSize( From d802de590f4fafce5f3800810a4096d2624ad51e Mon Sep 17 00:00:00 2001 From: Yongshun Ye Date: Sat, 21 Mar 2026 20:44:34 +0800 Subject: [PATCH 3/5] Add some comments and simplify --- .../kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt | 2 ++ .../com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt | 6 ++---- .../compose/foundation/lazy/LazyItemScope.js.kt | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt index 9ea03d16..753bb04e 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/Scroll.js.kt @@ -30,6 +30,8 @@ val imitateComposeUiLayoutHorizontalScrollPlatformModifier = actual fun rememberScrollState(initial: Int): ScrollState = ScrollState() + +// used to be `actual object`, but but Dokka fails with it @Stable actual class ScrollState diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt index 020aa0b7..54434d00 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyDsl.js.kt @@ -10,8 +10,6 @@ import com.huanshankeji.compose.ui.Modifier import com.huanshankeji.compose.ui.PlatformModifier import com.huanshankeji.compose.ui.toCommonModifier -private val lazyItemScope = LazyItemScope() - /* @LazyScopeMarker @JvmDefaultWithCompatibility @@ -31,7 +29,7 @@ actual class LazyListScope { contentType: Any?, content: @Composable LazyItemScope.() -> Unit, ) = - addComposable { lazyItemScope.content() } + addComposable { LazyItemScope().content() } actual fun items( count: Int, @@ -41,7 +39,7 @@ actual class LazyListScope { ) = addComposable { repeat(count) { index -> - lazyItemScope.itemContent(index) + LazyItemScope().itemContent(index) } } } diff --git a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt index adf9b81a..23084a17 100644 --- a/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt +++ b/common/src/jsMain/kotlin/com/huanshankeji/compose/foundation/lazy/LazyItemScope.js.kt @@ -12,6 +12,7 @@ import com.huanshankeji.compose.ui.Modifier @LazyScopeMarker @JvmDefaultWithCompatibility */ +// used to be `actual object`, with which Dokka fails actual class LazyItemScope { // I am not sure whether these implementations work perfectly. From dba83da09d47b81dc1d0380801dddfdadd492e25 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 12:57:57 +0000 Subject: [PATCH 4/5] Complete PR: update workflow to deploy Dokka API docs to GitHub Pages alongside demo - Update demo-gh-pages.yml to run dokkaGeneratePublicationHtml alongside sideBySideBrowserDistribution and copy the Dokka HTML output to the site under an `api/` subdirectory - Update workflow name to reflect it deploys both demo and API docs - Fix copilot-setup-steps.yml to use ubuntu-latest (matching main) Co-authored-by: ShreckYe <27768951+ShreckYe@users.noreply.github.com> Agent-Logs-Url: https://github.com/huanshankeji/compose-multiplatform-html-unified/sessions/fe6d1cc2-55ae-4670-a884-abf1758ec816 --- .github/workflows/copilot-setup-steps.yml | 2 +- .github/workflows/demo-gh-pages.yml | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index d52ab826..73177090 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -11,7 +11,7 @@ on: jobs: copilot-setup-steps: - runs-on: macos-latest + runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/demo-gh-pages.yml b/.github/workflows/demo-gh-pages.yml index 4365df18..12d0f0a4 100644 --- a/.github/workflows/demo-gh-pages.yml +++ b/.github/workflows/demo-gh-pages.yml @@ -1,4 +1,4 @@ -name: Deploy the demo to GitHub Pages +name: Deploy the demo and API documentation to GitHub Pages on: push: @@ -40,8 +40,11 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Build the distribution with Gradle Wrapper - run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution + - name: Build the demo distribution and generate API documentation with Gradle Wrapper + run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution dokkaGeneratePublicationHtml + + - name: Copy the API documentation into the site + run: cp -r build/dokka/html demo/build/dist/sideBySide/productionExecutable/api - name: Upload artifact uses: actions/upload-pages-artifact@v3 From 5b0ad22d2062a1a9f1818bdc725be0f7b2a98f8f Mon Sep 17 00:00:00 2001 From: Yongshun Ye Date: Sun, 22 Mar 2026 19:13:47 +0800 Subject: [PATCH 5/5] Revert "Complete PR: update workflow to deploy Dokka API docs to GitHub Pages alongside demo" This reverts commit dba83da09d47b81dc1d0380801dddfdadd492e25. --- .github/workflows/copilot-setup-steps.yml | 2 +- .github/workflows/demo-gh-pages.yml | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 73177090..d52ab826 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -11,7 +11,7 @@ on: jobs: copilot-setup-steps: - runs-on: ubuntu-latest + runs-on: macos-latest permissions: contents: read diff --git a/.github/workflows/demo-gh-pages.yml b/.github/workflows/demo-gh-pages.yml index 12d0f0a4..4365df18 100644 --- a/.github/workflows/demo-gh-pages.yml +++ b/.github/workflows/demo-gh-pages.yml @@ -1,4 +1,4 @@ -name: Deploy the demo and API documentation to GitHub Pages +name: Deploy the demo to GitHub Pages on: push: @@ -40,11 +40,8 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Build the demo distribution and generate API documentation with Gradle Wrapper - run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution dokkaGeneratePublicationHtml - - - name: Copy the API documentation into the site - run: cp -r build/dokka/html demo/build/dist/sideBySide/productionExecutable/api + - name: Build the distribution with Gradle Wrapper + run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution - name: Upload artifact uses: actions/upload-pages-artifact@v3