cem-plugin
A plugin for
@custom-elements-manifest/analyzer
that teaches it to read wcb’s static props object.
import { wcbStaticProps } from 'web-component-base/cem-plugin'// also available as the module's default exportimport wcbStaticProps from 'web-component-base/cem-plugin'See the CEM Analyzer Plugin guide for setup, Storybook and editor integration.
wcbStaticProps()
Section titled “wcbStaticProps()”Takes no arguments and returns an analyzer plugin object.
| Field | Type | |
|---|---|---|
name | string | the plugin name |
analyzePhase | (ctx: any) => void | the analyzer hook |
import { wcbStaticProps } from 'web-component-base/cem-plugin'
export default { globs: ['src/**/*.js'], outdir: '.', plugins: [wcbStaticProps()],}What it does
Section titled “What it does”For each class that extends WebComponent, it reads the static props
initializer and, for every key, records in the manifest:
- the member under its camelCase name
- the attribute under its kebab-case name, linked to that member
- the type inferred from the default value —
boolean,number,objectorstring - the default value as written
Without it the analyzer sees props as one opaque static field and emits no
attributes, so editor completion and Storybook controls have nothing to read.
The static props object may be declared inline or as an identifier resolved
from the same source file.