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

How native can we get? #389

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

How native can we get? #389

wants to merge 2 commits into from

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Oct 18, 2024

Things I wish CustomElements had:

  • yieldable data
    • a way of only using certain elements within a parent element
  • contexts
    • a way of associating data to elements in the tree (an alternative to yielding)
    • This is polyfillable via @lit/context, which uses synchronous events to pass data

To start, in Ember we have:

<Switch as |s|>
  <s.Control />
  <s.Label>
    Toggle on or off
  </s.Label>
</Switch>

and the control (input) and label are appropriately associated, abstracting away the id/for relationship.

With custom elements, we have to do:

<primitive-switch>
  <primitive-switch-control></primitive-switch-control>
  <primitive-switch-label>
    Toggle on or off
  </primitive-switch-label>
</primitive-switch>

but primitive-switch-label can be used outside of <primitive-switch> -- but this makes no sense in practice

Copy link

stackblitz bot commented Oct 18, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

Project Preview URL
Docs https://a210fcea.ember-primitives.pages.dev

Logs

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.

1 participant