Skip to content

fix(docs): include exportparts in component parts - #7047

Merged
johnjenkins merged 3 commits into
stenciljs:mainfrom
marcomattes:feat/docs-exportparts
Nov 26, 2026
Merged

johnjenkins merged 3 commits into
stenciljs:mainfrom
marcomattes:feat/docs-exportparts

Conversation

@marcomattes

@marcomattes marcomattes commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What is the current behavior?

Stencil infers a component's CSS parts from part="…" in render(), but ignores exportparts. Parts forwarded from a child element therefore never show up in docs-json, the readme, or the Custom Elements Manifest cssParts, unless they are documented by hand with @part.

render() {
  return <inner-button exportparts="label, icon: btn-icon" />;
}
// docs/CEM parts today: []

GitHub Issue Number: N/A

What is the new behavior?

gatherVdomMeta now also reads exportparts and adds the outward-facing part names to htmlParts, which already feeds docs-json, readme and CEM cssParts:

  • label → label
  • icon: btn-icon → btn-icon (the name consumers style with ::part())
  • Values that can't be resolved statically are skipped, same as part.
  • exportparts on <Host> is ignored: it re-exports this component's own parts into its parent's scope and is not part of this component's API.

Descriptions still come from @part JSDoc tags (merged by name as before).

Documentation

N/A

Does this introduce a breaking change?

  • Yes
  • No

Testing

Added unit tests to src/compiler/transformers/test/parse-vdom.spec.ts (outward-facing names incl. mappings and whitespace, <Host> ignored, dynamic value skipped). The first two fail without the change.

  • npx jest src/compiler/transformers/test/parse-vdom.spec.ts src/compiler/docs: passed, 127 tests
  • npm run build: passed
  • eslint / prettier --check / cspell on the changed files: passed

Other information

N/A

@marcomattes
marcomattes requested a review from a team as a code owner November 26, 2026 09:02
@marcomattes
marcomattes changed the base branch from v5 to main November 26, 2026 12:54
@marcomattes
marcomattes force-pushed the feat/docs-exportparts branch from d06b3e0 to 2e60e80 Compare November 26, 2026 12:54
johnjenkins and others added 2 commits November 26, 2026 23:44
`part` on `<Host>` styles the host from the parent's scope, so it is not one of this component's parts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@johnjenkins johnjenkins changed the title feat(docs): include exportparts in component parts fix(docs): include exportparts in component parts Nov 26, 2026

@johnjenkins johnjenkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❤️

@johnjenkins
johnjenkins enabled auto-merge (squash) November 26, 2026 23:53
@johnjenkins
johnjenkins merged commit c65971f into stenciljs:main Nov 26, 2026
31 checks passed
johnjenkins added a commit that referenced this pull request Nov 27, 2026
* fix(docs): include exportparts in component parts

* fix(docs): ignore part on Host and share part/exportparts parsing

`part` on `<Host>` styles the host from the parent's scope, so it is not one of this component's parts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: John Jenkins <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants