Style Inheritance
Implementing prototype chains and style inheritance for themes, defaults, and templates.
Application Pattern
Style inheritance is an application-level pattern built on top of CRDTs, not a CRDT feature itself. It leverages CRDT properties (automatic sync, conflict resolution) while keeping the inheritance logic in application code.
The Pattern
Instead of storing all properties on each element:
- Store a reference to a parent style/template
- Store only the overridden properties
Resolving Styles
Multi-Level Inheritance
Chain multiple levels for complex theming:
Resolution cascades: element overrides → template defaults → theme values.
Named Style Classes
Like CSS classes, elements can reference multiple styles by name. Store class definitions in a map (styleClasses), and let elements specify an array of class names. Resolution merges classes in order, then applies overrides.
Cascading Updates
When a base style changes, all dependent elements automatically get new values:
See Also
- Presentations - Full template system example
- Prezillo Styling and Palette - Concrete style cascade implementation with field tables