From 108d85e9ee45e310d69d393845891400286e2a1f Mon Sep 17 00:00:00 2001 From: BrodBlox09 <99990717+BrodBlox09@users.noreply.github.com> Date: Sun, 29 Jun 2025 20:03:09 +0200 Subject: [PATCH] Update JSON UI Schema (#357) * Add permutations description * Adjust grammar * Update description of "num_mip_levels" * Update "atlas_tile" and "blend_frames" property Some properties had completely incorrect titles as well, those were fixed in this commit too. * Update JSON UI schema * Update item schema * Update terrain_texture schema * Update animations schema * Update go_home.json * Update textures schemas * Update bindings schema * Add some missing JSON UI from vanilla controls And modify some that incorrectly make vanilla JSON UI wrong. * Update modifications property Modifications now understand the difference between element and array operations, and requires different things for different operations. * Update vec2 equation definition Made the regex pattern much more robust and able to handle niche units like %sm, as well as the add and subtract operators * Add to enums There were several enum values that were valid in the vanilla JSON UI but not listed in the schemas. This has now been amended. * Add new general types Animation and texture file path types * Add a few missing vanilla properties At this point pretty much the only thing left to do is add all of the rest of the vanilla properties, there are 196 "problems" left in the vanilla JSON UI in the 1.21.80.3 Minecraft version and 189 of which are missing properties. That is not to say there are 189 properties to add, there are only 65 that are missing. Those missing properties are, in order of most to least commonly referenced in the vanilla JSON UI files from the vanilla 1.21.80.3 Minecraft resource pack: [ { "propertyName": "use_selected_skin", "count": 16 }, { "propertyName": "clip_state_change_event", "count": 14 }, { "propertyName": "gesture_tracking_button", "count": 11 }, { "propertyName": "use_priority", "count": 11 }, { "propertyName": "rotation", "count": 9 }, { "propertyName": "use_skin_gui_scale", "count": 9 }, { "propertyName": "always_handle_controller_direction", "count": 7 }, { "propertyName": "starting_rotation", "count": 7 }, { "propertyName": "focus_container_custom_left", "count": 7 }, { "propertyName": "text_tts", "count": 6 }, { "propertyName": "enable_scissor_test", "count": 6 }, { "propertyName": "tts_skip_message", "count": 5 }, { "propertyName": "should_be_skipped_during_automation", "count": 4 }, { "propertyName": "notify_on_ellipses", "count": 4 }, { "propertyName": "tiled_scale", "count": 3 }, { "propertyName": "debug", "count": 3 }, { "propertyName": "tts_play_on_unchanged_focus_control", "count": 3 }, { "propertyName": "focus_container_custom_right", "count": 3 }, { "propertyName": "always_accepts_input", "count": 2 }, { "propertyName": "use_player_paperdoll", "count": 2 }, { "propertyName": "reset_event", "count": 2 }, { "propertyName": "size", "count": 2 }, { "propertyName": "consume_event", "count": 2 }, { "propertyName": "inner_radius", "count": 2 }, { "propertyName": "outer_radius", "count": 2 }, { "propertyName": "state_controls", "count": 2 }, { "propertyName": "resettable", "count": 2 }, { "propertyName": "focus_container_custom_up", "count": 2 }, { "propertyName": "inline_modal", "count": 2 }, { "propertyName": "rotation_x", "count": 2 }, { "propertyName": "rotation_y", "count": 2 }, { "propertyName": "activated", "count": 2 }, { "propertyName": "always_listening", "count": 1 }, { "propertyName": "grid_fill_direction", "count": 1 }, { "propertyName": "end_event", "count": 1 }, { "propertyName": "text_color", "count": 1 }, { "propertyName": "background_color", "count": 1 }, { "propertyName": "load_screen_immediately", "count": 1 }, { "propertyName": "gamepad_cursor_deflection_mode", "count": 1 }, { "propertyName": "renderer_properties", "count": 1 }, { "propertyName": "color_corrected", "count": 1 }, { "propertyName": "notify_ellipses_sibling", "count": 1 }, { "propertyName": "target_cycler_to_compare", "count": 1 }, { "propertyName": "grid_item_when_current", "count": 1 }, { "propertyName": "grid_item_when_not_current", "count": 1 }, { "propertyName": "cycler_manager_size_control_target", "count": 1 }, { "propertyName": "slice_count", "count": 1 }, { "propertyName": "select_button_name", "count": 1 }, { "propertyName": "hover_button_name", "count": 1 }, { "propertyName": "analog_button_name", "count": 1 }, { "propertyName": "iterate_left_button_name", "count": 1 }, { "propertyName": "iterate_right_button_name", "count": 1 }, { "propertyName": "initial_button_slice", "count": 1 }, { "propertyName": "gamepad_deflection_mode", "count": 1 }, { "propertyName": "looping", "count": 1 }, { "propertyName": "wait_until_rendered_to_play", "count": 1 }, { "propertyName": "clip_ratio", "count": 1 }, { "propertyName": "grayscale", "count": 1 }, { "propertyName": "tts_skip_children", "count": 1 }, { "propertyName": "$main_content_fo", "count": 1 }, { "propertyName": "selected", "count": 1 }, { "propertyName": "can_be_deselected", "count": 1 }, { "propertyName": "ignoreCollectionItem", "count": 1 }, { "propertyName": "factory_variables", "count": 1 }, { "propertyName": "start_event", "count": 1 } ] * Fix PR Error Until issue https://github.com/Blockception/Minecraft-bedrock-json-schemas/issues/358 is resolved $refs may not refer to JSON definitions of other files. --- source/resource/ui/_global_variables.json | 2 +- .../ui/elements/properties/bindings.json | 42 +++++-- .../properties/camera_tilt_degrees.json | 5 + .../properties/constrain_to_rect.json | 4 + .../elements/properties/destroy_at_end.json | 12 +- .../ui/elements/properties/factory.json | 4 + .../ui/elements/properties/focus_mapping.json | 18 +++ .../ui/elements/properties/font_type.json | 2 +- .../resource/ui/elements/properties/fps.json | 5 +- .../ui/elements/properties/images.json | 16 ++- .../ui/elements/properties/line_padding.json | 4 + .../elements/properties/pressed_control.json | 2 +- .../ui/elements/properties/priority.json | 4 + .../ui/elements/properties/renderer.json | 28 ++++- .../ui/elements/properties/sound_volume.json | 3 +- .../ui/elements/properties/texture.json | 4 +- .../toggle_group_default_selected.json | 9 +- .../elements/properties/tts/ignore_count.json | 9 +- .../tts/override_control_value.json | 5 +- .../resource/ui/elements/properties/type.json | 3 + .../properties/use_custom_pocket_toast.json | 4 + source/resource/ui/general/anchor.json | 2 +- .../ui/general/animation_reference.json | 8 ++ source/resource/ui/general/color.json | 22 ++-- source/resource/ui/general/item_ref.json | 25 ++--- .../resource/ui/general/navigation_mode.json | 2 +- source/resource/ui/general/size.json | 48 +------- .../ui/general/texture_file_path.json | 6 + source/resource/ui/general/variable.json | 2 +- source/resource/ui/general/vec2.json | 14 +-- source/resource/ui/ui.json | 104 +++++++++++++++++- 31 files changed, 290 insertions(+), 128 deletions(-) create mode 100644 source/resource/ui/elements/properties/camera_tilt_degrees.json create mode 100644 source/resource/ui/elements/properties/constrain_to_rect.json create mode 100644 source/resource/ui/elements/properties/focus_mapping.json create mode 100644 source/resource/ui/elements/properties/line_padding.json create mode 100644 source/resource/ui/elements/properties/priority.json create mode 100644 source/resource/ui/elements/properties/use_custom_pocket_toast.json create mode 100644 source/resource/ui/general/animation_reference.json create mode 100644 source/resource/ui/general/texture_file_path.json diff --git a/source/resource/ui/_global_variables.json b/source/resource/ui/_global_variables.json index e82a80b3..1a2f66a7 100644 --- a/source/resource/ui/_global_variables.json +++ b/source/resource/ui/_global_variables.json @@ -3,7 +3,7 @@ "description": "Global variables that can be used in any JSON file.", "type": "object", "propertyNames": { - "pattern": "^\\$[a-zA-Z0-9_]+$" + "pattern": "^\\$[a-zA-Z0-9_-]+$" }, "additionalProperties": { "title": "Global Variable", diff --git a/source/resource/ui/elements/properties/bindings.json b/source/resource/ui/elements/properties/bindings.json index a841b6f5..ab3c904e 100644 --- a/source/resource/ui/elements/properties/bindings.json +++ b/source/resource/ui/elements/properties/bindings.json @@ -2,15 +2,11 @@ "$schema": "http://json-schema.org/draft-07/schema", "title": "Bindings", "description": "The bindings that are contained within this element.", - "anyOf": [ - { - "$ref": "../../general/item_ref.json" - }, - { - "type": "array", - "items": { + "definitions": { + "binding": { "type": "object", - "title": "Bindings", + "title": "Binding", + "description": "A binding that is contained within this element.", "additionalProperties": false, "properties": { "binding_collection_name": { @@ -28,10 +24,10 @@ "description": "The condition that must be met for the binding to be applied.", "anyOf": [ { - "enum": ["once", "always", "always_when_visible", "visible"] + "enum": ["once", "always", "always_when_visible", "visible", "visibility_changed", "none"] }, { - "$ref": "../../general/item_ref.json" + "$ref": "../../general/variable.json" } ] }, @@ -83,8 +79,34 @@ "description": "The name of the property that the binding is in.", "$ref": "../../general/string.json" } + }, + "if": { + "required": ["binding_type"], + "properties": { + "binding_type": { + "const": "view" + } + } + }, + "then": { + "required": ["source_property_name", "target_property_name"] } } + }, + "anyOf": [ + { + "$ref": "../../general/item_ref.json" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/binding" + } + }, + { + "$ref": "#/definitions/binding", + "title": "Binding", + "description": "The binding that is contained within this element." } ] } diff --git a/source/resource/ui/elements/properties/camera_tilt_degrees.json b/source/resource/ui/elements/properties/camera_tilt_degrees.json new file mode 100644 index 00000000..878b828c --- /dev/null +++ b/source/resource/ui/elements/properties/camera_tilt_degrees.json @@ -0,0 +1,5 @@ +{ + "title": "Camera Tilt Degrees", + "description": "The degrees the camera is tilted for a paper doll renderer.", + "$ref": "../../general/integer.json" +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/constrain_to_rect.json b/source/resource/ui/elements/properties/constrain_to_rect.json new file mode 100644 index 00000000..9dc077a5 --- /dev/null +++ b/source/resource/ui/elements/properties/constrain_to_rect.json @@ -0,0 +1,4 @@ +{ + "title": "Constrain To Rect", + "$ref": "../../general/boolean.json" +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/destroy_at_end.json b/source/resource/ui/elements/properties/destroy_at_end.json index c59e9f57..33a53250 100644 --- a/source/resource/ui/elements/properties/destroy_at_end.json +++ b/source/resource/ui/elements/properties/destroy_at_end.json @@ -1,12 +1,6 @@ { "title": "Destroy At End", - "description": "If true, the element will be destroyed at the end of the animation.", - "anyOf": [ - { - "enum": ["popup", "details_bubble_control", "bundle_mode_popup_control", "selected_item_details"] - }, - { - "$ref": "../../general/variable.json" - } - ] + "description": "If set, the given element will be destroyed at the end of the animation.", + "$ref": "../../general/item_ref.json", + "examples": ["popup", "details_bubble_control", "bundle_mode_popup_control", "selected_item_details"] } diff --git a/source/resource/ui/elements/properties/factory.json b/source/resource/ui/elements/properties/factory.json index ae258621..e3ce2343 100644 --- a/source/resource/ui/elements/properties/factory.json +++ b/source/resource/ui/elements/properties/factory.json @@ -39,6 +39,10 @@ "title": "Name", "description": "The name of the factory.", "type": "string" + }, + "max_children_size": { + "title": "Max Children Size", + "$ref": "../../general/integer.json" } } }, diff --git a/source/resource/ui/elements/properties/focus_mapping.json b/source/resource/ui/elements/properties/focus_mapping.json new file mode 100644 index 00000000..be1f11fd --- /dev/null +++ b/source/resource/ui/elements/properties/focus_mapping.json @@ -0,0 +1,18 @@ +{ + "title": "Focus Mapping", + "description": "If true, the element will be focus magnet enabled.", + "$comment": "The only place this is used in vanilla is in beacon_screen.json and it doesn't give much information", + "type": "array", + "items": { + "type": "object", + "properties": { + "focus_identifier": { + "$ref": "../../general/string.json" + }, + "focus_change_right": { + "$ref": "../../general/string.json", + "examples": ["FOCUS_OVERRIDE_STOP"] + } + } + } +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/font_type.json b/source/resource/ui/elements/properties/font_type.json index edffed4c..d674d41f 100644 --- a/source/resource/ui/elements/properties/font_type.json +++ b/source/resource/ui/elements/properties/font_type.json @@ -3,7 +3,7 @@ "description": "The type of the font.", "anyOf": [ { - "enum": ["smooth", "MinecraftTen", "MinecraftTenEmoticon"] + "enum": ["smooth", "MinecraftTen", "MinecraftTenEmoticon", "rune", "default"] }, { "$ref": "../../general/variable.json" diff --git a/source/resource/ui/elements/properties/fps.json b/source/resource/ui/elements/properties/fps.json index 0d579648..39c123d8 100644 --- a/source/resource/ui/elements/properties/fps.json +++ b/source/resource/ui/elements/properties/fps.json @@ -1,5 +1,6 @@ { "title": "FPS", "description": "The FPS of the animation.", - "$ref": "../../general/integer.json" -} + "$ref": "../../general/number.json", + "multipleOf": 1 +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/images.json b/source/resource/ui/elements/properties/images.json index 838809bd..77a99e04 100644 --- a/source/resource/ui/elements/properties/images.json +++ b/source/resource/ui/elements/properties/images.json @@ -8,7 +8,21 @@ { "type": "array", "items": { - "$ref": "../../general/item_ref.json" + "oneOf": [ + { + "$ref": "../../general/item_ref.json" + }, + { + "title": "Texture", + "type": "object", + "properties": { + "texture_path": { + "title": "Texture Path", + "$ref": "../../general/texture_file_path.json" + } + } + } + ] } } ] diff --git a/source/resource/ui/elements/properties/line_padding.json b/source/resource/ui/elements/properties/line_padding.json new file mode 100644 index 00000000..df662a95 --- /dev/null +++ b/source/resource/ui/elements/properties/line_padding.json @@ -0,0 +1,4 @@ +{ + "title": "Line Padding", + "$ref": "../../general/number.json" +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/pressed_control.json b/source/resource/ui/elements/properties/pressed_control.json index 3ec4663e..eadaeff7 100644 --- a/source/resource/ui/elements/properties/pressed_control.json +++ b/source/resource/ui/elements/properties/pressed_control.json @@ -3,7 +3,7 @@ "description": "The control that will be pressed.", "anyOf": [ { - "enum": ["hover", "pressed"] + "enum": ["hover", "pressed", ""] }, { "$ref": "../../general/item_ref.json" diff --git a/source/resource/ui/elements/properties/priority.json b/source/resource/ui/elements/properties/priority.json new file mode 100644 index 00000000..37071ebc --- /dev/null +++ b/source/resource/ui/elements/properties/priority.json @@ -0,0 +1,4 @@ +{ + "title": "Priority", + "$ref": "../../general/integer.json" +} \ No newline at end of file diff --git a/source/resource/ui/elements/properties/renderer.json b/source/resource/ui/elements/properties/renderer.json index ade03640..682f0233 100644 --- a/source/resource/ui/elements/properties/renderer.json +++ b/source/resource/ui/elements/properties/renderer.json @@ -3,10 +3,34 @@ "description": "The renderer that will be used by the element.", "anyOf": [ { - "enum": ["ui_holo_cursor"] + "enum": [ + "ui_holo_cursor", + "gradient_renderer", + "inventory_item_renderer", + "equipment_preview_renderer", + "trial_time_renderer", + "3d_structure_renderer", + "splash_text_renderer", + "paper_doll_renderer", + "profile_image_renderer", + "qr_code_renderer", + "name_tag_renderer", + "progress_bar_renderer", + "actor_portrait_renderer", + "banner_pattern_renderer", + "live_horse_renderer", + "holographic_postrenderer", + "panorama_renderer", + "bundle_tooltip_renderer", + "credits_renderer", + "vignette_renderer", + "debug_screen_renderer", + "enchanting_book_renderer", + "web_view_renderer" + ] }, { - "$ref": "../../general/item_ref.json" + "$ref": "../../general/variable.json" } ] } diff --git a/source/resource/ui/elements/properties/sound_volume.json b/source/resource/ui/elements/properties/sound_volume.json index b25249a8..fcd84afe 100644 --- a/source/resource/ui/elements/properties/sound_volume.json +++ b/source/resource/ui/elements/properties/sound_volume.json @@ -4,8 +4,7 @@ "anyOf": [ { "type": "number", - "minimum": 0, - "maximum": 1 + "minimum": 0 }, { "$ref": "../../general/item_ref.json" diff --git a/source/resource/ui/elements/properties/texture.json b/source/resource/ui/elements/properties/texture.json index 217dd654..983fcfdb 100644 --- a/source/resource/ui/elements/properties/texture.json +++ b/source/resource/ui/elements/properties/texture.json @@ -3,9 +3,7 @@ "description": "The texture to display.", "anyOf": [ { - "type": "string", - "pattern": "^textures/[a-zA-Z0-9/_-]+$", - "examples": ["textures/ui/file"] + "$ref": "../../general/texture_file_path.json" }, { "$ref": "../../general/item_ref.json" diff --git a/source/resource/ui/elements/properties/toggle_group_default_selected.json b/source/resource/ui/elements/properties/toggle_group_default_selected.json index 0685347c..5d91e972 100644 --- a/source/resource/ui/elements/properties/toggle_group_default_selected.json +++ b/source/resource/ui/elements/properties/toggle_group_default_selected.json @@ -1,5 +1,12 @@ { "title": "Toggle Group Default Selected", "description": "The default selected toggle of the toggle group.", - "$ref": "../../general/string.json" + "anyOf": [ + { + "$ref": "../../general/string.json" + }, + { + "$ref": "../../general/integer.json" + } + ] } diff --git a/source/resource/ui/elements/properties/tts/ignore_count.json b/source/resource/ui/elements/properties/tts/ignore_count.json index 3cd6c4a7..89f9aece 100644 --- a/source/resource/ui/elements/properties/tts/ignore_count.json +++ b/source/resource/ui/elements/properties/tts/ignore_count.json @@ -1,5 +1,12 @@ { "title": "TTS Ignore Count", "description": "The number of TTS ignores.", - "$ref": "../../../general/integer.json" + "anyOf": [ + { + "$ref": "../../../general/integer.json" + }, + { + "$ref": "../../../general/boolean.json" + } + ] } diff --git a/source/resource/ui/elements/properties/tts/override_control_value.json b/source/resource/ui/elements/properties/tts/override_control_value.json index ed902176..0a9b34d6 100644 --- a/source/resource/ui/elements/properties/tts/override_control_value.json +++ b/source/resource/ui/elements/properties/tts/override_control_value.json @@ -1,5 +1,8 @@ { "title": "TTS Override Control Value", "description": "If true, the TTS will override the control value.", - "$ref": "../../../general/boolean.json" + "anyOf": [ + { "$ref": "../../../general/boolean.json" }, + { "$ref": "../../../general/string.json" } + ] } diff --git a/source/resource/ui/elements/properties/type.json b/source/resource/ui/elements/properties/type.json index acad6ed4..02012706 100644 --- a/source/resource/ui/elements/properties/type.json +++ b/source/resource/ui/elements/properties/type.json @@ -6,10 +6,12 @@ "always_rotate", "button", "carousel_label", + "collection_panel", "custom", "dropdown", "edit_box", "grid", + "grid_page_indicator", "image_cycler", "image", "input_panel", @@ -20,6 +22,7 @@ "scroll_track", "scroll_view", "scrollbar_box", + "selection_wheel", "slider_box", "slider", "stack_panel", diff --git a/source/resource/ui/elements/properties/use_custom_pocket_toast.json b/source/resource/ui/elements/properties/use_custom_pocket_toast.json new file mode 100644 index 00000000..e240bb94 --- /dev/null +++ b/source/resource/ui/elements/properties/use_custom_pocket_toast.json @@ -0,0 +1,4 @@ +{ + "title": "Use Custom Pocket Toast", + "$ref": "../../general/boolean.json" +} \ No newline at end of file diff --git a/source/resource/ui/general/anchor.json b/source/resource/ui/general/anchor.json index b3497e31..6e6022b8 100644 --- a/source/resource/ui/general/anchor.json +++ b/source/resource/ui/general/anchor.json @@ -2,5 +2,5 @@ "title": "Anchor", "description": "An anchor is a reference to an element in the UI.", "type": "string", - "enum": ["bottom", "bottom_left", "bottom_right", "bottom_middle", "center", "left", "left_middle", "right", "right_middle", "top", "top_left", "top_right", "top_middle"] + "enum": ["bottom", "bottom_left", "bottom_right", "bottom_middle", "center", "center_middle", "left", "left_middle", "right", "right_middle", "top", "top_left", "top_right", "top_middle"] } diff --git a/source/resource/ui/general/animation_reference.json b/source/resource/ui/general/animation_reference.json new file mode 100644 index 00000000..06503bb2 --- /dev/null +++ b/source/resource/ui/general/animation_reference.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "title": "Animation Reference", + "description": "A reference to an animation element using the following syntax: [animation_name]@[namespace_reference].[animation_name_reference]", + "type": "string", + "examples": ["button@minecraft", "button@minecraft.ui"], + "pattern": "^[a-zA-Z0-9_]*@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?$" +} \ No newline at end of file diff --git a/source/resource/ui/general/color.json b/source/resource/ui/general/color.json index 77bd7412..211c732c 100644 --- a/source/resource/ui/general/color.json +++ b/source/resource/ui/general/color.json @@ -9,29 +9,33 @@ "oneOf": [ { "type": "string", - "description": "A variable", - "$ref": "./item_ref.json" + "description": "A color animation.", + "$ref": "./animation_reference.json" + }, + { + "type": "string", + "description": "A color variable.", + "$ref": "./variable.json" + }, + { + "type": "string", + "description": "A predefined color name.", + "enum": [ "black", "white" ] }, { "type": "array", - "description": "A size with width and height.", + "description": "An RGB color definition.", "items": [ { "title": "Red", - "type": "string", - "description": "A variable", "$ref": "#/definitions/color_item" }, { "title": "Green", - "type": "string", - "description": "A variable", "$ref": "#/definitions/color_item" }, { "title": "Blue", - "type": "string", - "description": "A variable", "$ref": "#/definitions/color_item" } ] diff --git a/source/resource/ui/general/item_ref.json b/source/resource/ui/general/item_ref.json index 2a5ffd47..91e1f01b 100644 --- a/source/resource/ui/general/item_ref.json +++ b/source/resource/ui/general/item_ref.json @@ -2,34 +2,23 @@ "$schema": "http://json-schema.org/draft-07/schema", "anyOf": [ { - "title": "Element reference", - "description": "A reference to an element: using the following syntax: [element_name]@[namespace_reference].[element_name_reference]", + "title": "Element Reference", + "description": "A reference to an element using the following syntax: [element_name]@[namespace_reference].[element_name_reference]", "type": "string", "examples": ["button@minecraft", "button@minecraft.ui"], "pattern": "^[a-zA-Z0-9_]*@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?$" }, { - "title": "Element reference", - "description": "A reference to an element: using the following syntax: [namespace_reference].[element_name_reference]", + "title": "Element Reference", + "description": "A reference to an element using the following syntax: [namespace_reference].[element_name_reference]", "type": "string", "examples": ["button@minecraft", "button@minecraft.ui"], - "pattern": "[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?$" + "pattern": "^[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?$" }, { - "title": "Variable reference", + "title": "Variable Reference", "description": "A variable is a reference to a value that can be used in the UI.", - "type": "string", - "anyOf": [ - { - "pattern": "^\\$[a-zA-Z0-9_]+$" - }, - { - "pattern": "^#[a-zA-Z0-9_]+$" - }, - { - "pattern": "^\\(.*\\)$" - } - ] + "$ref": "./variable.json" } ] } diff --git a/source/resource/ui/general/navigation_mode.json b/source/resource/ui/general/navigation_mode.json index f20961e0..97b879cf 100644 --- a/source/resource/ui/general/navigation_mode.json +++ b/source/resource/ui/general/navigation_mode.json @@ -2,5 +2,5 @@ "title": "Navigation Mode", "description": "The navigation mode of the UI.", "type": "string", - "enum": ["contained", "stop"] + "enum": ["contained", "stop", ""] } diff --git a/source/resource/ui/general/size.json b/source/resource/ui/general/size.json index f5b3fe56..cd188caf 100644 --- a/source/resource/ui/general/size.json +++ b/source/resource/ui/general/size.json @@ -1,49 +1,5 @@ { "title": "Size", "description": "The size of the element.", - "definitions": { - "size_coord": { - "title": "Size Coord", - "description": "A size coordinate.", - "oneOf": [ - { - "type": "string", - "enum": ["default", "fill"] - }, - { - "type": "string", - "pattern": "^[0-9]+(px|%)$" - }, - { - "type": "integer", - "minimum": 0 - } - ], - "examples": ["default", "fill", "100px", "100%", "100% - 2px"] - } - }, - "oneOf": [ - { - "type": "string", - "description": "A variable", - "$ref": "./item_ref.json" - }, - { - "type": "array", - "description": "A size with width and height.", - "items": [ - { - "title": "Width", - "description": "A variable", - "$ref": "#/definitions/size_coord" - }, - { - "title": "Height", - "description": "A variable", - "$ref": "#/definitions/size_coord" - } - ] - } - ], - "examples": ["default", "fill", ["100%", "100%"]] -} + "$ref": "./vec2.json" +} \ No newline at end of file diff --git a/source/resource/ui/general/texture_file_path.json b/source/resource/ui/general/texture_file_path.json new file mode 100644 index 00000000..4659a690 --- /dev/null +++ b/source/resource/ui/general/texture_file_path.json @@ -0,0 +1,6 @@ +{ + "title": "Texture File Path", + "type": "string", + "pattern": "^textures\/[a-zA-Z0-9/_.-]+$", + "examples": ["textures/ui/file"] +} \ No newline at end of file diff --git a/source/resource/ui/general/variable.json b/source/resource/ui/general/variable.json index 0cee8246..289c1a15 100644 --- a/source/resource/ui/general/variable.json +++ b/source/resource/ui/general/variable.json @@ -5,7 +5,7 @@ "anyOf": [ { "type": "string", - "pattern": "^\\$[a-zA-Z0-9_]+$" + "pattern": "^\\$[a-zA-Z0-9_-]+$" }, { "type": "string", diff --git a/source/resource/ui/general/vec2.json b/source/resource/ui/general/vec2.json index 6e8cb6c0..39a1fdc2 100644 --- a/source/resource/ui/general/vec2.json +++ b/source/resource/ui/general/vec2.json @@ -4,15 +4,11 @@ "oneOf": [ { "type": "string", - "enum": ["default", "fill"] + "pattern": "^( *[+-]? *([0-9]+(\\.[0-9]+)? ?(px|%([cxy]|cm|sm)?)|default|fill))+$", + "$comment": "Equation with units" }, { - "type": "string", - "pattern": "^[0-9]+(px|%)$" - }, - { - "type": "integer", - "minimum": 0 + "type": "number" } ], "examples": ["default", "fill", "100px", "100%", "100% - 2px"] @@ -30,14 +26,10 @@ "items": [ { "title": "Width", - "type": "string", - "description": "A variable", "$ref": "#/definitions/size_coord" }, { "title": "Height", - "type": "string", - "description": "A variable", "$ref": "#/definitions/size_coord" } ] diff --git a/source/resource/ui/ui.json b/source/resource/ui/ui.json index e3efbd87..7f545e66 100644 --- a/source/resource/ui/ui.json +++ b/source/resource/ui/ui.json @@ -15,7 +15,6 @@ "title": "Animation", "description": "An animation is a set of keyframes that can be applied to an element.", "additionalProperties": false, - "required": ["anim_type"], "patternProperties": { "^\\$.*": { "$ref": "./general/variables.json" @@ -82,15 +81,83 @@ "description": "Modifications to the element.", "type": "array", "items": { + "title": "Modification", "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "title": "Control Modification", + "required": ["control_name", "operation"], + "properties": { + "operation": { + "enum": ["remove", "replace", "swap", "move_back", "move_front", "move_after", "move_before", "insert_before", "insert_after"] + } + }, + "oneOf": [ + { + "properties": { + "control_name": {}, + "operation": { + "enum": ["remove", "move_back", "move_front"] + } + } + }, + { + "required": ["control_name", "operation", "value"], + "properties": { + "control_name": {}, + "operation": { + "enum": ["replace", "swap", "move_after", "move_before", "insert_before", "insert_after"] + }, + "value": { + "anyOf": [ + { + "type": "array", + "description": "A control array.", + "items": { + "title": "Control", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/grouped-ui" + } + } + }, + { + "title": "Control", + "description": "A control.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/grouped-ui" + } + }, + { + "$ref": "./general/item_ref.json" + } + ] + } + } + } + ] + }, + { + "title": "Array Modification", + "required": ["array_name", "operation", "value"], + "properties": { + "operation": { + "enum": ["insert_front", "insert_back"] + } + } + } + ], "properties": { "control_name": { "title": "Control Name", + "description": "The control to apply the operation to.", "type": "string" }, "array_name": { "title": "Array Name", - "type": "string", + "description": "The array to apply the operation to.", "enum": ["bindings", "controls"] }, "operation": { @@ -105,20 +172,30 @@ }, "value": { "oneOf": [ - { "$ref": "./elements/properties/bindings.json" }, { - "title": "Controls", - "description": "The controls to add.", + "$ref": "./elements/properties/bindings.json" + }, + { "anyOf": [ { "type": "array", + "description": "A control array.", "items": { + "title": "Control", + "type": "object", "additionalProperties": { - "title": "Sub Element", "$ref": "#/definitions/grouped-ui" } } }, + { + "title": "Control", + "description": "A control.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/grouped-ui" + } + }, { "$ref": "./general/item_ref.json" } @@ -141,6 +218,7 @@ "anchor_from": { "$ref": "./elements/properties/anchor_from.json" }, "anchor_to": { "$ref": "./elements/properties/anchor_to.json" }, "anims": { "$ref": "./elements/properties/anims.json" }, + "animation_reset_name": { "$ref": "./elements/properties/animation_reset_name.json" }, "background_control": { "$ref": "./elements/properties/background_control.json" }, "background_hover_control": { "$ref": "./elements/properties/background_hover_control.json" }, "backup_font_type": { "$ref": "./elements/properties/backup_font_type.json" }, @@ -148,6 +226,7 @@ "bindings": { "$ref": "./elements/properties/bindings.json" }, "button_mappings": { "$ref": "./elements/properties/button_mappings.json" }, "cache_screen": { "$ref": "./elements/properties/cache_screen.json" }, + "camera_tilt_degrees": { "$ref": "./elements/properties/camera_tilt_degrees.json" }, "checked_control": { "$ref": "./elements/properties/checked_control.json" }, "checked_hover_control": { "$ref": "./elements/properties/checked_hover_control.json" }, "checked_locked_control": { "$ref": "./elements/properties/checked_locked_control.json" }, @@ -159,6 +238,9 @@ "collection_index": { "$ref": "./elements/properties/collection_index.json" }, "collection_name": { "$ref": "./elements/properties/collection_name.json" }, "color": { "$ref": "./elements/properties/color.json" }, + "color1": { "$ref": "./elements/properties/color.json", "description": "The color to start the gradient with." }, + "color2": { "$ref": "./elements/properties/color.json", "description": "The color to end the gradient with." }, + "constrain_to_rect": { "$ref": "./elements/properties/constrain_to_rect.json" }, "consume_hover_events": { "$ref": "./elements/properties/consume_hover_events.json" }, "contained": { "$ref": "./elements/properties/contained.json" }, "control_name": { "$ref": "./elements/properties/control_name.json" }, @@ -183,6 +265,7 @@ "focus_enabled": { "$ref": "./elements/properties/focus_enabled.json" }, "focus_identifier": { "$ref": "./elements/properties/focus_identifier.json" }, "focus_magnet_enabled": { "$ref": "./elements/properties/focus_magnet_enabled.json" }, + "focus_mapping": { "$ref": "./elements/properties/focus_mapping.json" }, "focus_navigation_mode_down": { "$ref": "./elements/properties/focus_navigation_mode_down.json" }, "focus_navigation_mode_left": { "$ref": "./elements/properties/focus_navigation_mode_left.json" }, "focus_navigation_mode_right": { "$ref": "./elements/properties/focus_navigation_mode_right.json" }, @@ -215,6 +298,7 @@ "jump_to_bottom_on_update": { "$ref": "./elements/properties/jump_to_bottom_on_update.json" }, "keep_ratio": { "$ref": "./elements/properties/keep_ratio.json" }, "layer": { "$ref": "./elements/properties/layer.json" }, + "line_padding": { "$ref": "./elements/properties/line_padding.json" }, "localize": { "$ref": "./elements/properties/localize.json" }, "locked_alpha": { "$ref": "./elements/properties/alpha.json" }, "locked_color": { "$ref": "./elements/properties/color.json" }, @@ -233,6 +317,7 @@ "pressed_control": { "$ref": "./elements/properties/pressed_control.json" }, "prevent_touch_input": { "$ref": "./elements/properties/prevent_touch_input.json" }, "primary_color": { "$ref": "./elements/properties/color.json" }, + "priority": { "$ref": "./elements/properties/priority.json" }, "progress_control": { "$ref": "./elements/properties/progress_control.json" }, "progress_hover_control": { "$ref": "./elements/properties/progress_hover_control.json" }, "propagate_alpha": { "$ref": "./elements/properties/propagate_alpha.json" }, @@ -311,6 +396,7 @@ "unchecked_locked_hover_control": { "$ref": "./elements/properties/unchecked_locked_hover_control.json" }, "use_anchored_offset": { "$ref": "./elements/properties/use_anchored_offset.json" }, "use_child_anchors": { "$ref": "./elements/properties/use_child_anchors.json" }, + "use_custom_pocket_toast": { "$ref": "./elements/properties/use_custom_pocket_toast.json" }, "use_last_focus": { "$ref": "./elements/properties/use_last_focus.json" }, "uv_size": { "$ref": "./elements/properties/uv_size.json" }, "uv": { "$ref": "./elements/properties/uv.json" }, @@ -318,6 +404,12 @@ "virtual_keyboard_buffer_control": { "$ref": "./elements/properties/virtual_keyboard_buffer_control.json" }, "visible": { "$ref": "./elements/properties/visible.json" }, "zip_folder": { "$ref": "./elements/properties/zip_folder.json" } + }, + "dependencies": { + "line_padding": { "properties": { "type": { "const": "label" } } }, + "color1": { "properties": { "type": { "const": "custom" }, "renderer": { "const": "gradient_renderer" }, "color2": {} } }, + "color2": { "properties": { "type": { "const": "custom" }, "renderer": { "const": "gradient_renderer" }, "color1": {} } }, + "camera_tilt_degrees": { "properties": { "type": { "const": "custom" }, "renderer": { "const": "paper_doll_renderer" } } } } }, "control_factory": {