Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular: Add type support for Angular's input signals #26413

Merged
merged 12 commits into from Mar 20, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Mar 11, 2024

Closes #25784

What I did

Support the new signal-based input function in Angular 17.2 and upwards in Storybook's helper types as StoryObj or StoryFn. I also ensured that TypeScript doesn't complain in Angular versions that don't support this feature.

Please be aware, that controls might not reflect the proper types when Signals are used. For component and property analysis, we are relying on compodoc. There is a PR, which adds signal-based input support, but the change isn't released yet. In the meantime, you would have to manually set the argTypes as described here: https://storybook.js.org/docs/api/arg-types

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. Run a latest Angular sandbox (angular-cli/default-ts)
  2. Open the story src/stories/frameworks/angular_angular-cli-prerelease/signal/button.stories.ts
  3. Make sure that for example the type for the size argument gets properly inferred
Bildschirmfoto 2024-03-18 um 08 41 55

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-26413-sha-81812663. Try it out in a new sandbox by running npx storybook@0.0.0-pr-26413-sha-81812663 sandbox or in an existing project with npx storybook@0.0.0-pr-26413-sha-81812663 upgrade.

More information
Published version 0.0.0-pr-26413-sha-81812663
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/add-input-support-for-angular
Commit 81812663
Datetime Mon Mar 11 14:17:46 UTC 2024 (1710166666)
Workflow run 8234365613

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=26413

@valentinpalkovic valentinpalkovic self-assigned this Mar 11, 2024
@valentinpalkovic valentinpalkovic added feature request ci:normal angular patch:yes Bugfix & documentation PR that need to be picked to main branch labels Mar 11, 2024
Copy link

nx-cloud bot commented Mar 11, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 607e2bf. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic force-pushed the valentin/add-input-support-for-angular branch from d30c517 to 8181266 Compare March 11, 2024 14:17
@valentinpalkovic valentinpalkovic force-pushed the valentin/add-input-support-for-angular branch from fd040d1 to 762a61f Compare March 17, 2024 09:23
@valentinpalkovic valentinpalkovic changed the title Angular: Add support for Angular's new input signal Angular: Add support for Angular's input signal Mar 17, 2024
@valentinpalkovic valentinpalkovic changed the title Angular: Add support for Angular's input signal Angular: Add support for Angular's input signals Mar 17, 2024
@valentinpalkovic valentinpalkovic added ci:daily Run the CI jobs that normally run in the daily job. and removed patch:yes Bugfix & documentation PR that need to be picked to main branch ci:normal labels Mar 17, 2024
@valentinpalkovic valentinpalkovic marked this pull request as ready for review March 17, 2024 16:36
@valentinpalkovic valentinpalkovic merged commit c2fd3a4 into next Mar 20, 2024
92 of 109 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/add-input-support-for-angular branch March 20, 2024 09:48
@github-actions github-actions bot mentioned this pull request Mar 20, 2024
11 tasks
@valentinpalkovic valentinpalkovic changed the title Angular: Add support for Angular's input signals Angular: Add type support for Angular's input signals Mar 20, 2024
@attilacsanyi
Copy link

attilacsanyi commented Apr 23, 2024

@valentinpalkovic compodoc 1.1.24 has been released 👏 for @vogloblinsky. I just tried "@storybook/addon-docs": "8.1.0-alpha.7", but still not renders properly. What else needed for even render a boolean control?

Angular

disabled = input(false, { transform: booleanAttribute });

Compodoc JSON (v1.1.24)

"propertiesClass": [
{
    "name": "disabled",
    "defaultValue": "input(false, { transform: booleanAttribute })",
    "deprecated": false,
    "deprecationMessage": "",
    "type": "",
    "optional": false,
    "description": "",
    "line": 15
},
...

Storybook

image

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
angular ci:daily Run the CI jobs that normally run in the daily job. feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Angular & Typescript: Update StoryObj to handle new InputSignal
3 participants