Open r1m opened 7 months ago
I'm not sure that this is the expected source:
<my-element name="Lit"></my-element>
That is the resulting DOM after setting the .name
property on the element. The source that would get that DOM the same way Storybook's renderer would depends on the library you use to render, ie Lit and React:
Lit:
html`<my-element .name=${'Lit'}></my-element>
React:
<my-element name={'Lit'} />
This would be more apparent with non-reflecting properties, where the attribute and properties don't match.
I agree that properties should not be reflected in the code. But attributes and reflecting attributes should. Right now unless I provide a custom render function, the code displayed in the canvas is always empty.
I expect the code to reflect the values set on the control like it does on react : https://master--5ccbc373887ca40020446347.chromatic.com/?path=/docs/badge--docs
Updated stackblitz with latest version and custom-element manifest https://stackblitz.com/edit/github-mqfend-rb55b5?file=src%2Fstories%2Fmy-element.stories.ts
Describe the bug
Using a webcomponent renderer, the source code on Canvas/Source block is not correctly generated. The component is correctly rendered but the source code only shows an empty html element.
To Reproduce
Create a webcomponent story with
component
andargs
without custom render.https://stackblitz.com/edit/github-mqfend?file=src%2Fstories%2Fmy-element.stories.ts
It shows this has source code
The expected is
System
Additional context
The actual DOM node inserted inside the story block returns the right outerHTML