Skip to content

How native can we get?#389

Open
NullVoxPopuli wants to merge 2 commits intomainfrom
how-native-can-we-get
Open

How native can we get?#389
NullVoxPopuli wants to merge 2 commits intomainfrom
how-native-can-we-get

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

@bolt-new-by-stackblitz
Copy link

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

@github-actions
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