WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Non-primitive props should not be added to attributes with Stencil plugin #305

@Graphmaxer

Description

@Graphmaxer

Checklist

  • Did you run the analyzer with the --dev flag to get more information?
  • Did you create a minimal reproduction in the playground?

Non-primitive prop types (object, dates, etc...) should NOT be added to the attributes list in custom element manifest.

In this example we can see that object/date props are added as attributes:

https://custom-elements-manifest.netlify.app/?source=CmltcG9ydCB7IENvbXBvbmVudCwgUHJvcCB9IGZyb20gJ0BzdGVuY2lsL2NvcmUnOwoKQENvbXBvbmVudCh7CiAgdGFnOiAnbXktZWxlbWVudCcsCn0pCmV4cG9ydCBjbGFzcyBNeUVsZW1lbnQgewogIEBQcm9wKCkgY29sb3I6IHN0cmluZzsKCiAgQFByb3AoKSBvYmplY3RXaXRoS2V5d29yZDogb2JqZWN0OwoKICBAUHJvcCgpIG9iamVjdFdpdGhUeXBlOiB7IGZvbzogc3RyaW5nIH07CgogIEBQcm9wKCkgZGF0ZTogRGF0ZTsKfQo%3D&library=stencil

This is strange because this behavior is documented here with a comment https://github.com/open-wc/custom-elements-manifest/blob/master/packages/analyzer/src/features/framework-plugins/stencil/stencil.js#L57 but this is not implemented like this. In the past this behavior was right 1d4c7b1#diff-4052a5b77a3c558016f33f9b0ff894ea7c3337023d3132e32de0536c6a1ca753L69 but I got replaced for some reasons :/

In my case, this causes an issues with https://github.com/wc-toolkit/storybook-helpers because object prop cannot be an attribute, preventing the correct control type in Storybook (https://github.com/wc-toolkit/storybook-helpers/blob/main/src/cem-parser.ts#L385).

Expected behavior

Non-primitive props should be added to attributes list, only in members

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions