Add the ` Bee ` theme and corresponding JSON schema definitions for theme validation
This commit is contained in:
parent
7e138615b7
commit
a20451fe60
|
|
@ -0,0 +1,259 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"title": "Document Theme Component System",
|
||||||
|
"description": "A schema for a theme that defines reusable components and their layout.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"header": { "$ref": "#/$defs/headerObject" },
|
||||||
|
"settings": { "$ref": "#/$defs/settingsObject" },
|
||||||
|
"content": { "$ref": "#/$defs/contentRootObject" }
|
||||||
|
},
|
||||||
|
"required": ["header", "settings", "content"],
|
||||||
|
"$defs": {
|
||||||
|
"headerObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": { "theme": { "$ref": "#/$defs/themeObject" } },
|
||||||
|
"required": ["theme"]
|
||||||
|
},
|
||||||
|
"themeObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"author": { "type": "string" },
|
||||||
|
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" }
|
||||||
|
},
|
||||||
|
"required": ["name", "author", "version"]
|
||||||
|
},
|
||||||
|
"settingsObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"page size": { "type": "string", "enum": ["A4", "A5", "Letter", "Legal"] },
|
||||||
|
"margin": { "$ref": "#/$defs/marginObject" }
|
||||||
|
},
|
||||||
|
"required": ["page size"]
|
||||||
|
},
|
||||||
|
"contentRootObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"settings": { "$ref": "#/$defs/contentSettingsObject" },
|
||||||
|
"cover": { "$ref": "#/$defs/pageSection" },
|
||||||
|
"backcover": { "$ref": "#/$defs/pageSection" },
|
||||||
|
"interior": { "$ref": "#/$defs/pageSection" }
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"contentSettingsObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"definitions": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#/$defs/definitionObject" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["definitions"]
|
||||||
|
},
|
||||||
|
"definitionObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"class": { "type": "string" },
|
||||||
|
"content": {
|
||||||
|
"type": "array",
|
||||||
|
"items": { "$ref": "#/$defs/componentItem" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["class", "content"]
|
||||||
|
},
|
||||||
|
"pageSection": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"settings": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"paper color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
||||||
|
"margin": { "$ref": "#/$defs/marginObject" }
|
||||||
|
},
|
||||||
|
"required": ["paper color"]
|
||||||
|
},
|
||||||
|
"contents": { "type": "array", "items": { "$ref": "#/$defs/contentItem" } }
|
||||||
|
},
|
||||||
|
"required": ["settings", "contents"]
|
||||||
|
},
|
||||||
|
"marginObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"top": { "$ref": "#/$defs/measurementObject" },
|
||||||
|
"bottom": { "$ref": "#/$defs/measurementObject" },
|
||||||
|
"left": { "$ref": "#/$defs/measurementObject" },
|
||||||
|
"right": { "$ref": "#/$defs/measurementObject" }
|
||||||
|
},
|
||||||
|
"required": ["top", "bottom", "left", "right"]
|
||||||
|
},
|
||||||
|
"measurementObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"value": { "type": "number" },
|
||||||
|
"unit": { "type": "string", "enum": ["cm", "mm", "in", "pt", "px"] }
|
||||||
|
},
|
||||||
|
"required": ["value", "unit"]
|
||||||
|
},
|
||||||
|
"contentItem": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "An item with absolute position on a page.",
|
||||||
|
"properties": {
|
||||||
|
"coordinates": { "$ref": "#/$defs/coordinatesObject" },
|
||||||
|
"information": { "$ref": "#/$defs/informationUnion" }
|
||||||
|
},
|
||||||
|
"required": ["coordinates", "information"]
|
||||||
|
},
|
||||||
|
"componentItem": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "An item within a component definition, without absolute coordinates.",
|
||||||
|
"properties": {
|
||||||
|
"information": { "$ref": "#/$defs/informationUnion" }
|
||||||
|
},
|
||||||
|
"required": ["information"]
|
||||||
|
},
|
||||||
|
"informationUnion": {
|
||||||
|
"oneOf": [
|
||||||
|
{ "$ref": "#/$defs/drawingInformation" },
|
||||||
|
{ "$ref": "#/$defs/textInformation" },
|
||||||
|
{ "$ref": "#/$defs/documentBodyInformation" },
|
||||||
|
{ "$ref": "#/$defs/imageInformation" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"coordinatesObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": { "$ref": "#/$defs/positionRange" },
|
||||||
|
"y": { "$ref": "#/$defs/positionRange" },
|
||||||
|
"layer": { "type": "integer" }
|
||||||
|
},
|
||||||
|
"required": ["x", "y", "layer"]
|
||||||
|
},
|
||||||
|
"positionRange": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"start": { "type": "number" },
|
||||||
|
"end": { "type": "number" }
|
||||||
|
},
|
||||||
|
"required": ["start"]
|
||||||
|
},
|
||||||
|
"drawingInformation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": { "const": "drawing" },
|
||||||
|
"dimension": { "$ref": "#/$defs/dimensionObject" },
|
||||||
|
"relative position": { "$ref": "#/$defs/relativePositionObject" },
|
||||||
|
"rotation": { "type": "number" },
|
||||||
|
"shape": {
|
||||||
|
"oneOf": [
|
||||||
|
{ "$ref": "#/$defs/rectangleShape" },
|
||||||
|
{ "$ref": "#/$defs/lineShape" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"line": { "$ref": "#/$defs/lineObject" },
|
||||||
|
"fill": { "$ref": "#/$defs/fillObject" },
|
||||||
|
"settings": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"padding": { "$ref": "#/$defs/marginObject" },
|
||||||
|
"skip margin": { "type": "boolean" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["type", "shape"]
|
||||||
|
},
|
||||||
|
"textInformation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": { "const": "text" },
|
||||||
|
"font": { "$ref": "#/$defs/fontObject" },
|
||||||
|
"variable": { "type": "string", "pattern": "^\\$.+" }
|
||||||
|
},
|
||||||
|
"required": ["type", "font", "variable"]
|
||||||
|
},
|
||||||
|
"documentBodyInformation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": { "const": "document body" },
|
||||||
|
"font": { "$ref": "#/$defs/fontObject" },
|
||||||
|
"variable": { "type": "string", "pattern": "^\\$.+" }
|
||||||
|
},
|
||||||
|
"required": ["type", "font", "variable"]
|
||||||
|
},
|
||||||
|
"imageInformation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": { "const": "image" },
|
||||||
|
"dimension": { "$ref": "#/$defs/dimensionObject" },
|
||||||
|
"relative position": { "$ref": "#/$defs/relativePositionObject" }
|
||||||
|
},
|
||||||
|
"required": ["type", "dimension"]
|
||||||
|
},
|
||||||
|
"dimensionObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"width": { "$ref": "#/$defs/measurementObject" },
|
||||||
|
"height": { "$ref": "#/$defs/measurementObject" },
|
||||||
|
"layer": { "type": "integer" }
|
||||||
|
},
|
||||||
|
"required": ["width", "height", "layer"]
|
||||||
|
},
|
||||||
|
"relativePositionObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"horizontal": { "type": "string", "enum": ["left", "center", "right"] },
|
||||||
|
"vertical": { "type": "string", "enum": ["top", "center", "bottom"] }
|
||||||
|
},
|
||||||
|
"required": ["horizontal", "vertical"]
|
||||||
|
},
|
||||||
|
"fontObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"size": { "type": "number" },
|
||||||
|
"name": { "type": "string" }
|
||||||
|
},
|
||||||
|
"required": ["size", "name"]
|
||||||
|
},
|
||||||
|
"rectangleShape": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": { "const": "rectangle" },
|
||||||
|
"corner radius": { "$ref": "#/$defs/cornerRadiusObject" }
|
||||||
|
},
|
||||||
|
"required": ["type"]
|
||||||
|
},
|
||||||
|
"lineShape": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": { "type": { "const": "line" } },
|
||||||
|
"required": ["type"]
|
||||||
|
},
|
||||||
|
"cornerRadiusObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"top left": { "type": "number" },
|
||||||
|
"top right": { "type": "number" },
|
||||||
|
"bottom left": { "type": "number" },
|
||||||
|
"bottom right": { "type": "number" }
|
||||||
|
},
|
||||||
|
"required": ["top left", "top right", "bottom left", "bottom right"]
|
||||||
|
},
|
||||||
|
"lineObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"stroke": { "type": "string", "enum": ["solid", "dashed", "dotted"] },
|
||||||
|
"width": { "type": "number" },
|
||||||
|
"color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }
|
||||||
|
},
|
||||||
|
"required": ["stroke", "width", "color"]
|
||||||
|
},
|
||||||
|
"fillObject": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
||||||
|
"opacity": { "type": "number", "minimum": 0, "maximum": 1 }
|
||||||
|
},
|
||||||
|
"required": ["color"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,266 @@
|
||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"theme": {
|
||||||
|
"name": "Bee",
|
||||||
|
"author": "Gustavo Henrique Miranda",
|
||||||
|
"version": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"page size": "A5",
|
||||||
|
"margin": {
|
||||||
|
"top": {
|
||||||
|
"value": 3,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"bottom": {
|
||||||
|
"value": 3,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"value": 5,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"value": 5,
|
||||||
|
"unit": "cm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"settings": {
|
||||||
|
"definitions": [
|
||||||
|
{
|
||||||
|
"class": "photo",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"information": {
|
||||||
|
"type": "drawing",
|
||||||
|
"shape": {
|
||||||
|
"type": "rectangle"
|
||||||
|
},
|
||||||
|
"dimension": {
|
||||||
|
"width": {
|
||||||
|
"value": 88,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"value": 107,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"layer": 0
|
||||||
|
},
|
||||||
|
"line": {
|
||||||
|
"stroke": "solid",
|
||||||
|
"width": 0,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"fill": {
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"padding": {
|
||||||
|
"top": {
|
||||||
|
"value": 4.5,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"bottom": {
|
||||||
|
"value": 23.5,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"value": 4.5,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"value": 4.5,
|
||||||
|
"unit": "cm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"information": {
|
||||||
|
"type": "image",
|
||||||
|
"dimension": {
|
||||||
|
"width": {
|
||||||
|
"value": 79,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"value": 79,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"relative position": {
|
||||||
|
"horizontal": "center",
|
||||||
|
"vertical": "center"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cover": {
|
||||||
|
"settings": {
|
||||||
|
"paper color": "#000000",
|
||||||
|
"margin": {
|
||||||
|
"top": {
|
||||||
|
"value": 0,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"bottom": {
|
||||||
|
"value": 0,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"value": 0,
|
||||||
|
"unit": "cm"
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"value": 0,
|
||||||
|
"unit": "cm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contents": [
|
||||||
|
{
|
||||||
|
"coordinates": {
|
||||||
|
"x": {
|
||||||
|
"start": 74,
|
||||||
|
"end": 148
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"start": 105,
|
||||||
|
"end": 210
|
||||||
|
},
|
||||||
|
"layer": 0
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"type": "drawing",
|
||||||
|
"shape": {
|
||||||
|
"type": "rectangle",
|
||||||
|
"corner radius": {
|
||||||
|
"top left": 5,
|
||||||
|
"top right": 5,
|
||||||
|
"bottom left": 5,
|
||||||
|
"bottom right": 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"line": {
|
||||||
|
"stroke": "solid",
|
||||||
|
"width": 0.1,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"fill": {
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"coordinates": {
|
||||||
|
"x": {
|
||||||
|
"start": 74
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"start": 105
|
||||||
|
},
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"type": "text",
|
||||||
|
"font": {
|
||||||
|
"size": 24,
|
||||||
|
"name": "arial"
|
||||||
|
},
|
||||||
|
"variable": "$diaryName"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"backcover": {
|
||||||
|
"settings": {
|
||||||
|
"paper color": "#000000"
|
||||||
|
},
|
||||||
|
"contents": []
|
||||||
|
},
|
||||||
|
"interior": {
|
||||||
|
"settings": {
|
||||||
|
"paper color": "#F1E9D2"
|
||||||
|
},
|
||||||
|
"contents": [
|
||||||
|
{
|
||||||
|
"coordinates": {
|
||||||
|
"x": {
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"type": "text",
|
||||||
|
"font": {
|
||||||
|
"size": 15,
|
||||||
|
"name": "arial"
|
||||||
|
},
|
||||||
|
"variable": "$entryTitle"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"coordinates": {
|
||||||
|
"x": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 148
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"start": 15,
|
||||||
|
"end": 210
|
||||||
|
},
|
||||||
|
"layer": 0
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"type": "drawing",
|
||||||
|
"shape": {
|
||||||
|
"type": "line"
|
||||||
|
},
|
||||||
|
"line": {
|
||||||
|
"stroke": "solid",
|
||||||
|
"width": 0.1,
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"fill": {
|
||||||
|
"color": "#FFFFFF"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"skip margin": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"coordinates": {
|
||||||
|
"x": {
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"start": 0
|
||||||
|
},
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"information": {
|
||||||
|
"type": "document body",
|
||||||
|
"font": {
|
||||||
|
"size": 12,
|
||||||
|
"name": "arial"
|
||||||
|
},
|
||||||
|
"variable": "$entryContent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue