UVP*
and the future of
CSSinJSΒ
* Unique Value Proposition
by Oleg Slobodskoi @oleg008
The worldβs first
Project Messenger.
Web apps have complex interactions and maintain a state on the client, while web sites mostly render static information.
π‘
UVP
Unique class name
Modules
Variables
Β etc.
Not a UVP
π¦Β Publishing
πΒ Theming
πΒ Data Driven Styling
Agenda
+ π Β The Future
π¦
Publishing
Almost 600K
π¦
Quality Assurance for JS
Linters
Typings
Tests
Runtime Errors
etc.
Namespacing & specificity
at scale of npm?
π―
Package Block Element Modifier
.package---block--element-modifier {}
π
π‘
CSSinJS is
Constraints Automation
Shadow DOMΒ
Is it ready?
Is it well supported?
Is it fast?
π
Always bet on JavaScript
Or whatever better language will replace it
π
π
Theming
Theme is a config, that
defines look and feel.
π‘
Material-UI
React Components that Implement Google's Material Design.
Let's try π¨ CSS!
π°
Built-in Theme
Switch needs download
Redesign in multi-team setup
π
CSS Variables are subject to the cascade, and inherit their value from their parent.
π‘
ππ₯π
React's Context is like
CSS Variables
π€·ββοΈ
Create a theme
Use context
NestingΒ
π
Data Driven Styling
State Based
User settings
API call
Time
etc.
Streaming animations
π
Google Material Motion for JS
No Transitions
No Keyframes
π
β
Reconciliation
Styles application
React Inline Styles
π’
Extreme Perf
60 FPS
JavaScript
One thread
π±
CSSOM FTW
π
Create CSS Rule
Update CSS Rule
JSS Function Values
SCU
π€
Observables
JSS 9 Example
Easy to support
Compatible
RxJS
Bacon.js
Kefir
etc.
Push based
Pointer events
Physics data
Streams coordination
Observable + CSSOM = β€οΈ
Decoupled
Lazy
π
Future
The biggest issue at scale we currently have with all CSSinJS implementations is that they are not shareable without the runtime.
π‘
Interoperable
Style
Transfer
Format
Styled Components
Stylis
Styled Components
+ ISTF Prototype
W3C CSS Spec
πͺ
Interoperable
Publish with X,
use with Y
π
StyleΒ
CSS
CSSinJS
π
Transfer
Compact
Fast
π°
Format
For Machines,
not Humans
Interoperability
Performance
Dynamic capabilities
Cross-platform
Β
The Goal
Thanks!
UVP of CSSinJS
By Oleg Isonen
UVP of CSSinJS
- 2,425