Skip to content

Commit

Permalink
doc: add nthChild to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme committed Jun 26, 2024
1 parent 3f1c9f8 commit bd36cd4
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions website/public/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@
"description": "A single sub-rule and matches a node if the sub rule does not match.",
"$ref": "#/definitions/SerializableRule"
},
"nthChild": {
"description": "`nth_child` accepts number, string or object. It specifies the position in nodes' sibling list.",
"$ref": "#/definitions/SerializableNthChild"
},
"pattern": {
"description": "A pattern string or a pattern object.",
"$ref": "#/definitions/PatternStyle"
Expand Down Expand Up @@ -352,6 +356,10 @@
"description": "A single sub-rule and matches a node if the sub rule does not match.",
"$ref": "#/definitions/SerializableRule"
},
"nthChild": {
"description": "`nth_child` accepts number, string or object. It specifies the position in nodes' sibling list.",
"$ref": "#/definitions/SerializableNthChild"
},
"pattern": {
"description": "A pattern string or a pattern object.",
"$ref": "#/definitions/PatternStyle"
Expand Down Expand Up @@ -381,6 +389,52 @@
}
]
},
"SerializableNthChild": {
"description": "`nthChild` accepts either a number, a string or an object.",
"anyOf": [
{
"description": "Simple syntax",
"$ref": "#/definitions/NthChildSimple"
},
{
"description": "Object style syntax",
"type": "object",
"required": [
"position"
],
"properties": {
"ofRule": {
"description": "select the nth node that matches the rule, like CSS's of syntax",
"$ref": "#/definitions/SerializableRule"
},
"position": {
"description": "nth-child syntax",
"$ref": "#/definitions/NthChildSimple"
},
"reverse": {
"description": "matches from the end instead like CSS's nth-last-child",
"default": false,
"type": "boolean"
}
}
}
]
},
"NthChildSimple": {
"description": "A string or number describing the indices of matching nodes in a list of siblings.",
"anyOf": [
{
"description": "A number indicating the precise element index",
"type": "integer",
"format": "uint",
"minimum": 0.0
},
{
"description": "Functional notation like CSS's An + B",
"type": "string"
}
]
},
"Severity": {
"oneOf": [
{
Expand Down

0 comments on commit bd36cd4

Please sign in to comment.