From a330dc23e69c9a43e108db57890902a6383d9da2 Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Wed, 27 Oct 2021 09:34:28 +0200 Subject: [PATCH] Ensure all schema objects are in the docs --- Makefile | 11 ++- docs/animation.md | 4 ++ docs/concepts.md | 6 ++ docs/constants.md | 12 +++- docs/effects.md | 42 +++++------ docs/layers.md | 4 +- .../angle.json} | 2 +- .../checkbox.json} | 2 +- .../color.json} | 2 +- .../drop-down.json} | 2 +- .../effect-value.json | 0 .../ignored.json} | 2 +- .../layer.json} | 2 +- docs/schema/effect-values/no-value.json | 6 ++ .../point.json} | 2 +- .../slider.json} | 2 +- .../effects/change-to-color-effect.json | 22 +++--- docs/schema/effects/drop-shadow-effect.json | 10 +-- docs/schema/effects/effect-no-value.json | 24 ------- docs/schema/effects/effect.json | 18 ++--- docs/schema/effects/fill-effect.json | 14 ++-- docs/schema/effects/gaussian-blur-effect.json | 8 +-- docs/schema/effects/matte3-effect.json | 2 +- docs/schema/effects/pro-levels-effect.json | 70 +++++++++---------- docs/schema/effects/radial-wipe-effect.json | 10 +-- docs/schema/effects/stroke-effect.json | 22 +++--- docs/schema/effects/tint-effect.json | 6 +- docs/schema/effects/tritone-effect.json | 6 +- docs/shapes.md | 29 ++++++-- docs/text.md | 25 +++++++ extensions/md_extensions.py | 64 ++++++++++++++--- requirements.txt | 1 + tools/schema-info.py | 18 ++--- tools/schema-validate.py | 39 ++++++++++- 34 files changed, 307 insertions(+), 182 deletions(-) rename docs/schema/{effects/effect-value-angle.json => effect-values/angle.json} (91%) rename docs/schema/{effects/effect-value-checkbox.json => effect-values/checkbox.json} (91%) rename docs/schema/{effects/effect-value-color.json => effect-values/color.json} (91%) rename docs/schema/{effects/effect-value-drop-down.json => effect-values/drop-down.json} (91%) rename docs/schema/{effects => effect-values}/effect-value.json (100%) rename docs/schema/{effects/effect-value-ignored.json => effect-values/ignored.json} (91%) rename docs/schema/{effects/effect-value-layer.json => effect-values/layer.json} (91%) create mode 100644 docs/schema/effect-values/no-value.json rename docs/schema/{effects/effect-value-point.json => effect-values/point.json} (91%) rename docs/schema/{effects/effect-value-slider.json => effect-values/slider.json} (91%) delete mode 100644 docs/schema/effects/effect-no-value.json diff --git a/Makefile b/Makefile index c5bcdf7f..3834c0c8 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ MKDOCS ?= PYTHONPATH="$(SOURCE_DIR)/extensions" mkdocs SOURCE_DIR = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) OUTPUT_DIR ?= $(CURDIR)/site -.PHONY: all install_dependencies docs docs_serve lottie.schema.json validate +.PHONY: all install_dependencies docs docs_serve lottie.schema.json validate validate_links all: docs @@ -21,6 +21,11 @@ $(SOURCE_DIR)/docs/schema/lottie.schema.json: $(SOURCE_DIR)/tools/schema-merge.p docs:$(SOURCE_DIR)/docs/schema/lottie.schema.json $(MKDOCS) build -f $(SOURCE_DIR)/mkdocs.yml -d $(OUTPUT_DIR) +$(OUTPUT_DIR)/index.html:$(wildcard $(SOURCE_DIR)/docs/**/*) +$(OUTPUT_DIR)/index.html:$(SOURCE_DIR)/docs/schema/lottie.schema.json +$(OUTPUT_DIR)/index.html:$(SOURCE_DIR)/extensions/md_extensions.py +$(OUTPUT_DIR)/index.html:docs + docs_serve:$(SOURCE_DIR)/docs/schema/lottie.schema.json $(MKDOCS) serve -f $(SOURCE_DIR)/mkdocs.yml @@ -29,3 +34,7 @@ install_dependencies: validate: $(SOURCE_DIR)/docs/schema/lottie.schema.json $(SOURCE_DIR)/tools/schema-validate.py + + +validate_links:$(OUTPUT_DIR)/index.html + $(SOURCE_DIR)/tools/schema-validate.py --html $(OUTPUT_DIR) diff --git a/docs/animation.md b/docs/animation.md index da0c21d7..81a47b8f 100644 --- a/docs/animation.md +++ b/docs/animation.md @@ -21,3 +21,7 @@ program used to create the file and other useful information: {schema_object:animation/metadata} +## Motion Blur + +{schema_object:animation/motion-blur} + diff --git a/docs/concepts.md b/docs/concepts.md index 88b95969..1200b27d 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -191,6 +191,12 @@ In tangent y :slider:assets[0].layers[1].shapes[0].ks.k.i[2][1]!-1,assets[0].lay Hold:select:layers[0].ks.p.k[0].h,layers[0].ks.p.k[1].h:No=0:Yes=1 :json:layers[0].ks.p +### Animated Position + +Position properties have additional attributes in their keyframes to represent bezier tangents in the path followed by the animation + +{schema-object:animated-properties/position-keyframe} + ## Transform This represents a layer or shape transform. diff --git a/docs/constants.md b/docs/constants.md index 982f35c8..f13ec2cf 100644 --- a/docs/constants.md +++ b/docs/constants.md @@ -48,11 +48,11 @@ Opacity:slider:layers[0].ks.o.k:0:50:100 {schema_enum:line-cap} -## {schema_attribute:title:constants/line-cap} +## {schema_attribute:title:constants/line-join} -{schema_attribute:description:constants/line-cap} +{schema_attribute:description:constants/line-join} -{schema_enum:line-cap} +{schema_enum:line-join} ## {schema_attribute:title:constants/mask-mode} @@ -126,3 +126,9 @@ Matte Mode:enum:layers[2].tt:matte-mode:1 {schema_attribute:description:constants/trim-multiple-shapes} {schema_enum:trim-multiple-shapes} + +## {schema_attribute:title:constants/text-caps} + +{schema_attribute:description:constants/text-caps} + +{schema_enum:text-caps} diff --git a/docs/effects.md b/docs/effects.md index dc491a03..bc1be8d1 100644 --- a/docs/effects.md +++ b/docs/effects.md @@ -168,7 +168,7 @@ SKIP:#/$defs/effects/effect {schema_effect:effects/matte3-effect} -### Guassian Blur Effect +### Gaussian Blur Effect {schema_object:effects/gaussian-blur-effect} SKIP:#/$defs/effects/effect @@ -208,7 +208,7 @@ Blur:slider:layers[0].ef[0].ef[4].v.k:0:7:512 :json:layers[0].ef[0] -### Radial Wipe +### Radial Wipe Effect {schema_object:effects/radial-wipe-effect} SKIP:#/$defs/effects/effect @@ -218,7 +218,7 @@ SKIP:#/$defs/effects/effect ## Effect Values -{schema_object:effects/effect-value} +{schema_object:effect-values/effect-value} EXPAND:#/$defs/helpers/visual-object @@ -237,45 +237,45 @@ EXPAND:#/$defs/helpers/visual-object ### No Value -{schema_object:effects/effect-no-value} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/no-value} +SKIP:#/$defs/effect-values/effect-value ### Slider -{schema_object:effects/effect-value-slider} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/slider} +SKIP:#/$defs/effect-values/effect-value ### Angle -{schema_object:effects/effect-value-angle} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/angle} +SKIP:#/$defs/effect-values/effect-value ### Color -{schema_object:effects/effect-value-color} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/color} +SKIP:#/$defs/effect-values/effect-value ### Point -{schema_object:effects/effect-value-point} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/point} +SKIP:#/$defs/effect-values/effect-value ### Checkbox -{schema_object:effects/effect-value-checkbox} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/checkbox} +SKIP:#/$defs/effect-values/effect-value ### Ignored -{schema_object:effects/effect-value-ignored} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/ignored} +SKIP:#/$defs/effect-values/effect-value ### Drop Down -{schema_object:effects/effect-value-drop-down} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/drop-down} +SKIP:#/$defs/effect-values/effect-value ### Layer -{schema_object:effects/effect-value-layer} -SKIP:#/$defs/effects/effect-value +{schema_object:effect-values/layer} +SKIP:#/$defs/effect-values/effect-value diff --git a/docs/layers.md b/docs/layers.md index d93eb92b..5f5709f9 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -6,7 +6,7 @@ There are several layer types, which is specified by the `ty` attribute: |`ty`| Layer Type | Description | |----|----------------------------------|-----------------------------------------------------------------------------------------------| -|`0` |[Precomposition](#precomp-layer) |Renders a [Precomposition](assets.md#precomposition) | +|`0` |[Precomposition](#precomposition-layer)|Renders a [Precomposition](assets.md#precomposition) | |`1` |[Solid Color](#solid-color-layer) |Static rectangle filling the canvas with a single color | |`2` |[Image](#image-layer) |Renders an [Image](assets.md#image) | |`3` |[Null (Empty)](#null-layer) |No contents, only used for [parenting](#parenting) | @@ -115,7 +115,7 @@ The only special property for this layer is **shapes**, an [array](concepts.md#l {schema_object:layers/shape-layer} -## PreComp Layer +## Precomposition Layer This layer renders a [precomposition](assets.md#precomposition). diff --git a/docs/schema/effects/effect-value-angle.json b/docs/schema/effect-values/angle.json similarity index 91% rename from docs/schema/effects/effect-value-angle.json rename to docs/schema/effect-values/angle.json index b1e6d0ba..b0893dc4 100644 --- a/docs/schema/effects/effect-value-angle.json +++ b/docs/schema/effect-values/angle.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value-checkbox.json b/docs/schema/effect-values/checkbox.json similarity index 91% rename from docs/schema/effects/effect-value-checkbox.json rename to docs/schema/effect-values/checkbox.json index c74f1e8f..04242d16 100644 --- a/docs/schema/effects/effect-value-checkbox.json +++ b/docs/schema/effect-values/checkbox.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value-color.json b/docs/schema/effect-values/color.json similarity index 91% rename from docs/schema/effects/effect-value-color.json rename to docs/schema/effect-values/color.json index 16e4b487..3df28a06 100644 --- a/docs/schema/effects/effect-value-color.json +++ b/docs/schema/effect-values/color.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value-drop-down.json b/docs/schema/effect-values/drop-down.json similarity index 91% rename from docs/schema/effects/effect-value-drop-down.json rename to docs/schema/effect-values/drop-down.json index 3c2e972b..861e681e 100644 --- a/docs/schema/effects/effect-value-drop-down.json +++ b/docs/schema/effect-values/drop-down.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value.json b/docs/schema/effect-values/effect-value.json similarity index 100% rename from docs/schema/effects/effect-value.json rename to docs/schema/effect-values/effect-value.json diff --git a/docs/schema/effects/effect-value-ignored.json b/docs/schema/effect-values/ignored.json similarity index 91% rename from docs/schema/effects/effect-value-ignored.json rename to docs/schema/effect-values/ignored.json index 651613d3..823c0575 100644 --- a/docs/schema/effects/effect-value-ignored.json +++ b/docs/schema/effect-values/ignored.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value-layer.json b/docs/schema/effect-values/layer.json similarity index 91% rename from docs/schema/effects/effect-value-layer.json rename to docs/schema/effect-values/layer.json index 207b1d62..d93bff7c 100644 --- a/docs/schema/effects/effect-value-layer.json +++ b/docs/schema/effect-values/layer.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effect-values/no-value.json b/docs/schema/effect-values/no-value.json new file mode 100644 index 00000000..e869ed93 --- /dev/null +++ b/docs/schema/effect-values/no-value.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "title": "Effect No Value", + "description": "" +} diff --git a/docs/schema/effects/effect-value-point.json b/docs/schema/effect-values/point.json similarity index 91% rename from docs/schema/effects/effect-value-point.json rename to docs/schema/effect-values/point.json index 30b85639..a22daebf 100644 --- a/docs/schema/effects/effect-value-point.json +++ b/docs/schema/effect-values/point.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/effect-value-slider.json b/docs/schema/effect-values/slider.json similarity index 91% rename from docs/schema/effects/effect-value-slider.json rename to docs/schema/effect-values/slider.json index 4b6ba129..a729c2cb 100644 --- a/docs/schema/effects/effect-value-slider.json +++ b/docs/schema/effect-values/slider.json @@ -5,7 +5,7 @@ "description": "", "allOf": [ { - "$ref": "#/$defs/effects/effect-value" + "$ref": "#/$defs/effect-values/effect-value" }, { "type": "object", diff --git a/docs/schema/effects/change-to-color-effect.json b/docs/schema/effects/change-to-color-effect.json index 9c9214ea..372f4d46 100644 --- a/docs/schema/effects/change-to-color-effect.json +++ b/docs/schema/effects/change-to-color-effect.json @@ -21,47 +21,47 @@ "prefixItems": [ { "title": "from_color", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "to_color", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "change", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "change_by", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "tolerance", - "$ref": "#/$defs/effects/effect-value-ignored" + "$ref": "#/$defs/effect-values/ignored" }, { "title": "hue", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "lightness", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "saturation", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "saturation_", - "$ref": "#/$defs/effects/effect-value-ignored" + "$ref": "#/$defs/effect-values/ignored" }, { "title": "softness", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "view_correction", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" } ] } diff --git a/docs/schema/effects/drop-shadow-effect.json b/docs/schema/effects/drop-shadow-effect.json index 7ae0bd30..cac942d1 100644 --- a/docs/schema/effects/drop-shadow-effect.json +++ b/docs/schema/effects/drop-shadow-effect.json @@ -21,24 +21,24 @@ "prefixItems": [ { "title": "color", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "opacity", "description": "Opacity between 0 and 255", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "angle", - "$ref": "#/$defs/effects/effect-value-angle" + "$ref": "#/$defs/effect-values/angle" }, { "title": "distance", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "blur", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" } ] } diff --git a/docs/schema/effects/effect-no-value.json b/docs/schema/effects/effect-no-value.json deleted file mode 100644 index 2c91ae4b..00000000 --- a/docs/schema/effects/effect-no-value.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "title": "Effect No Value", - "description": "", - "allOf": [ - { - "$ref": "#/$defs/effects/effect-value" - }, - { - "type": "object", - "properties": { - "ty": { - "title": "Type", - "type": "integer", - "const": null - } - }, - "required": [ - "ty" - ] - } - ] -} \ No newline at end of file diff --git a/docs/schema/effects/effect.json b/docs/schema/effects/effect.json index 23a1f832..cad549b6 100644 --- a/docs/schema/effects/effect.json +++ b/docs/schema/effects/effect.json @@ -15,15 +15,15 @@ "type": "array", "items": { "anyOf": [ - {"$ref": "#/$defs/effects/effect-no-value"}, - {"$ref": "#/$defs/effects/effect-value-angle"}, - {"$ref": "#/$defs/effects/effect-value-checkbox"}, - {"$ref": "#/$defs/effects/effect-value-color"}, - {"$ref": "#/$defs/effects/effect-value-drop-down"}, - {"$ref": "#/$defs/effects/effect-value-ignored"}, - {"$ref": "#/$defs/effects/effect-value-layer"}, - {"$ref": "#/$defs/effects/effect-value-point"}, - {"$ref": "#/$defs/effects/effect-value-slider"} + {"$ref": "#/$defs/effect-values/no-value"}, + {"$ref": "#/$defs/effect-values/angle"}, + {"$ref": "#/$defs/effect-values/checkbox"}, + {"$ref": "#/$defs/effect-values/color"}, + {"$ref": "#/$defs/effect-values/drop-down"}, + {"$ref": "#/$defs/effect-values/ignored"}, + {"$ref": "#/$defs/effect-values/layer"}, + {"$ref": "#/$defs/effect-values/point"}, + {"$ref": "#/$defs/effect-values/slider"} ] } }, diff --git a/docs/schema/effects/fill-effect.json b/docs/schema/effects/fill-effect.json index bb9f8d5e..0f5387fe 100644 --- a/docs/schema/effects/fill-effect.json +++ b/docs/schema/effects/fill-effect.json @@ -21,32 +21,32 @@ "prefixItems": [ { "title": "00", - "$ref": "#/$defs/effects/effect-value-point" + "$ref": "#/$defs/effect-values/point" }, { "title": "01", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "color", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "03", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "04", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "05", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "opacity", "description": "Opacity in [0, 1]", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" } ] } diff --git a/docs/schema/effects/gaussian-blur-effect.json b/docs/schema/effects/gaussian-blur-effect.json index 6d66725b..8e72227e 100644 --- a/docs/schema/effects/gaussian-blur-effect.json +++ b/docs/schema/effects/gaussian-blur-effect.json @@ -21,15 +21,15 @@ "prefixItems": [ { "title": "sigma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "dimensions", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "wrap", - "$ref": "#/$defs/effects/effect-value-checkbox" + "$ref": "#/$defs/effect-values/checkbox" } ] } @@ -39,4 +39,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/docs/schema/effects/matte3-effect.json b/docs/schema/effects/matte3-effect.json index 61a68ff0..e990ac24 100644 --- a/docs/schema/effects/matte3-effect.json +++ b/docs/schema/effects/matte3-effect.json @@ -21,7 +21,7 @@ "prefixItems": [ { "title": "index", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" } ] } diff --git a/docs/schema/effects/pro-levels-effect.json b/docs/schema/effects/pro-levels-effect.json index e2bcd549..5172fbdd 100644 --- a/docs/schema/effects/pro-levels-effect.json +++ b/docs/schema/effects/pro-levels-effect.json @@ -21,143 +21,143 @@ "prefixItems": [ { "title": "00", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "01", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "02", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "comp_inblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "comp_inwhite", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "comp_gamma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "comp_outblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "comp_outwhite", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "08", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "09", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "r_inblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "r_inwhite", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "r_gamma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "r_outblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "r_outwhite", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "15", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "16", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "g_inblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "g_inwhite", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "g_gamma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "g_outblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "g_outwhite", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "22", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b3", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b_inblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b_inwhite", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b_gamma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b_outblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "b_outwhite", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" }, { "title": "29", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "a_inblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "a_inwhite", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "a_gamma", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "a_outblack", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "a_outwhite", - "$ref": "#/$defs/effects/effect-no-value" + "$ref": "#/$defs/effect-values/no-value" } ] } diff --git a/docs/schema/effects/radial-wipe-effect.json b/docs/schema/effects/radial-wipe-effect.json index 25b52a9e..ef39ed99 100644 --- a/docs/schema/effects/radial-wipe-effect.json +++ b/docs/schema/effects/radial-wipe-effect.json @@ -21,23 +21,23 @@ { "title": "Completion", "description": "Between 0 and 100", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "Start Angle", - "$ref": "#/$defs/effects/effect-value-angle" + "$ref": "#/$defs/effect-values/angle" }, { "title": "Wipe Center", - "$ref": "#/$defs/effects/effect-value-point" + "$ref": "#/$defs/effect-values/point" }, { "title": "Wipe", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "Feather", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" } ] } diff --git a/docs/schema/effects/stroke-effect.json b/docs/schema/effects/stroke-effect.json index 82dc7bd7..9f88362f 100644 --- a/docs/schema/effects/stroke-effect.json +++ b/docs/schema/effects/stroke-effect.json @@ -21,47 +21,47 @@ "prefixItems": [ { "title": "00", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "01", - "$ref": "#/$defs/effects/effect-value-checkbox" + "$ref": "#/$defs/effect-values/checkbox" }, { "title": "02", - "$ref": "#/$defs/effects/effect-value-checkbox" + "$ref": "#/$defs/effect-values/checkbox" }, { "title": "color", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "04", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "05", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "06", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "07", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "08", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" }, { "title": "09", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" }, { "title": "type", - "$ref": "#/$defs/effects/effect-value-drop-down" + "$ref": "#/$defs/effect-values/drop-down" } ] } diff --git a/docs/schema/effects/tint-effect.json b/docs/schema/effects/tint-effect.json index 59c70743..3179e38a 100644 --- a/docs/schema/effects/tint-effect.json +++ b/docs/schema/effects/tint-effect.json @@ -22,17 +22,17 @@ { "title": "Black Color", "description": "Tint of the darker parts of the layer", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "White Color", "description": "Tint of the lighter parts of the layer", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "Intensity", "description": "Intensity of the effect, 0 means the layer is unchanged. 100 means full effect", - "$ref": "#/$defs/effects/effect-value-slider" + "$ref": "#/$defs/effect-values/slider" } ] } diff --git a/docs/schema/effects/tritone-effect.json b/docs/schema/effects/tritone-effect.json index 5238ef2e..7de9512b 100644 --- a/docs/schema/effects/tritone-effect.json +++ b/docs/schema/effects/tritone-effect.json @@ -21,15 +21,15 @@ "prefixItems": [ { "title": "bright", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "mid", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" }, { "title": "dark", - "$ref": "#/$defs/effects/effect-value-color" + "$ref": "#/$defs/effect-values/color" } ] } diff --git a/docs/shapes.md b/docs/shapes.md index 3cbaa5d9..0f168c62 100644 --- a/docs/shapes.md +++ b/docs/shapes.md @@ -26,17 +26,17 @@ ty:Shape type (see values below) |`sh`|[Path](#path) | |`fl`|[Fill](#fill) | |`st`|[Stroke](#stroke) | -|`gf`|[Gradient Fill](#gradient-fill-stroke) | -|`gs`|[Gradient Stroke](#gradient-fill-stroke) | +|`gf`|[Gradient Fill](#gradients) | +|`gs`|[Gradient Stroke](#gradients) | |`gr`|[Group](#group) | |`tr`|[Transform](transform-shape) | |`rp`|[Repeater](#repeater) | |`tm`|[Trim](#trim-path) | |`rd`|[Rounded Corners](#rounded-corners) | |`pb`|[Pucker / Bloat](#pucker-bloat) | -|`mm`|Merge | -|`tw`|Twist | -|`op`|Offset Path | +|`mm`|[Merge](#merge) | +|`tw`|[Twist](#twist) | +|`op`|[Offset Path](#offset-path) | ## Shape @@ -179,7 +179,7 @@ Defined as a sequence of alternating dashes and gaps. |`n` |[Dash Type](constants.md#strokedashtype) |Dash type | |`v` |[Animated](concepts.md#animated-property) `number` |Length of the dash | -### Gradient Fill / Stroke +### Gradients Gradient fill and gradient stroke have the same attributes as [fill](#fill) and [stroke](#stroke) but remove color (`c`) and add the following: @@ -364,3 +364,20 @@ When `a` is negative the vertices are pushed away from the center with `100` bei {lottie_playground:pucker_bloat.json:512:512} Amount:slider:layers[0].shapes[0].it[1].a.k:-100:50:100 :json:layers[0].shapes[0].it[1] + + +### Twist + +{schema_object:shapes/twist} +SKIP:#/$defs/shapes/twist + +### Merge + +{schema_object:shapes/merge} +SKIP:#/$defs/shapes/merge + + +### Offset Path + +{schema_object:shapes/offset-path} +SKIP:#/$defs/shapes/offset-path diff --git a/docs/text.md b/docs/text.md index 1c5a2ddd..44ee2a8d 100644 --- a/docs/text.md +++ b/docs/text.md @@ -201,3 +201,28 @@ Position Y:slider:layers[0].ks.p.k[1]:0:80:100 Font Size:slider:layers[0].t.d.k[0].s.s:0:100:150 Justify:enum:layers[0].t.d.k[0].s.j:text-justify :json:layers[0] + + +### Text More Options + +{schema_object:text/text-more-options} + + +### Masked Path + +{schema_object:text/masked-path} + + +### Text Selector + +{schema_object:text/text-selector} + +### Text Selector Property + +{schema_object:text/text-selector-property} + + +### Text Animator Data Property + +{schema_object:text/text-animator-data-property} + diff --git a/extensions/md_extensions.py b/extensions/md_extensions.py index 1b51e193..2acf16b1 100644 --- a/extensions/md_extensions.py +++ b/extensions/md_extensions.py @@ -248,18 +248,13 @@ def ref_links(ref: str, data: SchemaData): if len(chunks) != 2: return [] - name = data.get_ref(ref).get("title", chunks[1]) + name = data.get_ref(ref).get("title", chunks[1]) if data else chunks[1] link = ReferenceLink(chunks[0], chunks[1], name) - if link.group in ("helpers", "animated-properties"): - link.page = "concepts" - - if link.cls == "int-boolean": - link.anchor = "booleans" - link.name = "0-1 Integer" - elif link.group == "animated-properties": + if link.group == "animated-properties": extra = None link.name = "Animated " + link.page = "concepts" link.anchor = "animated-property" if link.cls == "value": link.name += "number" @@ -275,8 +270,55 @@ def ref_links(ref: str, data: SchemaData): if extra: return [link, extra] + + elif link.group == "shapes": + if link.cls == "gradient" or link.cls == "gradient-stroke" or link.cls == "gradient-fill": + link.anchor = "gradients" + elif link.cls == "shape-element": + link.anchor = "shape-elements" + elif link.cls == "base-stroke": + link.anchor = "stroke" + elif link.cls == "trim": + link.anchor = "trim-path" + elif link.cls == "shape-list": + link.page = "concepts" + link.anchor = "lists-of-layers-and-shapes" + elif link.cls == "transform": + link.anchor = "transform-shape" + elif link.cls == "modifier": + link.anchor = "modifiers" + elif link.cls == "stroke-dash": + link.anchor = "stroke-dashes" + + elif link.group == "helpers": + link.page = "concepts" + if link.cls == "mask": + link.page = "layers" + link.anchor = "masks" + elif link.cls == "color": + link.anchor = "colors" + elif link.cls == "int-boolean": + link.anchor = "booleans" + link.name = "0-1 Integer" + elif link.cls == "visual-object": + return [] + + elif link.group == "effect-values": + link.page = "effects" + if link.cls == "effect-value": + link.anchor = "effect-values" + elif link.group == "constants": link.anchor = link.anchor.replace("-", "") + elif link.group == "text" and link.cls == "font": + link.anchor = "font-list" + elif link.group == "effects" and link.cls == "effect": + link.anchor = "effects" + elif link.group == "assets" and link.cls == "asset": + link.anchor = "assets" + elif link.group == "animation" and link.cls == "composition": + link.page = "concepts" + link.anchor = "lists-of-layers-and-shapes" return [link] @@ -528,10 +570,10 @@ def _object_properties(self, object, prop_dict, base_list): base_list.append(chunk["$ref"]) def _base_link(self, parent, ref): + link = ref_links(ref, self.schema_data)[0] a = etree.SubElement(parent, "a") - a.text = self.schema_data.get_ref(ref)["title"] - path_chunks = ref.split("/") - a.attrib["href"] = "%s.md#%s" % (path_chunks[-2], path_chunks[-1]) + a.text = link.name + a.attrib["href"] = "%s.md#%s" % (link.page, link.anchor) return a def run(self, parent, blocks): diff --git a/requirements.txt b/requirements.txt index 9c2b7201..55cfd1c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ mkdocs mkdocs-cinder git+https://github.com/bmcorser/fontawesome-markdown.git@master +lxml diff --git a/tools/schema-info.py b/tools/schema-info.py index 93ab5687..7a34b5fe 100755 --- a/tools/schema-info.py +++ b/tools/schema-info.py @@ -116,19 +116,19 @@ def cmd_compare(ns): mappings = [ # Community / lottie-docs ("animation", "animation/animation"), - ("effects/angle", "effects/effect-value-angle"), - ("effects/checkBox", "effects/effect-value-checkbox"), - ("effects/color", "effects/effect-value-color"), - #("effects/customValue", "effects/effect-value-"), - ("effects/dropDown", "effects/effect-value-drop-down"), + ("effects/angle", "effect-values/angle"), + ("effects/checkBox", "effect-values/checkbox"), + ("effects/color", "effect-values/color"), + #("effects/customValue", "effect-values/"), + ("effects/dropDown", "effect-values/drop-down"), ("effects/fill", "effects/fill-effect"), #("effects/group", "effects/"), #("effects/index", "effects/"), #("effects/layer", "effects/"), - ("effects/noValue", "effects/effect-no-value"), - ("effects/point", "effects/effect-value-point"), + ("effects/noValue", "effect-values/no-value"), + ("effects/point", "effect-values/point"), ("effects/proLevels", "effects/pro-levels-effect"), - ("effects/slider", "effects/effect-value-slider"), + ("effects/slider", "effect-values/slider"), ("effects/stroke", "effects/stroke-effect"), ("effects/tint", "effects/tint-effect"), ("effects/tritone", "effects/tritone-effect"), @@ -187,7 +187,7 @@ def cmd_compare(ns): (("layers/text", "properties", "t"), "text/text-animator-data"), ] here_ignored = { - "effects/effect-value", + "effect-values/effect-value", "shapes/gradient", "helpers/visual-object", "layers/layer", diff --git a/tools/schema-validate.py b/tools/schema-validate.py index d2268710..f6eb52ce 100755 --- a/tools/schema-validate.py +++ b/tools/schema-validate.py @@ -3,6 +3,7 @@ import sys import json import pathlib +import argparse class SchemaPath: @@ -87,7 +88,7 @@ def validate(self, schema_root): self.root = Schema(schema_root, None) self.collect_defs(self.root / "$defs") self.validate_recursive(self.root) - for unused in self.expected_refs: + for unused in (self.expected_refs - self.valid_refs): self.show_error("Unused def: %s" % unused) def show_error(self, msg): @@ -105,7 +106,6 @@ def validate_ref(self, schema: Schema): self.error(schema, "Invalid $ref: %s" % schema.value) return - self.expected_refs.discard(schema.value) self.valid_refs.add(schema.value) def validate_schema(self, schema: Schema): @@ -128,13 +128,46 @@ def collect_defs(self, schema): else: self.collect_defs(child) + def check_links(self, html_path: pathlib.Path): + checked = set() + file_cache = {} -filename = pathlib.Path(__file__).parent.parent / "docs" / "schema" / "lottie.schema.json" + for ref in self.expected_refs: + links = md_extensions.ref_links(ref, None) + for link in links: + key = (link.page, link.anchor) + if key in checked: + continue + checked.add(key) + + if link.page not in file_cache: + file = html_path / link.page / "index.html" + if not file.exists(): + self.show_error("%s: Missing page %s" % (ref, link.page)) + continue + file_cache[link.page] = lxml.html.parse(str(file)).xpath(".//*[@id]/@id") + + if link.anchor not in file_cache[link.page]: + self.show_error("%s: Missing anchor %s.md %s" % (ref, link.page, link.anchor)) + +root = pathlib.Path(__file__).parent.parent +filename = root / "docs" / "schema" / "lottie.schema.json" + +parser = argparse.ArgumentParser() +parser.add_argument("--html", help="Path to the html to check links", type=pathlib.Path) +ns = parser.parse_args() with open(filename) as file: data = json.load(file) validator = Validator() validator.validate(data) + +if ns.html: + sys.path.append(str(root / "extensions")) + import md_extensions + import lxml.html + validator.check_links(ns.html) + if validator.has_error: sys.exit(1)