glue-viz / glue-plotly

Experimental plot.ly plugin for glue
BSD 3-Clause "New" or "Revised" License
2 stars 8 forks source link

Add unique class to each viewer instance #81

Closed Carifio24 closed 1 month ago

Carifio24 commented 1 month ago

This PR adds a unique identified to each viewer that will be added as a class for the root element of the FigureWidget in the DOM. This allows a client that can also run JS in the browser (e.g. a Vue component being used in a Solara app) an easy way to directly reference any figure(s) for a given viewer from a JS context in the browser. Note that this is a class, not an id - each view of the FigureWidget will have the same class. This class is accessible Python-side as viewer.unique_class.

The class is constructed from a v4 UUID in order to be unique. The format of the class is glue-plotly-<UUID>. This format has two purposes: