Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unique class to each viewer instance #81

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

Carifio24
Copy link
Member

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:

  • Make sure that the class starts with a letter
  • Clearly tell where this class is being applied from

@Carifio24 Carifio24 merged commit 7b53729 into glue-viz:main Jul 17, 2024
33 checks passed
@Carifio24 Carifio24 added enhancement New feature or request viewers labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request viewers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant