matthewp / corset

Declarative data bindings, bring your own backend.

Home Page:https://corset.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change the mount property to behavior and allow multiple mounts

matthewp opened this issue · comments

I think this is a better API

class Counter {
  static inputProperties = ['--start-count'];
  bind(props) {
    let count = this.state.count || props.get('count');

    return sheet`
      .count {
        text: ${count};
      }
    `;
  }
}

sheet`
  #app {
    behavior: mount(${Counter}), mount(${SomethingElse});
  }
`

This will allow:

  • Multiple mounts on the same element for mixin like behavior.
  • Other types of behaviors (maybe lower-level than a mount).