feat(UI): add AnvilLib-Ui module for declarative UI library#35
Draft
Gu-ZT wants to merge 67 commits into
Draft
Conversation
Contributor
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.
Contributor
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;
}
Comment on lines
+43
to
+44
| 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() { |
Comment on lines
+29
to
+33
| Composition comp = Composition.currentOrNull(); | ||
| if (comp != null && comp.currentSlot != null) { | ||
| comp.currentSlot.addReadState(this); | ||
| readers.add(comp.currentSlot); | ||
| } |
Comment on lines
+36
to
+38
| static ModifierElement width(float w) { | ||
| return new SizeElement(0, Float.MAX_VALUE, w, w); | ||
| } |
Comment on lines
+40
to
+42
| static ModifierElement height(float h) { | ||
| return new SizeElement(h, 0, h, Float.MAX_VALUE); | ||
| } |
Comment on lines
+359
to
+370
| 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 }} |
Comment on lines
+58
to
+60
| public MeasuredSize measure(Constraints constraints) { | ||
| if (children.isEmpty()) return MeasuredSize.ZERO; | ||
|
|
Comment on lines
+80
to
+84
| constraints.constrainWidth(maxWidth), | ||
| constraints.constrainHeight(totalHeight) | ||
| ); | ||
| } | ||
|
|
Comment on lines
+89
to
+92
| this.width = width; | ||
| this.height = height; | ||
|
|
||
| List<Float> heights = new ArrayList<>(childSizes.size()); |
Comment on lines
+41
to
+44
| } | ||
|
|
||
| // ── 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.