wc-catalogue / blaze-elements

Web Component Blaze Elements
https://wc-catalogue.github.io/blaze-elements/
MIT License
10 stars 4 forks source link

refactor: research patterns for code reuse in WC #160

Closed Hotell closed 7 years ago

Hotell commented 7 years ago
  1. [x] - Mixins
  2. [x] - HOC
  3. [ ] - how to monkey patch renderCallback
  4. [x] - type safe Mixins with TS 2.2
  5. [x] - ShadyCSS mixin for shadow dom css encapsulation

1 and 2 http://codepen.io/Hotell/pen/EZRRGO?editors=1010 4 https://github.com/wc-catalogue/blaze-elements/tree/mh/mixins-with-new-ts 5 http://codepen.io/Hotell/pen/RKJyOE

NOTE Unfortunately props definition doesn't work via mixins, because they are defined as static getter on the instance. This is unfortunate, but that's how mixins and inheritance work. Maybe skatejs could do better job here to allow this composition pattern, otherwise I'm afraid we would need to create HOC which are directly mutating that static props definition. Details: https://github.com/skatejs/skatejs/issues/1077

So after research and discussion with Trey, we have a winner which works! yay! 🚀

Hotell commented 7 years ago

Closed by https://github.com/wc-catalogue/blaze-elements/pull/173