Convert glass elements to Web Components #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "mpbagot/feature/web-components"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This library currently implements the liquid glass container and buttons as Javascript builder classes. That is, a user instantiates a class which creates DOM elements and applies functionality to them. The resulting element is then extracted and inserted into the DOM as any other element might be.
The Web Components standard provides a framework-agnostic method of defining reusable components that can be used within HTML directly after registration. This commit converts the glass Button and Container classes to extend HTMLDivElement and register as custom Web Components <glass-button> and <glass-container> respectively.
For existing users, the components still provide a near-equivalent JS interface (fromOptions) for instantiation and use of the glass elements, whilst now also providing the option for use directly in HTML.
I'm happy to rework anything if you don't like some of my changes, or if you're not happy with the code/commit style. I understand that I may well have also introduced a different syntax style to the JS in places without ESLint to kick me for mistakes.
Or if you completely dislike this as an idea for the library, I'm happy to close this PR.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.