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

Composed slot controllers (and maybe more) #12

Open
43081j opened this issue Feb 14, 2023 · 0 comments
Open

Composed slot controllers (and maybe more) #12

43081j opened this issue Feb 14, 2023 · 0 comments

Comments

@43081j
Copy link
Owner

43081j commented Feb 14, 2023

We have SlotController right now, but it really exists as some kind of building block to what might come next.

For example, a BindSlotAttributesController (better name please) which binds some attributes to the slotted children. It could compose the SlotController like so:

const slotCtrl = new SlotController(this);
const bindCtrl = new BindSlotAttributesController(slotCtrl, {tabindex: '-1'});

html`
  <slot ${ref(slotCtrl.ref)}></slot>
`;

this would mean we could have multiple controllers composing the SlotController such that we only need to connect the slot controller to the <slot>.

all other controllers would react to the underlying slot controller's changes/listeners.

const slotCtrl = new SlotController(this);
const bindCtrl = new BindSlotAttributesController(slotCtrl, {tabindex: '-1'});
const bindPropsCtrl = new BindSlotPropertiesController(slotCtrl, {someProp: 'abc'});

html`
  <slot ${ref(slotCtrl.ref)}></slot>
`;

we really need to just dive in and try this out, i think. see what bumps we hit in the road and iterate until we get a clean interface
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

No branches or pull requests

1 participant