feat(UI): add AnvilLib-Ui module for declarative UI library#35
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new module.ui subproject for an AnvilLib UI module and wires it into the build, test, main aggregator, and CI/release workflows.
Changes:
- Registers
module.uiin Gradle settings and adds basic module metadata/resources. - Adds the
AnvilLibUimod entrypoint and resource helper. - Includes the UI module in test/main dependencies and CI/release job matrices.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
settings.gradle |
Registers and names the new UI subproject. |
module.ui/build.gradle |
Adds the module build file. |
module.ui/gradle.properties |
Defines UI module metadata. |
module.ui/src/main/java/dev/anvilcraft/lib/v2/ui/AnvilLibUi.java |
Adds the UI module entrypoint. |
module.ui/src/main/java/dev/anvilcraft/lib/v2/ui/package-info.java |
Marks the UI package as null-marked. |
module.ui/src/main/resources/META-INF/neoforge.mods.toml |
Adds NeoForge mod metadata. |
module.ui/src/main/resources/anvillib_ui.mixins.json |
Adds an empty mixin config for the module. |
module.test/build.gradle |
Adds UI as a test module dependency. |
module.main/build.gradle |
Bundles UI into the main AnvilLib artifact. |
.github/workflows/ci.yml |
Adds UI to CI build/deploy flow. |
.github/workflows/release.yml |
Adds UI to release build/deploy flow. |
.github/workflows/pull_request.yml |
Adds UI to PR checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 40 out of 41 changed files in this pull request and generated 33 comments.
Comments suppressed due to low confidence (1)
module.ui/src/main/java/dev/anvilcraft/lib/v2/ui/UIScope.java:51
- Any state read used to compute the button label is evaluated before the button is emitted, so it cannot be tracked against the button's slot. Dynamic labels based on
MutableStatewill not reliably trigger recomposition.
Composition.current().emit(c);
return c;
}
| for (Composition.Slot slot : readers) { | ||
| slot.markDirty(); |
| extractor.centeredText(font, comp, (int) (x + width / 2), (int) (y + (height - font.lineHeight) / 2), TEXT_COLOR); | ||
| } | ||
|
|
||
| void click() { |
| Composition comp = Composition.currentOrNull(); | ||
| if (comp != null && comp.currentSlot != null) { | ||
| comp.currentSlot.addReadState(this); | ||
| readers.add(comp.currentSlot); | ||
| } |
| static ModifierElement width(float w) { | ||
| return new SizeElement(0, Float.MAX_VALUE, w, w); | ||
| } |
| static ModifierElement height(float h) { | ||
| return new SizeElement(h, 0, h, Float.MAX_VALUE); | ||
| } |
| ui: | ||
| uses: ./.github/workflows/build_and_test.yml | ||
| with: | ||
| module: ui | ||
| module_id: anvillib-ui | ||
| mod_id: anvillib_ui | ||
| ci_build: false | ||
| pr_build: false | ||
| secrets: | ||
| maven_url: ${{ secrets.MAVEN_URL }} | ||
| maven_user: ${{ secrets.MAVEN_USER }} | ||
| maven_pass: ${{ secrets.MAVEN_PASS }} |
| public MeasuredSize measure(Constraints constraints) { | ||
| if (children.isEmpty()) return MeasuredSize.ZERO; | ||
|
|
| constraints.constrainWidth(maxWidth), | ||
| constraints.constrainHeight(totalHeight) | ||
| ); | ||
| } | ||
|
|
| this.width = width; | ||
| this.height = height; | ||
|
|
||
| List<Float> heights = new ArrayList<>(childSizes.size()); |
| } | ||
|
|
||
| // ── component builders ── | ||
|
|
…and CI configuration
…tive UI components
…iers for layout and styling
… in UI components
…d and border elements
…dComponent for grid layout
…tests and update Slider/TextField components to use Consumer for change handling
…lified Consumer type for change handling
…een for improved rendering
…DeclarativeScreen with scroll handling
…adow in text rendering
…proved component organization
…sting component initializations
…d scroll handling
…for UI components
…ldren accordingly
…nent measurement logic
…e hover state handling
…nd color handling
…d update mod name formatting
…y position management
… scrolling support
…d update UI components to use new method signatures
# Conflicts: # .github/workflows/ci.yml # .github/workflows/pull_request.yml # .github/workflows/release.yml # module.rendering/src/main/java/dev/anvilcraft/lib/v2/rendering/sdf/Sdf2d.java # module.rendering/src/main/java/dev/anvilcraft/lib/v2/rendering/sdf/SdfParameters.java # module.rendering/src/main/java/dev/anvilcraft/lib/v2/rendering/sdf/SdfRenderType.java # module.rendering/src/main/resources/assets/anvillib_rendering/shaders/core/sdf_graphics.fsh # module.test/src/main/java/dev/anvilcraft/lib/v2/test/client/AnvilLibTestClient.java # module.test/src/main/java/dev/anvilcraft/lib/v2/test/client/gui/SdfGraphicsLayer.java # settings.gradle
|
❌ Non-retryable error (HTTP 402): HTTP 402: Insufficient Balance |
|
|
🌿 Roseau API Breaking Change Report
|
No description provided.