Skip to content

feat: Add Invoker Commands support for DBButton#6603

Open
mfranzke wants to merge 14 commits into
mainfrom
feat-add-invoker-commands-support-for-DBButton
Open

feat: Add Invoker Commands support for DBButton#6603
mfranzke wants to merge 14 commits into
mainfrom
feat-add-invoker-commands-support-for-DBButton

Conversation

@mfranzke
Copy link
Copy Markdown
Collaborator

@mfranzke mfranzke commented May 1, 2026

Proposed changes

Enable Invoker Commands API (command- and commandfor-HTML-attributes) for DBButton. It's a well established, baseline feature that users might wanna use in their websites and applications, so we should provide support for it.

Additionally we need to mitigate React being late to the party again (missing support / types).

And further enhancing resilience on an internal replacement regarding attribute naming (for phrase, which is part of the phrase commandfor as well).

Types of changes

  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improvements to existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Further comments

🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/feat-add-invoker-commands-support-for-DBButton

Enable Invoker Commands for DBButton using command attributes.
@mfranzke mfranzke self-assigned this May 1, 2026
@mfranzke mfranzke added the 🍄🆙improvement New feature or request label May 1, 2026
@github-project-automation github-project-automation Bot moved this to 🏗 In progress in UX Engineering Team Backlog May 1, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 1, 2026

🦋 Changeset detected

Latest commit: 7f8cad4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@db-ux/ngx-core-components Minor
@db-ux/react-core-components Minor
@db-ux/wc-core-components Minor
@db-ux/v-core-components Minor
@db-ux/core-foundations Minor
@db-ux/core-components Minor
@db-ux/core-stylelint Minor
@db-ux/core-migration Minor
@db-ux/agent-cli Minor
@db-ux/core-eslint-plugin Minor
@db-ux/core-vite-plugin Minor
@db-ux/core-postcss-plugin Minor
@db-ux/mcp-server Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the 📕documentation Improvements or additions to documentation label May 1, 2026
Augment React's ButtonHTMLAttributes with command and commandfor attributes for Invoker Commands API support.
mfranzke added 3 commits May 1, 2026 09:50
Safeguard our current replacements due to new attributes that include the phrase `for` as well (`commandfor`).
Added command and commandfor attributes to DBButtonDefaultProps type.
@mfranzke mfranzke moved this from 🏗 In progress to 🎁 Ready for review in UX Engineering Team Backlog May 1, 2026
@mfranzke mfranzke marked this pull request as ready for review May 1, 2026 07:53
@mfranzke mfranzke enabled auto-merge (squash) May 1, 2026 07:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for the HTML Invoker Commands API to DBButton across generated framework outputs, including a React-specific workaround for missing attribute typings, and hardens a Stencil post-build replacement to avoid corrupting commandfor.

Changes:

  • Extend DBButton props and rendering to forward command and commandfor to the underlying <button>.
  • Add a React post-build step that generates a React type augmentation file and wires it into the React output entrypoint.
  • Update the Stencil post-build for={htmlFor={ replacement to avoid affecting commandfor={.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/components/src/components/button/model.ts Adds new optional command/commandfor props to DBButton’s public API.
packages/components/src/components/button/button.lite.tsx Forwards command/commandfor props to the rendered <button>.
packages/components/scripts/post-build/stencil.ts Uses a safer regex replacement to avoid transforming commandfor.
packages/components/scripts/post-build/react.ts Generates React type augmentation for command/commandfor and appends an import to the React entrypoint.
.changeset/invoker-commands.md Adds a changeset for the feature (framework packages only).

Comment thread packages/components/scripts/post-build/react.ts Outdated
Comment thread .changeset/invoker-commands.md
Comment thread packages/components/src/components/button/button.lite.tsx
auto-merge was automatically disabled May 9, 2026 16:07

Head branch was pushed to by a user without write access

@mfranzke mfranzke enabled auto-merge (squash) May 11, 2026 06:11
auto-merge was automatically disabled May 11, 2026 06:44

Head branch was pushed to by a user without write access

@mfranzke mfranzke added this to Roadmap May 13, 2026
@mfranzke mfranzke added this to the 4.9.0 milestone May 13, 2026
@mfranzke mfranzke requested a review from Copilot May 13, 2026 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comment on lines +103 to +114
const cleanupFilePaths = [
`${srcFolder}/invoker-commands.ts`,
`${srcFolder}/invoker-commands.d.ts`,
`${outputFolder}/dist/invoker-commands.js`,
`${outputFolder}/dist/invoker-commands.d.ts`,
...(tmp
? []
: [
'../../build-outputs/react/dist/invoker-commands.js',
'../../build-outputs/react/dist/invoker-commands.d.ts'
])
];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need this? We never write those files

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot why do we need this ?

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.

349034c added that cleanup only to remove stale artifacts from earlier builds. We no longer generate invoker-commands*, but our React flow copies/overwrites existing directories (cpr --overwrite) and tsc also does not clean dist, so old output/react/src/invoker-commands.ts, output/react/dist/invoker-commands.js, or build-outputs/react/dist/invoker-commands.js can survive incremental/local rebuilds and still get published. So those paths are not newly written anymore—they are just purged if they were left over from the previous implementation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@nmerget I guess Copilot means: PRs welcome, let's fix React together !

Comment on lines +139 to +147
let indexContent = readFileSync(indexFilePath).toString('utf-8');
indexContent = indexContent.replace(
/\nimport(?: type \{\} from)? ['"]\.\/invoker-commands['"];\n?/g,
'\n'
);

if (!indexContent.includes(typeAugmentationMarker)) {
indexContent += content;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The file is genereated completely new isn't it? Why do we need this check here. I guess we can just append it to the bottom of the file

@nmerget nmerget moved this from 🎁 Ready for review to 🎶 Waiting for feedback in UX Engineering Team Backlog May 18, 2026
@mfranzke mfranzke modified the milestones: 4.9.0, 4.10.0 May 20, 2026
@michaelmkraus michaelmkraus modified the milestones: 4.10.0, 4.11.0 May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏘components 📕documentation Improvements or additions to documentation 🍄🆙improvement New feature or request

Projects

Status: No status
Status: 🎶 Waiting for feedback

Development

Successfully merging this pull request may close these issues.

5 participants