This custom elements manifest analyzer plugin adds support for resolving complex types in custom element properties
npm install --save-dev cem-plugin-complex-types- Add
cem-plugin-complex-typesto your cem config - Link a css file in your storybook's
preview-head.html
// custom-elements-manifest.config.mjs
import cemPluginComplexTypes from 'cem-plugin-complex-types'
export default {
// ...
plugins: [
// ...
cemPluginComplexTypes(['./src/**/*.ts']),
],
};// .storybook/preview-head.html
<link rel="stylesheet" href="node_modules/cem-plugin-complex-types/preview-head-fix.css" />(Click on a question to see the answer.)
Q: Can it handle classes, interfaces, unions as well as primitive types?
A: Yes, the plugin should be able to handle all of these types. It will resolve the type to its source code and display it in the Storybook addon panel. If the type is a class or interface, it will show the properties and methods of that type. If it's a union type, it will show all possible types in the union.
We encourage you to contribute to this project! Please check out the Contributing guide for guidelines about how to proceed and how to set up your dev environment. Join us!
CEM-Plugin-Complex-Types is released under the MIT License.
