evanliomain / css-battle-toolbox

2 stars 0 forks source link

Add a dom inspector tools #4

Open evanliomain opened 17 hours ago

evanliomain commented 17 hours ago

Add a dom inspector tools, so I no longer need to use devtools inspector to see what happen in the output iframe.

Tsaeko commented 8 hours ago

Not a direct implementation advice, just posting this for inspiration.

I made an Element tracker, which attaches a Mutation Observer to the preview iframe and passes back the computed style for the properties you specify, i chose to always display width, height and background-color (not background).

The CSS property list is populated by getting the Object keys of a random DOM element. The image provides more info, some small additional features are the element position, link to the MDN documentation, color previews.

Note: In case of transform: ... , it even calculates the matrix for you by default.

image

Afaik you wanted to include the nesting info, so your implementation is probably different.

evanliomain commented 6 hours ago

I was thinking of a lighter version. Here an ongoing version, but still in progress.

Capture d’écran 2024-11-25 à 21 20 42