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

[WIP / Discussion] Allow for non-lit specific implementation #2677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KonnorRogers
Copy link
Contributor

@KonnorRogers KonnorRogers commented May 28, 2023

What I did

  1. Moved the adoptStyles call to be a hook

EDIT: will also need to move static elementStyles out as well.

Why?

Ideally I would love to be able to use this mixin with any web component, and as far as I can tell this is really the only Lit-specific portion.

Technically this PR doesn't solve the problem, but if the base mixin has a hook to adopt styles, we could get a separate entrypoint for the Mixin for Lit-specific implementations with the actual adoptStyles implementation.

I didn't do it here because I figured I'd open it up to discussion first if this is a use-case you all would like to support and making sure I didn't miss anything along the way.

@changeset-bot
Copy link

changeset-bot bot commented May 28, 2023

⚠️ No Changeset found

Latest commit: e92e617

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@thepassle
Copy link
Member

thepassle commented May 29, 2023

The ScopedElementsMixin is indeed built for usage with LitElement, and depends on overriding lits createRenderRoot lifecycle method. Moving the adoptStyles function isn't going to be enough to make the mixin compatible with non-Lit elements, unless they also implement a similar lifecycle hook. I also don't think the adoptStyles function is actually an issue here, I think it would just noop when used with non-lit elements. Nope, looks like it does error on non-lit elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants