storybookjs/storybook

[Bug]: ArgTypes not inferred properly from `custom-elements.json` for cssProperties

Open

#26.395 aperta il 9 mar 2024

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (10.058 fork)batch import
bugdocgenhelp wantedsev:S3

Metriche repository

Star
 (89.909 star)
Metriche merge PR
 (Merge medio 7g 22h) (184 PR mergiate in 30 g)

Descrizione

Describe the bug

ArgTypes do not seem to be properly inferred from a custom-elements.json file.

Given this JSDoc for a custom element:

/**
 * An example element.
 *
 * @cssproperty {length} [--some-size=1em] - A comment about some size
 * @cssproperty [--animation-duration=1s] - Duration of the animation
 */

and the following custom-elements.json

"cssProperties": [
            {
              "type": {
                "text": "length"
              },
              "description": "The size of the circle",
              "name": "--circle-size",
              "default": "1em"
            },
            {
              "description": "Duration of the circle animation",
              "name": "--animation-duration",
              "default": "1s"
            }
          ],

The controls are displayed as "Object" instead of at least strings.

To Reproduce

https://stackblitz.com/~/github.com/peschee/storybook-cem-test

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/addon-links: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/blocks: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/test: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/web-components: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/web-components-vite: ^8.0.0-rc.3 => 8.0.0-rc.3 
    storybook: ^8.0.0-rc.3 => 8.0.0-rc.3

Additional context

No response

Guida contributor