JS Component Framework is a zero-dependency JavaScript library designed to simplify the configuration and attachment of JavaScript components to DOM elements. It is currently at stable version 3.2.0, with recent updates focusing on bug fixes and enhanced flexibility, such as improved `domContentLoaded` handling and custom root selector support. The framework allows components to be defined as either ES6 classes or functions, using `componentProvider` to automatically initialize them based on a configuration object. A key differentiator is its automatic collection of child nodes based on configuration, minimizing the need for manual DOM queries within components. This approach aims to streamline front-end development by centralizing DOM interaction logic and reducing boilerplate, offering a lightweight alternative to more comprehensive frameworks.
npm install js-component-frameworkVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to define an ES6 class component, configure its properties including child selectors and options, and initialize it using `componentProvider` for automatic DOM attachment and event handling.
Refer to the official 'Updating to v3' documentation in the GitHub Wiki for a comprehensive upgrade guide. Components must be adapted to either ES6 classes or functions, configured via `componentProvider`.
Ensure all imports use ES Module `import` syntax (e.g., `import { componentProvider } from 'js-component-framework';`). Update build configurations to handle ES Modules correctly if necessary.Upgrade to version 3.2.0 or newer to benefit from the fix that ensures the `domContentLoaded` callback executes only once. Alternatively, implement custom debouncing or flag checks in older versions if `config.load` relies on `DOMContentLoaded`.
For immediate loading in versions prior to 3.2.0, a custom `handler` function wrapping the provider call could be used. For `true` functionality, upgrade to v3.2.0+.
Refactor your import statements to use ES Module syntax: `import { componentProvider } from 'js-component-framework';`.Ensure `componentProvider` is imported as a named export: `import { componentProvider } from 'js-component-framework';`.Verify that the `name` property in your component configuration exactly matches the `data-component` attribute value on your HTML element. Alternatively, if using `root`, ensure the CSS selector is correct and targets existing elements.
Ensure your `config.component` property points to an actual ES6 class or a JavaScript function that defines your component's logic. Anonymous functions or arrow functions are valid if assigned correctly.
No dependency data recorded yet.