@dannytaurus said in Anyone doing this to declare components?:
Do you mean like this?
Kind of.
I split my scripts into lots of separate files, preferably one file per part of the project - what constitutes a part could be functionality, or it could be UI, I often have one namespace per main UI panel.
For example, I'll have a file called Presets.js which contains the Presets namespace and this contains everything related to preset handling, including the UI.
I'll have another file for handling expansions.
I'll have another one that handles a drop down menu in my plugin's header. This will have items for opening the Settings page, the About page, etc. This is an interesting one because the menu itself shouldn't know anything about the Settings or About pages, it doesn't need to.
But the Settings and About pages are aware of the menu's existence. So using broadcasters those namespaces can watch the menu and if the Settings option is selected the Settings namespace will show the correct panel, if the About option is selected then the About namespace will handle it. Everything is very self contained and links between namespaces/parts of the project are minimised as much as possible.
Here is what the on init section looks like for my current project. Nice and clean 😀
f0136148-47c7-4818-82cf-fc6d90abf1d0-image.png