Skip to content

[DOCS] Add a class diagram #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Added

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

Expand Down
205 changes: 205 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,211 @@ class Sabberworm\CSS\CSSList\Document#4 (2) {
#header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;color: red !important;}
```

## Class diagram

```mermaid
classDiagram
direction LR

%% top namespace

class OutputFormat {
}

class OutputFormatter {
}

OutputFormatter --> "1" OutputFormat : oFormat
OutputFormat --> "1" OutputFormatter : oFormatter
OutputFormat --> "1" OutputFormat : oNextLevelFormat

class Parser {
}

class ParserState {
}

Parser --> "1" ParserState : oParserState

class Renderable {
}
<<interface>> Renderable

class Settings {
}


%% namespace Comment

class Comment {
}
class Commentable {
}

<<interface>> Commentable
Comment ..|> Renderable


%% namespace CSSList

class AtRuleBlockList {
}
class CSSBlockList {
}
class CSSList {
}
class Document {
}
class KeyFrame {
}

AtRuleBlockList --|> CSSBlockList
AtRuleBlockList ..|> AtRule
CSSBlockList --|> CSSList
CSSList ..|> Renderable
CSSList ..|> Commentable
Document --|> CSSBlockList
KeyFrame --|> CSSList
KeyFrame ..|> AtRule

CSSList --> "*" Comment : aComments
CSSList --> "*" RuleSet : aContents
CSSList --> "*" CSSList : aContents
CSSList --> "*" Import : aContents
CSSList --> "*" Charset : aContents

%% namespace Parsing

class Anchor {
}
class OutputException {
}
class ParserState {
}
class SourceException {
}
class UnexpectedEOFException {
}
class UnexpectedTokenException {
}

OutputException --|> SourceException
UnexpectedEOFException --|> UnexpectedTokenException
UnexpectedTokenException --|> SourceException

Anchor --> "1" ParserState : oParserState
ParserState --> "1" Settings : oParserSettings

%% namespace Property

class AtRule {
}
class Charset {
}
class CSSNamespace {
}
class Import {
}
class KeyframeSelector {
}
class Selector {
}

<<interface>> AtRule
AtRule --|> Renderable
AtRule --|> Commentable
Charset ..|> AtRule
CSSNamespace ..|> AtRule
Import ..|> AtRule
KeyframeSelector --|> Selector

Charset --> "1" CSSString : oCharset
Charset --> "*" Comment : aComments
CSSNamespace --> "*" Comment : aComments
Import --> "*" Comment : aComments


%% namespace Rule

class Rule {
}

Rule ..|> Renderable
Rule ..|> Commentable

Rule --> "1" RuleValueList : mValue
Rule --> "*" Comment : aComments


%% namespace RuleSet

class AtRuleSet {
}
class DeclarationBlock {
}
class RuleSet {
}

AtRuleSet --|> RuleSet
AtRuleSet ..|> AtRule
DeclarationBlock --|> RuleSet
RuleSet ..|> Renderable
RuleSet ..|> Commentable

DeclarationBlock --> "*" Selector : aSelectors
RuleSet --> "*" Rule : aRules
RuleSet --> "*" Comment : aComments


%% namespace Value

class CalcFunction {
}
class CalcRuleValueList {
}
class Color {
}
class CSSFunction {
}
class CSSString {
}
class LineName {
}
class PrimitiveValue {
}
class RuleValueList {
}
class Size {
}
class URL {
}
class Value {
}
class ValueList {
}

CalcFunction --|> CSSFunction
CalcRuleValueList --|> RuleValueList
Color --|> CSSFunction
CSSFunction --|> ValueList
CSSString --|> PrimitiveValue
LineName --|> ValueList
PrimitiveValue --|> Value
RuleValueList --|> ValueList
Size --|> PrimitiveValue
URL --|> PrimitiveValue
Value ..|> Renderable
ValueList --|> Value

URL --> "1" CSSString : oURL
ValueList --> "*" RuleValueList : aComponents
ValueList --> "*" CSSFunction : aComponents
ValueList --> "*" CSSString : aComponents
ValueList --> "*" LineName : aComponents
ValueList --> "*" Size : aComponents
ValueList --> "*" URL : aComponents
```

## Contributors/Thanks to

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