Skip to content

[Feature request] Standalone controle panel elements, custom styling for components #316

@bohdancho

Description

@bohdancho

Goal

I'd like to be able to

  1. use <twisty-scrubber> and <twisty-button>'s outside of <twisty-player>
  2. tweak web components' styles to my needs, including <twisty-scrubbler>

Each of the buttons just calls a controller method, so replicating them even without standalone components is pretty straightforward. <twisty-scrubbler> on the other hand is more sophisticated so manually replicating it's functionality is more error-prone (as the internal API and the original component might change in the future).

Possible solution

Including scrubble in exports shouldn't be an issue itself. While I'm fine with passing model and controller to the constructor in JS, we would also need to add attributeChangedCallback to make using it via a for attribute possible, like in TwistyAlgEditor and TwistyAlgViewer.

As for custom styling, here's a possible solution:
image
It is worth noting that passing custom css while leaving default styles enabled results in two <style> tags, tbh idk if it's a problem.

Alternatives

Alternatively we could abstract away the custom styling logic and the binding logic in a class like TwistyStandaloneElement which would extend from ManagedCustomElement. I would be happy to provide a pull request with these changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions