Skip to content

Commit 8f94950

Browse files
authored
[DOCS] Add a class diagram (#482)
This diagram aims to provide an overview of which classes we have and how their are interconnected. Hence, it does not contain any methods or properties. As the Mermaid render on GitHub does not support namespace, the classes are not grouped into namespaces in the diagram. Fixes #422
1 parent 9ea4650 commit 8f94950

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77

88
### Added
99

10+
- Add a class diagram to the README (#482)
1011
- Add support for the `dvh`, `lvh` and `svh` length units (#415)
1112
- Add more tests (#449)
1213

README.md

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,217 @@ class Sabberworm\CSS\CSSList\Document#4 (2) {
615615
#header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;color: red !important;}
616616
```
617617

618+
## Class diagram
619+
620+
```mermaid
621+
classDiagram
622+
direction LR
623+
624+
%% top namespace
625+
626+
class OutputFormat {
627+
}
628+
629+
class OutputFormatter {
630+
}
631+
632+
OutputFormatter --> "1" OutputFormat : oFormat
633+
OutputFormat --> "1" OutputFormatter : oFormatter
634+
OutputFormat --> "1" OutputFormat : oNextLevelFormat
635+
636+
class Parser {
637+
}
638+
639+
class ParserState {
640+
}
641+
642+
Parser --> "1" ParserState : oParserState
643+
644+
class Renderable {
645+
<<interface>>
646+
}
647+
648+
class Settings {
649+
}
650+
651+
652+
%% namespace Comment
653+
654+
class Comment {
655+
}
656+
class Commentable {
657+
<<interface>>
658+
}
659+
660+
Comment ..|> Renderable
661+
662+
663+
%% namespace CSSList
664+
665+
class AtRuleBlockList {
666+
}
667+
class CSSBlockList {
668+
<<abstruct>>
669+
}
670+
class CSSList {
671+
<<abstruct>>
672+
}
673+
class Document {
674+
}
675+
class KeyFrame {
676+
}
677+
678+
AtRuleBlockList --|> CSSBlockList
679+
AtRuleBlockList ..|> AtRule
680+
CSSBlockList --|> CSSList
681+
CSSList ..|> Renderable
682+
CSSList ..|> Commentable
683+
Document --|> CSSBlockList
684+
KeyFrame --|> CSSList
685+
KeyFrame ..|> AtRule
686+
687+
CSSList --> "*" Comment : aComments
688+
CSSList --> "*" RuleSet : aContents
689+
CSSList --> "*" CSSList : aContents
690+
CSSList --> "*" Import : aContents
691+
CSSList --> "*" Charset : aContents
692+
693+
%% namespace Parsing
694+
695+
class Anchor {
696+
}
697+
class OutputException {
698+
}
699+
class ParserState {
700+
}
701+
class SourceException {
702+
}
703+
class UnexpectedEOFException {
704+
}
705+
class UnexpectedTokenException {
706+
}
707+
708+
OutputException --|> SourceException
709+
UnexpectedEOFException --|> UnexpectedTokenException
710+
UnexpectedTokenException --|> SourceException
711+
712+
Anchor --> "1" ParserState : oParserState
713+
ParserState --> "1" Settings : oParserSettings
714+
715+
%% namespace Property
716+
717+
class AtRule {
718+
<<interface>>
719+
}
720+
class Charset {
721+
}
722+
class CSSNamespace {
723+
}
724+
class Import {
725+
}
726+
class KeyframeSelector {
727+
}
728+
class Selector {
729+
}
730+
731+
AtRule --|> Renderable
732+
AtRule --|> Commentable
733+
Charset ..|> AtRule
734+
CSSNamespace ..|> AtRule
735+
Import ..|> AtRule
736+
KeyframeSelector --|> Selector
737+
738+
Charset --> "1" CSSString : oCharset
739+
Charset --> "*" Comment : aComments
740+
CSSNamespace --> "*" Comment : aComments
741+
Import --> "*" Comment : aComments
742+
743+
744+
%% namespace Rule
745+
746+
class Rule {
747+
}
748+
749+
Rule ..|> Renderable
750+
Rule ..|> Commentable
751+
752+
Rule --> "1" RuleValueList : mValue
753+
Rule --> "*" Comment : aComments
754+
755+
756+
%% namespace RuleSet
757+
758+
class AtRuleSet {
759+
}
760+
class DeclarationBlock {
761+
}
762+
class RuleSet {
763+
<<abstruct>>
764+
}
765+
766+
AtRuleSet --|> RuleSet
767+
AtRuleSet ..|> AtRule
768+
DeclarationBlock --|> RuleSet
769+
RuleSet ..|> Renderable
770+
RuleSet ..|> Commentable
771+
772+
DeclarationBlock --> "*" Selector : aSelectors
773+
RuleSet --> "*" Rule : aRules
774+
RuleSet --> "*" Comment : aComments
775+
776+
777+
%% namespace Value
778+
779+
class CalcFunction {
780+
}
781+
class CalcRuleValueList {
782+
}
783+
class Color {
784+
}
785+
class CSSFunction {
786+
}
787+
class CSSString {
788+
}
789+
class LineName {
790+
}
791+
class PrimitiveValue {
792+
<<abstruct>>
793+
}
794+
class RuleValueList {
795+
}
796+
class Size {
797+
}
798+
class URL {
799+
}
800+
class Value {
801+
<<abstruct>>
802+
}
803+
class ValueList {
804+
<<abstruct>>
805+
}
806+
807+
CalcFunction --|> CSSFunction
808+
CalcRuleValueList --|> RuleValueList
809+
Color --|> CSSFunction
810+
CSSFunction --|> ValueList
811+
CSSString --|> PrimitiveValue
812+
LineName --|> ValueList
813+
PrimitiveValue --|> Value
814+
RuleValueList --|> ValueList
815+
Size --|> PrimitiveValue
816+
URL --|> PrimitiveValue
817+
Value ..|> Renderable
818+
ValueList --|> Value
819+
820+
URL --> "1" CSSString : oURL
821+
ValueList --> "*" RuleValueList : aComponents
822+
ValueList --> "*" CSSFunction : aComponents
823+
ValueList --> "*" CSSString : aComponents
824+
ValueList --> "*" LineName : aComponents
825+
ValueList --> "*" Size : aComponents
826+
ValueList --> "*" URL : aComponents
827+
```
828+
618829
## Contributors/Thanks to
619830

620831
* [oliverklee](https://github.com/oliverklee) for lots of refactorings, code modernizations and CI integrations

0 commit comments

Comments
 (0)