Frontmatter
| id | 7019 |
| title | Refactor `defineComponent` and Enhance Config System Documentation |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Jul 11, 2025, 6:32 PM |
| updatedAt | Jul 11, 2025, 6:47 PM |
| githubUrl | https://github.com/neomjs/neo/issues/7019 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 6992 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jul 11, 2025, 6:47 PM |
Refactor defineComponent and Enhance Config System Documentation
tobiu assigned to @tobiu on Jul 11, 2025, 6:32 PM
tobiu added parent issue #6992 on Jul 11, 2025, 6:32 PM
tobiu closed this issue on Jul 11, 2025, 6:34 PM

tobiu
Jul 11, 2025, 6:45 PM
let us enhance the setupClass() docs a bit more, to point out the gatekeeper role.
tobiu reopened this issue on Jul 11, 2025, 6:45 PM
tobiu closed this issue on Jul 11, 2025, 6:47 PM
Summary
This work involved two main parts:
defineComponentfactory to use a more intuitive and accurate API.1.
defineComponentRefactoringThe
defineComponentfunction was updated to accept aconfigproperty in its specification object instead of the more genericstaticproperty.Before:
defineComponent({ static: { className: '...', text_: 'Hello' } });After:
defineComponent({ config: { // More descriptive and accurate className: '...', text_: 'Hello' } });Reasoning
configdirectly maps to thestatic configproperty on the generated class, making the API more transparent and reducing the mental overhead for developers.staticwas too generic, as its only purpose was to define configs.2. Configuration System JSDoc Enhancements
Extensive improvements were made to the JSDocs in
src/core/Base.mjsandsrc/Neo.mjs.Key Improvements
core.Base.mjs(static config):name_) and non-reactive, prototype-based configs.beforeGet<Name>(),beforeSet<Name>(), andafterSet<Name>(), including their parameters.core.Base.mjs(applyOverwrites):Neo.overwritesmechanism.Neo.mjs(setupClass):applyOverwrites, connecting the global overwrite mechanism to the class setup lifecycle.Outcome
The framework's API is now more intuitive, and the documentation for its sophisticated configuration system is significantly clearer and more comprehensive. This will lower the learning curve for new developers and serve as a better reference for experienced ones.