Skip to content

Commit

Permalink
Font Library: Update font collection json schema (#58413)
Browse files Browse the repository at this point in the history
* move fontFace to a definition so it can be linked from other schemas

* update font-collection schema
  • Loading branch information
matiasbenedetto authored Jan 30, 2024
1 parent c564ece commit 161b2e4
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 109 deletions.
60 changes: 55 additions & 5 deletions schemas/json/font-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,74 @@
"description": "JSON schema URI for font-collection.json.",
"type": "string"
},
"slug": {
"type": "string",
"description": "Slug of the font collection. Must be unique and URL friendly."
},
"name": {
"type": "string",
"description": "Name of the font collection."
},
"description": {
"type": "string",
"description": "Description of the font collection."
},
"font_families": {
"type": "array",
"description": "Array of font families ready to be installed",
"items": {
"type": "object",
"properties": {
"font_family_settings": {
"description": "Font family settings as in theme.json",
"allOf": [
{ "$ref": "./theme.json#/definitions/fontFamily" }
]
"description": "Font family settings similar to theme.json but without fontFace key.",
"type": "object",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"type": "string"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"type": "string"
}
},
"additionalProperties": false
},
"font_faces": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"type": "object",
"properties": {
"preview": {
"type": "string",
"description": "URL to a preview image of the font face"
},
"font_face_settings": {
"description": "Font face settings as in theme.json",
"allOf": [
{
"$ref": "./theme.json#/definitions/fontFace"
}
]
}
}
}
},
"categories": {
"type": "array",
"description": "Array of category slugs",
"items": {
"type": "string"
}
},
"preview": {
"type": "string",
"description": "URL to a preview image of the font family"
}
},
"required": [ "font_family_settings" ],
Expand All @@ -50,5 +100,5 @@
}
},
"additionalProperties": false,
"required": [ "$schema", "font_families" ]
"required": [ "$schema", "slug", "name", "font_families" ]
}
202 changes: 98 additions & 104 deletions schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,127 +619,121 @@
"description": "Font family presets for the font family selector.\nGenerates a single custom property (`--wp--preset--font-family--{slug}`) per preset value.",
"type": "array",
"items": {
"$ref": "#/definitions/fontFamily"
"type": "object",
"description": "Font family preset",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"type": "string"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"type": "string"
},
"fontFace": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"$ref": "#/definitions/fontFace"
}
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
},
"fontFamily": {
"fontFace": {
"type": "object",
"description": "Font family preset",
"properties": {
"name": {
"description": "Name of the font family preset, translatable.",
"fontFamily": {
"description": "CSS font-family value.",
"type": "string",
"default": ""
},
"fontStyle": {
"description": "CSS font-style value.",
"type": "string",
"default": "normal"
},
"fontWeight": {
"description": "List of available font weights, separated by a space.",
"default": "400",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"fontDisplay": {
"description": "CSS font-display value.",
"type": "string",
"default": "fallback",
"enum": [ "auto", "block", "fallback", "swap", "optional" ]
},
"src": {
"description": "Paths or URLs to the font files.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"default": []
},
"fontStretch": {
"description": "CSS font-stretch value.",
"type": "string"
},
"slug": {
"description": "Kebab-case unique identifier for the font family preset.",
"ascentOverride": {
"description": "CSS ascent-override value.",
"type": "string"
},
"fontFamily": {
"description": "CSS font-family value.",
"descentOverride": {
"description": "CSS descent-override value.",
"type": "string"
},
"fontFace": {
"description": "Array of font-face declarations.",
"type": "array",
"items": {
"type": "object",
"properties": {
"fontFamily": {
"description": "CSS font-family value.",
"type": "string",
"default": ""
},
"fontStyle": {
"description": "CSS font-style value.",
"type": "string",
"default": "normal"
},
"fontWeight": {
"description": "List of available font weights, separated by a space.",
"default": "400",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"fontDisplay": {
"description": "CSS font-display value.",
"type": "string",
"default": "fallback",
"enum": [
"auto",
"block",
"fallback",
"swap",
"optional"
]
},
"src": {
"description": "Paths or URLs to the font files.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"default": []
},
"fontStretch": {
"description": "CSS font-stretch value.",
"type": "string"
},
"ascentOverride": {
"description": "CSS ascent-override value.",
"type": "string"
},
"descentOverride": {
"description": "CSS descent-override value.",
"type": "string"
},
"fontVariant": {
"description": "CSS font-variant value.",
"type": "string"
},
"fontFeatureSettings": {
"description": "CSS font-feature-settings value.",
"type": "string"
},
"fontVariationSettings": {
"description": "CSS font-variation-settings value.",
"type": "string"
},
"lineGapOverride": {
"description": "CSS line-gap-override value.",
"type": "string"
},
"sizeAdjust": {
"description": "CSS size-adjust value.",
"type": "string"
},
"unicodeRange": {
"description": "CSS unicode-range value.",
"type": "string"
}
},
"required": [ "fontFamily", "src" ],
"additionalProperties": false
}
"fontVariant": {
"description": "CSS font-variant value.",
"type": "string"
},
"fontFeatureSettings": {
"description": "CSS font-feature-settings value.",
"type": "string"
},
"fontVariationSettings": {
"description": "CSS font-variation-settings value.",
"type": "string"
},
"lineGapOverride": {
"description": "CSS line-gap-override value.",
"type": "string"
},
"sizeAdjust": {
"description": "CSS size-adjust value.",
"type": "string"
},
"unicodeRange": {
"description": "CSS unicode-range value.",
"type": "string"
}
},
"required": [ "fontFamily", "src" ],
"additionalProperties": false
},
"settingsPropertiesCustom": {
Expand Down

0 comments on commit 161b2e4

Please sign in to comment.