| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 206e6e8 commit 8765eaf
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,97 @@ | |||
| 1 | + # CLAUDE.md | ||
| 2 | + | ||
| 3 | + This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
| 4 | + | ||
| 5 | + ## Project Overview | ||
| 6 | + | ||
| 7 | + PatternFly Java is a pure Java implementation of [PatternFly](https://www.patternfly.org/) web UI components. No JavaScript dependencies (except charts). Built on Elemento's builder API, compatible with both GWT and J2CL compilation targets. Published under `org.patternfly` on Maven Central. | ||
| 8 | + | ||
| 9 | + ## Build Commands | ||
| 10 | + | ||
| 11 | + | Command | Purpose | | ||
| 12 | + |---------|---------| | ||
| 13 | + | `mvn clean verify` | Full build with all checks (format, checkstyle, tests) | | ||
| 14 | + | `mvn verify -Dquickly` | Quick build (skip tests, checkstyle, javadoc) | | ||
| 15 | + | `mvn test -Dtest=ModifierTest` | Run a single test class | | ||
| 16 | + | `mvn test -Dtest=ModifierTest#testModifiers` | Run a single test method | | ||
| 17 | + | `mvn j2cl:watch -P showcase` | Watch J2CL compilation for showcase dev | | ||
| 18 | + | `cd showcase && npm run watch` | Watch CSS/HTML and serve showcase locally | | ||
| 19 | + | `mvn clean package -P showcase,prod` | Build production showcase | | ||
| 20 | + | ||
| 21 | + Uses Maven Wrapper (`mvnw`). Requires Java 21+ and Maven 3.9.9+. | ||
| 22 | + | ||
| 23 | + ## Module Structure | ||
| 24 | + | ||
| 25 | + - **bom** - Bill of Materials for dependency version management | ||
| 26 | + - **core** - Core classes, handlers, styles, utilities (`org.patternfly.core`, `org.patternfly.style`, `org.patternfly.handler`) | ||
| 27 | + - **components** - All UI components (`org.patternfly.component.*`) — 50+ component packages | ||
| 28 | + - **layouts** - Page layouts (Page, Sidebar, etc.) | ||
| 29 | + - **icons** - IconSets (FontAwesome, PatternFly icons) | ||
| 30 | + - **tokens** - PatternFly design tokens as enum constants | ||
| 31 | + - **charts** - Chart web components wrapper (NPM package) | ||
| 32 | + - **extensions/codeeditor**, **extensions/finder** - Extensions | ||
| 33 | + - **gwt**, **j2cl** - Compilation target support | ||
| 34 | + - **showcase** - Interactive demo website | ||
| 35 | + | ||
| 36 | + ## Architecture & Patterns | ||
| 37 | + | ||
| 38 | + **Fluent Builder API**: All components use method chaining with static factory methods: | ||
| 39 | + ```java | ||
| 40 | + Button button = button("Click me").danger().disabled(false).onClick((e, c) -> {}); | ||
| 41 | + ``` | ||
| 42 | + | ||
| 43 | + **Static Factory Methods**: Components are created via lowercase factory methods named after the component (e.g., `button()`, `card()`, `cardBody()`). | ||
| 44 | + | ||
| 45 | + **Component Composition**: Components compose sub-components via `add<SubComponent>()` methods: | ||
| 46 | + ```java | ||
| 47 | + card().addHeader(cardHeader()).addBody(cardBody()).addFooter(cardFooter()); | ||
| 48 | + ``` | ||
| 49 | + | ||
| 50 | + **Modifier Interfaces**: Shared behavior through interfaces in `Modifiers.*` (e.g., `Disabled`, `Plain`, `Primary`, `Compact`). Modifier methods toggle CSS classes and return `this`. | ||
| 51 | + | ||
| 52 | + **Event Handlers**: Follow `on<Event>()` naming with `(event, component)` lambda signature. Handler interfaces are in `org.patternfly.handler`. | ||
| 53 | + | ||
| 54 | + **CSS Classes**: Applied via helpers from `org.patternfly.style.Classes`: | ||
| 55 | + ```java | ||
| 56 | + element().css(component(button, Classes.text)); | ||
| 57 | + element().css(modifier("danger")); | ||
| 58 | + ``` | ||
| 59 | + | ||
| 60 | + ## Source File Conventions | ||
| 61 | + | ||
| 62 | + **Section Comments**: Code is organized with section markers: | ||
| 63 | + ```java | ||
| 64 | + // ------------------------------------------------------ factory | ||
| 65 | + // ------------------------------------------------------ instance | ||
| 66 | + // ------------------------------------------------------ add | ||
| 67 | + // ------------------------------------------------------ builder | ||
| 68 | + // ------------------------------------------------------ aria | ||
| 69 | + // ------------------------------------------------------ events | ||
| 70 | + // ------------------------------------------------------ api | ||
| 71 | + // ------------------------------------------------------ internal | ||
| 72 | + ``` | ||
| 73 | + | ||
| 74 | + **Naming Conventions**: | ||
| 75 | + - Factory methods: component name (`button()`, `card()`) | ||
| 76 | + - Add methods: `add<Component>()` | ||
| 77 | + - Modifier methods: property name (`flat()`, `plain()`) | ||
| 78 | + - Event handlers: `on<Event>()` | ||
| 79 | + - ARIA methods: `aria<Attribute>()` | ||
| 80 | + | ||
| 81 | + **Demo/Snippet Code**: Located in `src/demo/java/` per module, used in JavaDoc via `--snippet-path`. | ||
| 82 | + | ||
| 83 | + ## Formatting & Code Quality | ||
| 84 | + | ||
| 85 | + - 4 spaces indent, 128 char max line length, LF line endings, UTF-8 | ||
| 86 | + - **No final newline** (`insert_final_newline = false`) | ||
| 87 | + - Import order enforced: `java.` → `javax.` → `jakarta.` → `org.` → `io.` → `com.`, then static imports | ||
| 88 | + - Checkstyle: WildFly rules | ||
| 89 | + - License headers: Apache 2.0 (enforced by build) | ||
| 90 | + - All checks run on `mvn clean verify` | ||
| 91 | + | ||
| 92 | + ## Key Dependencies | ||
| 93 | + | ||
| 94 | + - **Elemento** (2.4.9) - Base builder API and DOM utilities | ||
| 95 | + - **Elemental2** (1.3.2) - Typed DOM API bindings | ||
| 96 | + - **GWT** (2.13.0) - GWT compilation support | ||
| 97 | + - **JUnit Jupiter** (6.0.3) - Test framework | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments