## The next BIG refactoring of the Core ... became necessary. Prerequisites: #191 Related: #141, #184 , #118, #210 ### Requirement list - [ ] 0. DP: Use Shadow DOM where possible. - [ ] 1. DP: Rewrite DynamicAdapter using RxJS. The goals are: - [ ] 1.1 DP: simplify the code - [ ] 1.2 DP: async decouple parts from different domains and authors along the calling thread. preventing blocks. - [ ] 2. DP: Don't use `any` type in Dapplets. Use specific types instead. - [ ] 3. AS: Dynamic-adapter uses feature configs as keys in the map of inserted widgets. Use other objects as keys. (related to #118) - [ ] 4. DP: Rethink Dapplet-Widget relationship. Maybe we need to consider a Dapplet as a bunch of MVCs (model-view-controller) with a common shared _SharedState_ as a Model. - [ ] 5. DP: Introduce Events in MVC (between Widget as 'V' and handlers as 'C' of MVC). The goals are: - [ ] 5.1 .DP: allows the Dapplet automation. - [ ] 5.2. DP: allow new grouping dapplets (triggering other dapplets functionality) like SocialEnhancementPack dapplet. - [ ] 5.3. DP: support the #184 - [ ] 5.4. DP: ensure meaningful error handling and reporting. - [ ] 6. DP: Rethink the StarterButton to fit in into architecture. - [ ] 7. DP: verify and probably redesign Connection to Wallets - [ ] 8. DP: verify and probably redesign Connection to external servers - [ ] 9. DP: make Autoproperties fit into RxJs-based design - [ ] 10. DP: verify and probably redesign the StateMachine. - [ ] 10.1 Allow multistates: "COMMITED" and "PRESSED" are simultan possible. - [ ] 10.2 Allow combined: "COMMITED_AND_PRESSED" is a new state with both states active. - [ ] 11. DP: make adapters and dapplets automatically testable (utilizing events?) - [ ] 12. #210 - [ ] 13. DP: skin support (inspired by vitalik's design). **Postponed** because can not be enforced for independent developers. - [ ] 14. [Core] support for text selection #184 - [ ] 15. Core v2 should determine Hierarchical contexts, there should be a function, which returns contexts by DOM node. - [ ] 16. Core v2 should limit number of injected buttons in one insertion point - [ ] 17. Reset config (detach, attach, lifecycle) looks ugly from User's POV - [ ] 18. Inconvenient widget development. Maybe better to use something like JSX for HTML/CSS coding. - [ ] 19. When rendering a widget, DOM elements are destroyed and reinserted each time - this is not optimal. This is especially evident in the video comment, where each update of the video frame causes the widget to re-render. - [ ] 20. Awful communication interface between dapplet and overlay - [ ] 21. I had to memorize the reference on `<input>` element of DOM in Swarm gateway adapter, because it's absent in needed moment of time. - [ ] 22. Need to research how react works and apply its ideas for dapplet architecture. There is a cool idea of state (model at MVC?) and view splitting, which lifecycle is independent unlike current dapplet's config ### Implementation plan: - [ ] ensure the requirements list above is full - [ ] #191 - [ ] create sequence diagrams for flows inside the dynamic adapter and determine the async boundaries. - [ ] review existing adapters for any architectural sins.