This tool maps inherited content (including class members, attributes, CSS parts, CSS variables, slots, and events) from parent components in the Custom Elements Manifest (CEM). This helps in maintaining a clear and comprehensive documentation of web components and their inheritance hierarchy and reduces the need for duplicate documentation for component with shared APIs.
- Automatically updates the Custom Elements Manifest with inherited properties.
- Supports various inheritance types including class members, attributes, CSS parts, CSS variables, slots, and events.
- Configurable options to customize the inheritance mapping process.
- Integrates with JSDoc tags for additional customization.
To install the package, use the following command:
npm install @wc-toolkit/cem-inheritance
This package includes two ways to update the Custom Elements Manifest:
- using it in a script
- as a plugin for the Custom Element Manifest Analyzer.
// my-script.js
import { updateCemInheritance } from "@wc-toolkit/cem-inheritance";
import manifest from "./path/to/custom-elements.json" with { type: 'json' };
const options = {...};
updateCemInheritance(manifest, options);
The plugin can be added to the Custom Elements Manifest Analyzer configuration file.
// custom-elements-manifest.config.js
import { cemInheritancePlugin } from "@wc-toolkit/cem-inheritance";
const options = {...};
export default {
/** Enable this if you are extending a third-party library */
dependencies: true,
plugins: [
cemInheritancePlugin(options)
],
};
Check out the documentation to see how to configure this to meet your project's needs.