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

@storybook-extras/variants not working with Lit web component #77

Open
dakdh opened this issue Apr 14, 2023 · 1 comment
Open

@storybook-extras/variants not working with Lit web component #77

dakdh opened this issue Apr 14, 2023 · 1 comment

Comments

@dakdh
Copy link

dakdh commented Apr 14, 2023

Hi @sheriffMoose, this addon is a cool project. Thanks for sharing it with the world.

I wanted to try it out on a new Storybook 7.0 project I'm working on, which is using @storybook/web-components and Vite. To get started I followed the instructions here: https://github.com/sheriffMoose/storybook-extras/tree/master/packages/variants#readme

But when I look at the story where I've added

parameters: {
    variants: {
      enable: true
    },
  },

I get the following error, and my component isn't rendered in the Storybook canvas:

Screenshot 2023-04-14 at 15 34 22

I'm not sure if there's an issue in _populateStoryTemplate() or in one of the other functions called before it in _init(), but without modifying your code locally, my assumption is that there's an problem due to my component/story using @storybook/web-components and/or Lit's html template literal function.

Here are the relevant parts of my package.json:

  "dependencies": {
    "lit": "2.7.2"
  },
  "devDependencies": {
    "@storybook-extras/variants": "^0.0.68",
    "@storybook/addon-essentials": "7.0.3",
    "@storybook/addon-links": "7.0.3",
    "@storybook/blocks": "7.0.3",
    "@storybook/web-components": "7.0.3",
    "@storybook/web-components-vite": "7.0.3",
    "sass": "1.62.0",
    "storybook": "7.0.4",
    "typescript": "5.0.4",
    "vite": "4.2.1"
  },
@sheriffMoose
Copy link
Owner

hi @dakdh, thanks for reaching out, when I developed this addon, I've taken into consideration both angular & react. If you would like to submit a PR to support web-components as well, that would be great.

Otherwise, I will create a PR as soon as possible and keep you posted.

Thanks again :)

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

No branches or pull requests

2 participants