WhatSock / apex

Apex 4X: The Comprehensive ARIA Development Suite
MIT License
29 stars 9 forks source link

Should mention dependencies in Widget documentation #61

Closed lukos closed 13 hours ago

lukos commented 4 days ago

I assume this is a general issue but, for example, Slider.js requires dragula.js but it doesn't say so in the documents, you have to see the console error.

Happy to do PR if you want to tell me how you would prefer it to be included.

accdc commented 4 days ago

Thanks, that is a good idea. I honestly never expected that the modules would be included without devs reading the JS files within the 4X/Standard/Modules folder to see what the dependencies were which are listed in the header of each module file.

This is challenging because some modules are not widget types, such as Slider, but some are featured actions, such as RovingTabIndex.js.

You can read about what this does in the Help folder in the download: Help/Module Imports/Actions/RovingTabIndex.txt

To know what RovingTabIndex requires you need to open the JS file 4X/Standard/Modules/RovingTabIndex.js and see what dependencies are listed in the header.

This is only necessary when manually adding script files though, which is why I tried to simplify it when creating the archive. Dynamic imports will automatically import all prior dependencies so the only one that matters is the primary one for the use of setting it up.

When manually adding scripts though, it is important to check the dependency list at the head of each JS script file to ensure that all loads correctly.

All manual scripts within the folder 4X/Standard/Modules should be used for this purpose since these are configured not to have any auto-import method calls.

Alternatively you can edit the BuildBundle.js file and only keep the modules you want to include, but you need to make sure you keep all the ones that have required dependencies by looking at the JS file first in the header. Then you can build your own bundle that has only what you want to use as one JS file to import.

accdc commented 4 days ago

FYI, I just pushed an update to the BuildBundle.js file that now includes references to all dependencies, so it should be easier to know what needs what by reading that file.

accdc commented 13 hours ago

Closing this issue as completed.