leonvogt/hotwire-dev-tools

Highlight non registered Stimulus controllers

Closed this issue · 1 comments

It would be handy to have a "connected indicator" in the Stimulus tab, which indicates if the Stimulus identifier was found on the window.Stimulus object.

List of all Stimulus controllers, in the current context:

window.Stimulus?.controllers.map(controller => controller.scope.identifier)

Since the content script doesn't have access to the same window object, we have to inject a custom JS file which will gather the currently registered controllers.

Also, although window.Stimulus is the default we probably need to let the user configure the mapped window application.

References:

The non registered Stimulus controllers are getting highlighted now, but we are only checking window.Stimulus.
In the future we should find a way to handle different Stimulus application names as well.