ember-headlessui icon indicating copy to clipboard operation
ember-headlessui copied to clipboard

Which components are public API?

Open NullVoxPopuli opened this issue 4 years ago • 4 comments

Traditionally, all components used must have app-re-exports, but with Ember 3.25+, we can get around that -- and there may be some internal organization benefits to having total control over implementation details if we can ensure that certain components, like, list-box/button is private (in this case, the only intended use is through the yield of the listbox component, which pre-wires up a bunch of stuff -- which maybe we want to restrict what folks can do?)

NullVoxPopuli avatar Oct 03 '21 15:10 NullVoxPopuli

like, for Switch, we could say that:

Public API:

  • <Switch> + all arguments + all attributes
  • yielded properties; isOn, <Label>, <Button>

but, the following is private API:

  • <Label>'s @guid, onClick
  • <Button>s @guid, @labelGuid, @isOn, @onClick, @onKeyUp

NullVoxPopuli avatar Oct 03 '21 16:10 NullVoxPopuli

👍 I think it's reasonable that top level components are public and any yielded components are private.

GavinJoyce avatar Oct 03 '21 16:10 GavinJoyce

@GavinJoyce that's how I understand it as well!

all components used must have app-re-exports, but with Ember 3.25+, we can get around that

@NullVoxPopuli 🤯 I had no idea that was the case -- do you have a link to more information?

alexlafroscia avatar Oct 19 '21 18:10 alexlafroscia

do you have a link to more information?

It's a feature of the VM upgrade in 3.25+ that lets components-as-values be a thing, made a demo: https://github.com/GavinJoyce/ember-headlessui/pull/119/files#diff-268d073b63281f34748203ce9d28f671ae6be574d74ea8d0407154b0d3452924R8

NullVoxPopuli avatar Jan 09 '22 21:01 NullVoxPopuli