Giter Site home page Giter Site logo

hotwire-dev-tools's People

Contributors

dependabot[bot] avatar leonvogt avatar lirtistan avatar ydah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lirtistan ydah

hotwire-dev-tools's Issues

Add an Event list

Maybe we could add an event list that logs various Turbo and Stimulus events. For example:

11:56:05  turbo:load 
11:56:06  turbo:click
11:56:07  turbo:before-stream - received Turbo Stream: [...]
11:58:01  turbo:before-submit
11:58:02  turbo:submit-end
11:58:03  turbo:morph

Since this can pretty quickly become noisy, we probably want to have a way to filter the possible events.

Highlighting Turbo Frames could break layouts

When highlighting Turbo Frames we:

  • Set the display property of the frame to block
  • Set a border-radius of 5px to the frame
  • Insert a info badge with position: relative; to the frame

All of these have the potential to break layouts.

Not quite sure how we can avoid this.
The most problematic is probably the display: block property.
We could try to wrap the frame in a div and apply the styles to the div instead.
That way if a user has some custom styles for the frame, they won't be overwritten.
This would solve some of the problems, but I'm sure there are still many situations where this would break.


Another solution would be, to have an extra div with position: absolute; on top of the Turbo Frame.
Similar to the overlay function we have for highlighting whole elements and not just borders.

Track time of eager-loading Turbo Frames

Track the time it takes for a eager-loaded (or lazy-loaded) Turbo Frames to load.
This information could be displayed in the Turbo Frame tab from the detail panel, or directly in the DOM besides the Turbo Frame info badge.

Icon visibility in dark mode browser

Hi, I just installed this extension, and I have hard time seeing it in my toolbar in dark mode browser. It's just a minor annoyance, nothing serious, but if it's possible to maybe have different icon for dark mode, or make icon work in both modes (maybe black lightning bolt with white outline would work?), it would be neat :)

Screenshot from 2024-06-10 10-32-29

Add custom color highlighting for nested Turbo Frames

Hi,

nested turbo frames should have a differnt color so we can distinguish there boundings.

<div class="w-75 mx-auto mt-9">
	<%= turbo_frame_tag "foo" do %>
		<p>stuff in "foo" frame</p>
		<%= turbo_frame_tag "bar" do %>
			<p>some stuff in inner "bar" frame</p>
		<% end %>
	<% end %>
</div>

looks actually like this...

Screenshot from 2024-06-10 19-30-19

Actually i don't know how hard it is to implement, but maybe in a future version, that whould be a nice feature.

Improve Element Highlighting

Currently, we have two methods to highlight Turbo Frames:

  1. Direct Outline:
    • Add an outline directly to the frame.
    • Set the display property to block.

This approach is more reliable and is the default behavior of this extension.
However, setting the display property to block can break the layout of the page.

  1. Additional div Element:
    • Add a div element with the same dimensions as the frame.
    • Set the position to absolute and add the outline to the div.

This approach is less intrusive to the page layout but can be less reliable. If the frame changes size and we don’t detect it, the outline will be incorrect. It also impacts performance as it requires adding multiple additional elements to the page.


Highlighting Stimulus controllers presents a similar issue. When we add an outline to the controller element, we assume the element and a potential outline is visible. However, if the element has for example display: contents, the outline won’t be visible.


I currently don't have a good solution for this, but I hope we can come up with a more reliable method in the future for highlighting elements.

Propagate the version inside popup.html

Hi,

maybe a god enhancement to propagate the version inside popup.html.

const version = chrome.app.getDetails().version

Helps to indentify the version inside issues (Screenshots).

Display warnings

Like:

  • Multiple Turbo Frames with the same ID
  • Turbo Stream with a non existing target
  • Empty data-controller attribute

Prevent CSS leak

Currently the HTML and CSS of the Dev Tools lives in the same context as the inspected web page. This means that the web page can alter the styles of the Dev Tools, which is far from ideal.

The proper solution seems to be, to use custom elements and scope the styles of the Dev Tools to the shadow DOM of the
custom elements.
To create custom elements in a content script however, isn't as straight forward as I would like.
After some research, I found two ways to create custom elements in a content script (there might be more):

  • Using polyfills
  • Using a injection pipeline like ProjectVisBug does (Background service worker which injects a scripts to the web page which itself injects the main content script)
    Also there still seems to be lack of background service worker support in Firefox for Manifest v3.
    So we would need to support two different Manifests to support Chrome and Firefox. (Not sure about Safari)

I love neither of these solutions, because of the overhead and complexity they would introduce.
Even though it would be nice to have custom elements, maybe it's enough to use a shadow DOM for the Dev Tools content.
This would solve the style leak issue and is much easier to implement.

Highlight non registered Stimulus controllers

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:

Add application name option

Currently this Dev Tools makes an assumption, that your Stimulus application is assigned to window.Stimulus and Turbo to window.Turbo.
Since you can customize these names, it would be nice to have configurable options for the Stimulus and Turbo application name.

The only tricky part will probably be to the fetch the application name in the inject.js file, since we don't have access to the chrome.storage API.
One option would be to define a meta tag with the application name, before loading the inject.js file.

Display additional Hotwire infos

Like:

  • Turbo Drive activated?
  • Turbo Prefetch activated?
  • Turbo -/ Stimulus version (if that is somehow possible to figure out programmatically)
  • Meta tags
    • turbo-refresh-method
    • turbo-refresh-scroll
    • turbo-visit-control
    • turbo-cache-control
    • view-transition

Show connection between elements

Inspired by the TurboBoost Devtools, it would be nice to visualize the connections related to a Turbo Frame or Stimulus Controller.
Like display the connection between a:

  • Link and its corresponding Turbo Frame
  • Form and its corresponding Turbo Frame
  • Stimulus Controller element and its Targets
  • Stimulus Controller element and its Outlets

Monitor `<turbo-cable-stream-source>` elements

We could look for <turbo-cable-stream-source> elements and monitor the connected attribute on it.
That way we could show how many websockets are open and print a warning if the connection gets lost.

Enhance Turbo Frame blacklist

  • Use CSS selectors instead of a comma separated list of ID's
  • Avoid global blacklist - scope list to the respective URL

Show Panel on per page/project basis (not always on every page)

Hi,

a wish from me. The plugin is nice, but whould be better to just show the panel (bottom right) on per page/project basis (not on every page/tab opened in the browser)!?

I dont know how complicated it is to implement, such a behavior. The browser own devtools panel does this already, maybe worth a visit on there solution.

Thanks.

Color picker doesn't work in Firefox

When selecting the color picker in the popup, for picking an outline color, the popup should stay open so we can listen to the change event on the input and update the Dev Tool settings.

When selecting the color picker in the popup to choose an outline color, the popup should remain open so we can listen to the change event on the input and update the Dev Tool settings accordingly.

This works as expected in Chrome and Safari, but not in Firefox.
In Firefox, clicking on the color picker causes the popup to close immediately. This prevents the color from being updated.

Screen.Recording.2024-06-05.at.09.54.52.mov

Storage API error: `MAX_WRITE_OPERATIONS_PER_MINUTE`

When updating the options in the popup too many times in a short time, the Chrome browser isn't to happy about it and print the error: This request exceeds the MAX_WRITE_OPERATIONS_PER_MINUTE quota. and won't save the changes. (Not sure about Firefox's behaviour yet)

See the storage API for more information about the error.
It seems like, we should not exceed 2 write operations per second.


Possible solutions that come to mind:

  • Throttle the save operations with a debounce mechanism
  • Manually track the amount of changes and print a user friendly warning in the popup, when too many changes are made in a short time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.