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

[Try] Add support for LitElement #7731

Closed
wants to merge 6 commits into from

Conversation

lonyele
Copy link
Member

@lonyele lonyele commented Aug 10, 2019

I'm pretty sure I'm not the best person doing this one, but I gave a shot for the super basic settings. I've read #4958, #6208, Polymer Issue etc... and came to a conclusion... that it is kind of complicated than I thought about this Web Components thing(first time looking at it...)

From the Polymer side there are polymer1/2, polymer3, lit-html, lit-element or any frameworks/compiler that converts things to web components such as stencil, svelte etc.

For the users, installing @storybook/web-components and it works for every case I wrote above is the best thing since It will be ended up just 'Web Components', but I'm not sure if it's possible(It looks easy on theory, but I'm not sure in practice) So I made the working example only for lit-element for a starter(@storybook/lit-element) I also have lit-html example on my local(possibly @storybook/lit-html and it's almost same as this PR)

I found that there are a lot discussions and opinions on this matter, I just want to hear some thoughts on this. For me, I don't really have much opinions(almost no knowledge and experience), just wanted to make things working(please ignore some copy/paste texts, I'll fix it once it looks ok)

What I did

  • Add @storybook/lit-element
  • Add lit-element-kitchen-sink example

Need help

  • Add any polyfills and more advanced webpack settings for different environments
  • @storybook/addon-link support. Everything is in shadow-dom and I couldn't make it working...
  • preset?
  • A lot... probably

@vercel
Copy link

vercel bot commented Aug 10, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-fork-lonyele-feature-support-lit-element.storybook.now.sh

// internally to cover the case using only html`...` instead of
// lit-element which makes using lit-html and lit-element at the same
// time.
LitElement.render(element, renderTo, { scopeName: '' });
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is a hack I've found...

@@ -0,0 +1,4 @@
module.exports = async ({ config }) => {
Copy link
Member Author

@lonyele lonyele Aug 10, 2019

Choose a reason for hiding this comment

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

This is the place where help is needed. Please see Also some advanced webpack settings. More example from open-wc

@lonyele
Copy link
Member Author

lonyele commented Aug 10, 2019

Oh... wait...

@@ -0,0 +1,31 @@
# Storybook for Polymer
Copy link
Member

Choose a reason for hiding this comment

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

probably this title needs to be adjusted to Lit-Element

Copy link
Member

Choose a reason for hiding this comment

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

Well, there are other mentions in the readme as well, work in progress I guess

Copy link
Member

Choose a reason for hiding this comment

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

great work btw!

@steel
Copy link
Contributor

steel commented Aug 15, 2019

This is neat. I'm also using this for custom elements with lit-element. We are using a custom decorator to detect the output type of the story and wrap it in a div if it's a lit template. Everything just works.

@lonyele
Copy link
Member Author

lonyele commented Aug 17, 2019

Hm... I'm not really sure, it is too small for a so called framework support... putting if/else at render is the only useful code...

@stale stale bot added the inactive label Sep 7, 2019
@stale stale bot removed the inactive label Sep 7, 2019
@ndelangen ndelangen self-assigned this Sep 27, 2019
@ndelangen
Copy link
Member

@fernandopasik @emilio-martinez Could we get a seal of approval from you or some assistance maybe getting this in a state it's merge-able?

@daKmoR daKmoR mentioned this pull request Oct 12, 2019
6 tasks
@lonyele
Copy link
Member Author

lonyele commented Oct 25, 2019

It looks like much better implementation(#8400) is merged. Check that out!

@lonyele lonyele closed this Oct 25, 2019
@lonyele lonyele deleted the feature/support-lit-element branch October 25, 2019 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants