Commit graph

15 commits

Author SHA1 Message Date
Travis Ralston
d0c28adfb1 Appease the linter 2020-01-28 12:53:37 +00:00
Travis Ralston
21405b8f25 Fix skinning and babel tagets 2020-01-28 12:47:38 +00:00
Travis Ralston
59f608ffd6
Merge pull request #3761 from matrix-org/travis/babel7-wp-es6-export
Convert CommonJS exports to ES6 exports
2020-01-08 09:09:11 -07:00
Travis Ralston
56adb8244b Add a bit of debugging to incorrect components in the Skinner 2019-12-22 21:41:01 -07:00
Travis Ralston
344dac4fb9 Convert CommonJS exports to ES6-compatible exports
We use `export default` begrudgingly here. Ideally we'd use just `export`, though this entire SDK expects things to be exported as a default. Instead of breaking everything, we'll sacrifice our export pattern for a smaller diff - a later commit can always do the default export -> regular export conversion.
2019-12-22 21:01:02 -07:00
Travis Ralston
20a615396b Implementation of new potential skinning mechanism
With a switch to Only One Webpack™ we need a way to help developers generate the component index without a concurrent watch task. The best way to do this is to have developers import their components, but how do they do that when we support skins? The answer in this commit is to change skinning.

Skinning now expects to receive your list of overrides instead of the react-sdk+branded components. For Riot this means we send over *only* the Vector components and not Vector+react-sdk. 

Components can then be annotated with the `replaceComponent` decorator to have them be skinnable. The decorator must take a string with the dot path of the component because we can't reliably calculate it ourselves, sadly. 

The decorator does a call to `getComponent` which is where the important part of the branded components not including the react-sdk is important: if the branded app includes the react-sdk then the decorator gets executed before the skin has finished loading, leading to all kinds of fun errors. This is also why the skinner lazily loads the react-sdk components to avoid importing them too early, breaking the app.

The decorator will end up receiving null for a component because of the getComponent loop mentioned: the require() call is still in progress when the decorator is called, therefore we can't error out. All usages of getComponent() within the app are safe to not need such an error (the return won't be null, and developers shouldn't use getComponent() after this commit anyways).

The AuthPage, being a prominent component, has been converted to demonstrate this working. Changes to riot-web are required to have this work.

The reskindex script has also been altered to reflect these skinning changes - it no longer should set the react-sdk as a parent. The eventual end goal is to get rid of `getComponent()` entirely as it'll be easily replaced by imports.
2019-12-12 19:48:45 -07:00
David Baker
81871c50be Add more doc
on why module level variables do not work as singletons
2017-09-08 17:43:41 +01:00
Michael Telatynski
b98c105dcc
de-lint Skinner, RoomNotifs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-01 14:28:12 +01:00
Richard van der Hoff
98c4252840 Throw errors when components don't look like components (#980)
- instead of mysteriously throwing an error later on.
2017-06-01 09:26:35 +01:00
Matthew Hodgson
0772f50fab update copyright for 2016 2016-01-07 04:06:52 +00:00
David Baker
1df03aa82a Remove unintentional logging 2015-12-01 10:20:21 +00:00
David Baker
ae8c5bdcb0 better comment & regenerated index 2015-11-30 17:56:01 +00:00
David Baker
730b33535a More WIP component indexing 2015-11-30 17:33:04 +00:00
David Baker
b68665ead5 Add support for the basic notion of conference calls and an experimental concept of modules to provide the actual functionality. Rejig Skinner to be simpler. 2015-09-30 16:50:46 +01:00
David Baker
2d0c8ac9ff Working skin stuff, minus css 2015-09-15 13:34:36 +01:00