-
Notifications
You must be signed in to change notification settings - Fork 233
chore: initial POC of prefixed tag names #5703
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
base: main
Are you sure you want to change the base?
Conversation
|
Initial tachometer results show this is actually faster than the original registration which I find hard to believe, but may be due to my having updated to the latest playwright install.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This general approach looks promising to me!
I wanted to see how it might look end-to-end, so I created a Lit Playground example to try it out:
https://lit.dev/playground/#gist=039ebbad69ce634ff3cf6d4d14c7df01
In doing so, I found that there were a couple of issues:
- We need to provide
StaticValue
s to render into Lit templates in the tag-name position; strings aren't sufficient - The logic for rendering dependent tag names needs to combine the
prefix
from the current component instance with thetagName
from the dependency's constructor; as written in this PR, it gets both from the base constructor, so doesn't utilize the custom prefix
In the process of addressing these, I ended up making a bunch of other experimental tweaks, primarily in the interest of improving dev experience.
Take a look at the Playground and see what you think. In particular, I ended up going down a path that tried to adhere closely to Lit's template-safety best practices, so requires use of a tagged template literal when defining prefix
and tagName
. This is responsible for a bit of complexity in the implementation, so I could imagine deciding that plain strings + unsafeStatic
are good enough for our use case, but I wanted to see what the more rigorous approach would look like.
@@ -97,7 +101,7 @@ export class ActionBar extends FocusVisiblePolyfillMixin(SpectrumElement) { | |||
|
|||
public override render(): TemplateResult { | |||
return html` | |||
<sp-popover ?open=${this.open} id="popover"> | |||
<${Popover.tag} ?open=${this.open} id="popover"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! We used to do something similar at Red Hat at one point though we used the tag attribute for the CMS rather than internal component referencing.
Description
This PR explores a POC for adding prefixing of spectrum-web-component custom element registrations, allowing us to avoid versioning conflicts (at the expense of payload).
Motivation and context
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Descriptive Test Statement
Descriptive Test Statement
Device review