Skip to content

feat: add partMap directive for dynamic part names#12226

Merged
vursen merged 2 commits into
mainfrom
add-part-map-directive
Jul 24, 2026
Merged

feat: add partMap directive for dynamic part names#12226
vursen merged 2 commits into
mainfrom
add-part-map-directive

Conversation

@vursen

@vursen vursen commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Lit ships classMap for applying dynamic class names, but has no equivalent for the part attribute. This PR adds a partMap directive to @vaadin/component-base that follows the same approach as classMap, just for part names: it applies part names from a key-value map, updates the element's part token list in place after the first render, and never removes part names declared statically in the attribute.

Part of #10789

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — left 1 comment.

Finding
⚠️ PartNameInfo type forbids null/undefined, but the directive supports them and the tests pass them.

Comment thread packages/component-base/src/directives/part-map.d.ts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@vursen
vursen merged commit 9d60cf2 into main Jul 24, 2026
10 checks passed
@vursen
vursen deleted the add-part-map-directive branch July 24, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants