{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://iamar.world/schemas/ui_page-0.4.schema.json",
  "title": "iamar world UI page (world API 0.4)",
  "description": "A page a world script hands to ui_page_set: engine-neutral data the browser builds into its own native controls (docs/WORLD_API.md, 'World UI pages'; design in docs/WORLD_UI_PAGES_DRAFT.md). No HTML, no scripts, no URLs. The host also enforces limits a schema cannot state: <= 64 KiB of JSON and <= 512 nodes per page, <= 2000 nodes across a world's 8 pages, nesting <= 32 levels, a list row <= 16 nodes (list rows do not count toward the 512), ids unique within a page; anything else is refused with E_BAD_ARG / E_LIMIT. Text is sanitised like ui_note (control and bidi characters removed). $defs/patch is the body of ui_page_patch.",
  "type": "object",
  "required": [
    "root"
  ],
  "additionalProperties": false,
  "properties": {
    "theme": {
      "$ref": "#/$defs/style",
      "description": "Page-wide style defaults; nodes override them."
    },
    "root": {
      "$ref": "#/$defs/node"
    },
    "window": {
      "$ref": "#/$defs/window"
    }
  },
  "$defs": {
    "color": {
      "type": "string",
      "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
      "description": "#rrggbb or #rrggbbaa"
    },
    "length": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 4096
        },
        {
          "type": "string",
          "pattern": "^(100|[1-9]?[0-9])%$"
        }
      ],
      "description": "Pixels, or a percentage of the parent such as \"50%\"."
    },
    "rich_text": {
      "type": "string",
      "maxLength": 4096
    },
    "style": {
      "type": "object",
      "additionalProperties": false,
      "description": "CSS-like names with plain values. Pages cannot use the browser's own dialog style.",
      "properties": {
        "bg": {
          "type": "string",
          "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "#rrggbb or #rrggbbaa"
        },
        "fg": {
          "type": "string",
          "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "#rrggbb or #rrggbbaa"
        },
        "accent": {
          "type": "string",
          "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "#rrggbb or #rrggbbaa"
        },
        "border": {
          "type": "string",
          "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "#rrggbb or #rrggbbaa"
        },
        "border_width": {
          "type": "number",
          "minimum": 0,
          "maximum": 16
        },
        "radius": {
          "type": "number",
          "minimum": 0,
          "maximum": 64
        },
        "padding": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "margin": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "width": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 4096
            },
            {
              "type": "string",
              "pattern": "^(100|[1-9]?[0-9])%$"
            }
          ],
          "description": "Pixels, or a percentage of the parent such as \"50%\"."
        },
        "height": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 4096
            },
            {
              "type": "string",
              "pattern": "^(100|[1-9]?[0-9])%$"
            }
          ],
          "description": "Pixels, or a percentage of the parent such as \"50%\"."
        },
        "min_width": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 4096
            },
            {
              "type": "string",
              "pattern": "^(100|[1-9]?[0-9])%$"
            }
          ],
          "description": "Pixels, or a percentage of the parent such as \"50%\"."
        },
        "max_width": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 4096
            },
            {
              "type": "string",
              "pattern": "^(100|[1-9]?[0-9])%$"
            }
          ],
          "description": "Pixels, or a percentage of the parent such as \"50%\"."
        },
        "font": {
          "enum": [
            "serif",
            "sans",
            "mono",
            "display",
            "hand"
          ],
          "description": "One of the browser's font families."
        },
        "font_size": {
          "type": "number",
          "minimum": 8,
          "maximum": 64
        },
        "weight": {
          "enum": [
            "regular",
            "bold"
          ]
        },
        "opacity": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "shadow": {
          "enum": [
            "none",
            "soft"
          ]
        }
      }
    },
    "base": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string"
        },
        "id": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "description": "The script's own node id (1-65535), needed for events, patches, ui_value and ui_focus. Unique within the page."
        },
        "style": {
          "$ref": "#/$defs/style"
        },
        "visible": {
          "type": "boolean",
          "default": true
        },
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "tooltip": {
          "type": "string",
          "maxLength": 256,
          "description": "Hover text, shown near the node on hover and on keyboard focus, hidden on leave."
        }
      }
    },
    "children": {
      "type": "array",
      "maxItems": 512,
      "items": {
        "$ref": "#/$defs/node"
      }
    },
    "column": {
      "description": "Stack children vertically.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "column"
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "align": {
          "enum": [
            "start",
            "center",
            "end",
            "stretch"
          ]
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "row": {
      "description": "Stack children horizontally.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "row"
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "align": {
          "enum": [
            "start",
            "center",
            "end",
            "stretch"
          ]
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "grid": {
      "description": "Children in columns, filled row by row.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "columns"
      ],
      "properties": {
        "type": {
          "const": "grid"
        },
        "columns": {
          "type": "integer",
          "minimum": 1,
          "maximum": 16
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "stack": {
      "description": "Children on top of each other (badges, overlays).",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "stack"
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "scroll": {
      "description": "Scrolls its one child; clips it.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "children"
      ],
      "properties": {
        "type": {
          "const": "scroll"
        },
        "direction": {
          "enum": [
            "vertical",
            "horizontal",
            "both"
          ],
          "default": "vertical"
        },
        "max_height": {
          "type": "number",
          "minimum": 16,
          "maximum": 4096
        },
        "children": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1,
          "items": {
            "$ref": "#/$defs/node"
          }
        }
      },
      "unevaluatedProperties": false
    },
    "panel": {
      "description": "A framed box.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "panel"
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "text": {
      "description": "Styled text. Rich subset only: **bold**, *italic*, [color=#hex]...[/color], [size=n]...[/size], line breaks.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "text"
        },
        "text": {
          "$ref": "#/$defs/rich_text"
        }
      },
      "unevaluatedProperties": false
    },
    "heading": {
      "description": "A title.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "heading"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        },
        "level": {
          "type": "integer",
          "minimum": 1,
          "maximum": 6,
          "default": 1
        }
      },
      "unevaluatedProperties": false
    },
    "image": {
      "description": "A picture from the world's package.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "src"
      ],
      "properties": {
        "type": {
          "const": "image"
        },
        "src": {
          "type": "string",
          "maxLength": 208,
          "pattern": "^asset:[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*(/[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*)*\\.(png|jpg|webp)$",
          "description": "An image inside the world's signed package (relative path, no '..'). No URLs."
        },
        "fit": {
          "enum": [
            "contain",
            "cover"
          ],
          "default": "contain"
        },
        "width": {
          "type": "number",
          "minimum": 1,
          "maximum": 2048
        },
        "height": {
          "type": "number",
          "minimum": 1,
          "maximum": 2048
        }
      },
      "unevaluatedProperties": false
    },
    "button": {
      "description": "Clickable; fires on_ui_event kind 1.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "button"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        },
        "icon": {
          "type": "string",
          "maxLength": 208,
          "pattern": "^asset:[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*(/[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*)*\\.(png|jpg|webp)$",
          "description": "An image inside the world's signed package (relative path, no '..'). No URLs."
        }
      },
      "unevaluatedProperties": false
    },
    "link": {
      "description": "Inline clickable text; fires on_ui_event kind 4. No URLs, no network.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "link"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        }
      },
      "unevaluatedProperties": false
    },
    "input": {
      "description": "Single-line text; change (2) and submit (3) events; read with ui_value.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "input"
        },
        "placeholder": {
          "type": "string",
          "maxLength": 256
        },
        "max_length": {
          "type": "integer",
          "minimum": 1,
          "maximum": 256,
          "default": 256
        },
        "value": {
          "type": "string",
          "maxLength": 256
        }
      },
      "unevaluatedProperties": false
    },
    "textarea": {
      "description": "Multi-line text; change events; read with ui_value.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "textarea"
        },
        "placeholder": {
          "type": "string",
          "maxLength": 256
        },
        "max_length": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4096,
          "default": 4096
        },
        "rows": {
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "value": {
          "type": "string",
          "maxLength": 4096
        }
      },
      "unevaluatedProperties": false
    },
    "checkbox": {
      "description": "On/off; ui_value gives \"0\" or \"1\".",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "checkbox"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        },
        "value": {
          "type": "boolean"
        }
      },
      "unevaluatedProperties": false
    },
    "slider": {
      "description": "A number between min and max; ui_value gives it as decimal text.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "slider"
        },
        "value": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "min": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "max": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "step": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "unevaluatedProperties": false
    },
    "select": {
      "description": "Pick one of options; value is the chosen index.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "options"
      ],
      "properties": {
        "type": {
          "const": "select"
        },
        "options": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        },
        "value": {
          "type": "integer",
          "minimum": 0,
          "maximum": 63
        }
      },
      "unevaluatedProperties": false
    },
    "toggle": {
      "description": "Switch on/off; same value as checkbox (ui_value gives \"0\" or \"1\").",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "toggle"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        },
        "value": {
          "type": "boolean"
        }
      },
      "unevaluatedProperties": false
    },
    "number": {
      "description": "Number field with min, max and step; a typed or stepped value is clamped to min..max and snapped to step. ui_value gives it as decimal text.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "number"
        },
        "value": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "min": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "max": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "step": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "unevaluatedProperties": false
    },
    "radio": {
      "description": "Radio group: one of options is chosen; value is the chosen index (default 0); ui_value gives the index.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "options"
      ],
      "properties": {
        "type": {
          "const": "radio"
        },
        "options": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        },
        "value": {
          "type": "integer",
          "minimum": 0,
          "maximum": 63
        }
      },
      "unevaluatedProperties": false
    },
    "progress": {
      "description": "A bar filled to value (0-1).",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "progress"
        },
        "value": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "unevaluatedProperties": false
    },
    "divider": {
      "description": "A thin line.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "divider"
        },
        "size": {
          "type": "number",
          "minimum": 0,
          "maximum": 64
        }
      },
      "unevaluatedProperties": false
    },
    "spacer": {
      "description": "Empty space.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "spacer"
        },
        "size": {
          "type": "number",
          "minimum": 0,
          "maximum": 1024
        }
      },
      "unevaluatedProperties": false
    },
    "disclosure": {
      "description": "A summary line with a triangle that opens and closes its children. Enter, Space and pad A on the summary toggle it; fires a change event; ui_value gives \"0\" or \"1\".",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "summary"
      ],
      "properties": {
        "type": {
          "const": "disclosure"
        },
        "summary": {
          "type": "string",
          "maxLength": 256
        },
        "value": {
          "type": "boolean"
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "accordion": {
      "description": "A group of disclosures; with single_open, opening one closes the others.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "accordion"
        },
        "single_open": {
          "type": "boolean"
        },
        "children": {
          "$ref": "#/$defs/children"
        }
      },
      "unevaluatedProperties": false
    },
    "tabs": {
      "description": "A tab strip over one panel per tab: children[i] is the panel of labels[i] (children past the labels stay hidden). value is the chosen tab; the tabs show and hide the panels, so a panel's own visible is not used. Arrow keys along the strip (Left/Right, or Up/Down when vertical) switch tabs, Tab leaves the strip; choosing a tab fires a change event; ui_value gives the index.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "labels"
      ],
      "properties": {
        "type": {
          "const": "tabs"
        },
        "labels": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "items": {
            "type": "string",
            "maxLength": 64
          }
        },
        "value": {
          "type": "integer",
          "minimum": 0,
          "maximum": 31
        },
        "vertical": {
          "type": "boolean"
        },
        "children": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/node"
          }
        }
      },
      "unevaluatedProperties": false
    },
    "split": {
      "description": "Two regions side by side (or stacked when vertical) with a draggable divider: children[0] and children[1]. value is the share of the first region (0.05-0.95, default 0.5); min_size keeps each region at least that many px. The divider is one keyboard stop: arrows along it (Left/Right, or Up/Down when vertical) move it by 5%. Moving it (drag end or key) fires a change event; ui_value gives the share.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "split"
        },
        "vertical": {
          "type": "boolean"
        },
        "value": {
          "type": "number",
          "minimum": 0.05,
          "maximum": 0.95
        },
        "min_size": {
          "type": "number",
          "minimum": 0,
          "maximum": 2048
        },
        "children": {
          "type": "array",
          "maxItems": 2,
          "items": {
            "$ref": "#/$defs/node"
          }
        }
      },
      "unevaluatedProperties": false
    },
    "table": {
      "description": "A table: a header row (columns), optional fixed column widths in px (0: the column shares the free width) and body rows of text cells. Long tables scroll inside the table instead of growing the page. value is the chosen row's index in body (-1 none); choosing a row (click, Up/Down, pad) fires a change event, ui_value gives the index. sortable: clicking a header sorts by it (again reverses), and on the keyboard Left/Right sort by the previous/next column and Enter/Space/pad A reverse; a sort fires a click event. Numbers sort as numbers, other text without case. Every body row counts as one node of the page (at most 500).",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "columns"
      ],
      "properties": {
        "type": {
          "const": "table"
        },
        "columns": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "items": {
            "type": "string",
            "maxLength": 64
          }
        },
        "widths": {
          "type": "array",
          "maxItems": 16,
          "items": {
            "type": "number",
            "minimum": 0,
            "maximum": 2048
          }
        },
        "body": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          }
        },
        "value": {
          "type": "integer",
          "minimum": -1,
          "maximum": 499
        },
        "sortable": {
          "type": "boolean"
        },
        "sort_column": {
          "type": "integer",
          "minimum": -1,
          "maximum": 15
        },
        "sort_descending": {
          "type": "boolean"
        }
      },
      "unevaluatedProperties": false
    },
    "menu": {
      "description": "A menu (dropdown) button: pressing it (click, Enter, Space, pad A) opens a list of actions. In the open list Up/Down move, Enter chooses, Esc or a click outside closes it; focus then returns to the button. Choosing an action fires a click event; ui_value gives the chosen action's index (-1 before any).",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text",
        "actions"
      ],
      "properties": {
        "type": {
          "const": "menu"
        },
        "text": {
          "type": "string",
          "maxLength": 256
        },
        "actions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        }
      },
      "unevaluatedProperties": false
    },
    "date": {
      "description": "A date picker: year, month and day fields with the weekday beside them. value, min and max are YYYY-MM-DD (min defaults to 1900-01-01, max to 2199-12-31, value to min). Any value is clamped into a real date between min and max (2026-02-31 becomes 2026-02-28; an unreadable value becomes min). Each field is a keyboard stop: Up/Down (or typing) change it, Tab moves to the next. A change fires a change event; ui_value gives the date as YYYY-MM-DD.",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "date"
        },
        "value": {
          "type": "string",
          "maxLength": 10,
          "description": "YYYY-MM-DD"
        },
        "min": {
          "type": "string",
          "maxLength": 10,
          "description": "YYYY-MM-DD"
        },
        "max": {
          "type": "string",
          "maxLength": 10,
          "description": "YYYY-MM-DD"
        }
      },
      "unevaluatedProperties": false
    },
    "time": {
      "description": "A time picker: hour (0-23) and minute fields, plus a seconds field when seconds is true. value is HH:MM or HH:MM:SS (default 00:00); each field is clamped into range, an unreadable value becomes 00:00. A change fires a change event; ui_value gives HH:MM (HH:MM:SS with seconds).",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "time"
        },
        "value": {
          "type": "string",
          "maxLength": 8,
          "description": "HH:MM or HH:MM:SS"
        },
        "seconds": {
          "type": "boolean",
          "default": false
        }
      },
      "unevaluatedProperties": false
    },
    "color_picker": {
      "description": "A colour picker: a swatch and red, green and blue fields (0-255), plus alpha when alpha is true. value is #rrggbb or #rrggbbaa (default #ffffff); alpha off drops the alpha. A change fires a change event; ui_value gives #rrggbb (#rrggbbaa with alpha).",
      "$ref": "#/$defs/base",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "color_picker"
        },
        "value": {
          "type": "string",
          "pattern": "^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
          "description": "#rrggbb or #rrggbbaa"
        },
        "alpha": {
          "type": "boolean",
          "default": false
        }
      },
      "unevaluatedProperties": false
    },
    "tree": {
      "description": "A tree view: nested rows that open and close, like a file tree. rows is an outline: each row has text, depth (0 for a top row, at most one level below the row before it) and open (its children shown). value is the chosen row's index, -1 for none. Choosing a row (click, Up/Down, pad) fires a change event; ui_value gives the index. Right/Left open/close a row or go to its first child / parent; Enter, Space and pad A open or close it. Every row counts as one node of the page (at most 256 rows).",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "rows"
      ],
      "properties": {
        "type": {
          "const": "tree"
        },
        "rows": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "items": {
            "type": "object",
            "required": [
              "text"
            ],
            "properties": {
              "text": {
                "type": "string",
                "maxLength": 128
              },
              "depth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 15
              },
              "open": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "value": {
          "type": "integer",
          "minimum": -1,
          "maximum": 255
        }
      },
      "unevaluatedProperties": false
    },
    "list": {
      "description": "Many similar rows, virtualised: rows outside the view are not built.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "items"
      ],
      "properties": {
        "type": {
          "const": "list"
        },
        "items": {
          "type": "array",
          "maxItems": 1000,
          "items": {
            "$ref": "#/$defs/node"
          }
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "max_height": {
          "type": "number",
          "minimum": 16,
          "maximum": 4096
        }
      },
      "unevaluatedProperties": false
    },
    "node": {
      "description": "One page node. 'type' picks the kind; every kind takes id, style, visible and enabled.",
      "oneOf": [
        {
          "$ref": "#/$defs/column"
        },
        {
          "$ref": "#/$defs/row"
        },
        {
          "$ref": "#/$defs/grid"
        },
        {
          "$ref": "#/$defs/stack"
        },
        {
          "$ref": "#/$defs/scroll"
        },
        {
          "$ref": "#/$defs/panel"
        },
        {
          "$ref": "#/$defs/text"
        },
        {
          "$ref": "#/$defs/heading"
        },
        {
          "$ref": "#/$defs/image"
        },
        {
          "$ref": "#/$defs/button"
        },
        {
          "$ref": "#/$defs/link"
        },
        {
          "$ref": "#/$defs/input"
        },
        {
          "$ref": "#/$defs/textarea"
        },
        {
          "$ref": "#/$defs/checkbox"
        },
        {
          "$ref": "#/$defs/slider"
        },
        {
          "$ref": "#/$defs/select"
        },
        {
          "$ref": "#/$defs/toggle"
        },
        {
          "$ref": "#/$defs/number"
        },
        {
          "$ref": "#/$defs/radio"
        },
        {
          "$ref": "#/$defs/progress"
        },
        {
          "$ref": "#/$defs/divider"
        },
        {
          "$ref": "#/$defs/spacer"
        },
        {
          "$ref": "#/$defs/disclosure"
        },
        {
          "$ref": "#/$defs/accordion"
        },
        {
          "$ref": "#/$defs/code"
        },
        {
          "$ref": "#/$defs/quote"
        },
        {
          "$ref": "#/$defs/callout"
        },
        {
          "$ref": "#/$defs/badge"
        },
        {
          "$ref": "#/$defs/chip"
        },
        {
          "$ref": "#/$defs/icon"
        },
        {
          "$ref": "#/$defs/textlist"
        },
        {
          "$ref": "#/$defs/breadcrumb"
        },
        {
          "$ref": "#/$defs/pagination"
        },
        {
          "$ref": "#/$defs/tabs"
        },
        {
          "$ref": "#/$defs/split"
        },
        {
          "$ref": "#/$defs/table"
        },
        {
          "$ref": "#/$defs/menu"
        },
        {
          "$ref": "#/$defs/date"
        },
        {
          "$ref": "#/$defs/time"
        },
        {
          "$ref": "#/$defs/color_picker"
        },
        {
          "$ref": "#/$defs/tree"
        },
        {
          "$ref": "#/$defs/list"
        }
      ]
    },
    "patch": {
      "description": "The body of ui_page_patch(page, node, json): the properties of one node to change (<= 8 KiB). A node's type and id never change; a property the node's kind does not have is refused (E_BAD_ARG). 'children' / 'items' replace the whole child list.",
      "type": "object",
      "minProperties": 1,
      "additionalProperties": false,
      "properties": {
        "text": {
          "$ref": "#/$defs/rich_text"
        },
        "style": {
          "$ref": "#/$defs/style"
        },
        "visible": {
          "type": "boolean"
        },
        "enabled": {
          "type": "boolean"
        },
        "tooltip": {
          "type": "string",
          "maxLength": 256
        },
        "children": {
          "$ref": "#/$defs/children"
        },
        "items": {
          "type": "array",
          "maxItems": 1000,
          "items": {
            "$ref": "#/$defs/node"
          }
        },
        "value": {
          "type": [
            "string",
            "number",
            "boolean"
          ]
        },
        "placeholder": {
          "type": "string",
          "maxLength": 256
        },
        "options": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        },
        "min": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "max": {
          "type": "number",
          "minimum": -1000000000.0,
          "maximum": 1000000000.0
        },
        "step": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "src": {
          "type": "string",
          "maxLength": 208,
          "pattern": "^asset:[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*(/[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*)*\\.(png|jpg|webp)$",
          "description": "An image inside the world's signed package (relative path, no '..'). No URLs."
        },
        "icon": {
          "type": "string",
          "maxLength": 208,
          "pattern": "^asset:[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*(/[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*)*\\.(png|jpg|webp)$",
          "description": "An image inside the world's signed package (relative path, no '..'). No URLs."
        },
        "level": {
          "type": "integer",
          "minimum": 1,
          "maximum": 6
        },
        "gap": {
          "type": "number",
          "minimum": 0,
          "maximum": 256
        },
        "align": {
          "enum": [
            "start",
            "center",
            "end",
            "stretch"
          ]
        },
        "columns": {
          "type": "integer",
          "minimum": 1,
          "maximum": 16
        },
        "labels": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "items": {
            "type": "string",
            "maxLength": 64
          }
        },
        "rows": {
          "$ref": "#/$defs/tree/properties/rows"
        },
        "actions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        },
        "body": {
          "type": "array",
          "maxItems": 500,
          "items": {
            "type": "array",
            "maxItems": 16,
            "items": {
              "type": "string",
              "maxLength": 256
            }
          }
        }
      }
    },
    "textlist": {
      "description": "An unordered, ordered or definition list of short rich-text lines. For definition, details[i] explains entries[i].",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "entries"
      ],
      "properties": {
        "type": {
          "const": "textlist"
        },
        "variant": {
          "enum": [
            "unordered",
            "ordered",
            "definition"
          ]
        },
        "entries": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "string",
            "maxLength": 256
          }
        },
        "details": {
          "type": "array",
          "maxItems": 64,
          "items": {
            "type": "string",
            "maxLength": 512
          }
        }
      },
      "unevaluatedProperties": false
    },
    "code": {
      "description": "Monospace block for code or logs. With copy, a Copy button fires a click event on the node; the host (not the page) decides about the clipboard.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "code"
        },
        "text": {
          "type": "string",
          "maxLength": 4096
        },
        "copy": {
          "type": "boolean"
        }
      },
      "unevaluatedProperties": false
    },
    "quote": {
      "description": "A blockquote: rich text with an accent bar.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "quote"
        },
        "text": {
          "$ref": "#/$defs/rich_text"
        }
      },
      "unevaluatedProperties": false
    },
    "callout": {
      "description": "A note, warning or success box with rich text.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "callout"
        },
        "text": {
          "$ref": "#/$defs/rich_text"
        },
        "variant": {
          "enum": [
            "note",
            "warning",
            "success"
          ]
        }
      },
      "unevaluatedProperties": false
    },
    "breadcrumb": {
      "description": "A trail of places; every item but the last is clickable (click event).",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "crumbs"
      ],
      "properties": {
        "type": {
          "const": "breadcrumb"
        },
        "crumbs": {
          "type": "array",
          "maxItems": 16,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        }
      },
      "unevaluatedProperties": false
    },
    "pagination": {
      "description": "Previous / next page controls; a change event fires when the page moves. value is the 1-based page.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "pages"
      ],
      "properties": {
        "type": {
          "const": "pagination"
        },
        "pages": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        },
        "value": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000
        }
      },
      "unevaluatedProperties": false
    },
    "badge": {
      "description": "A small label pill.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "badge"
        },
        "text": {
          "type": "string",
          "maxLength": 64
        },
        "variant": {
          "enum": [
            "neutral",
            "info",
            "success",
            "warning",
            "danger"
          ]
        }
      },
      "unevaluatedProperties": false
    },
    "chip": {
      "description": "A clickable tag; fires a click event.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "text"
      ],
      "properties": {
        "type": {
          "const": "chip"
        },
        "text": {
          "type": "string",
          "maxLength": 64
        },
        "variant": {
          "enum": [
            "neutral",
            "info",
            "success",
            "warning",
            "danger"
          ]
        }
      },
      "unevaluatedProperties": false
    },
    "icon": {
      "description": "A glyph from the fixed built-in set; never an external image.",
      "$ref": "#/$defs/base",
      "required": [
        "type",
        "name"
      ],
      "properties": {
        "type": {
          "const": "icon"
        },
        "name": {
          "enum": [
            "info",
            "warning",
            "check",
            "cross",
            "star",
            "heart",
            "arrow_up",
            "arrow_down",
            "arrow_left",
            "arrow_right",
            "plus",
            "minus",
            "search",
            "gear",
            "lock",
            "bell"
          ]
        },
        "size": {
          "type": "number",
          "minimum": 8,
          "maximum": 128
        }
      },
      "unevaluatedProperties": false
    },
    "window": {
      "description": "How the page looks as a window (ui_page_show mode 4): the browser draws the chrome (a title bar in the world's colour with this title and the world's address, a close button, a drag bar and a resize grip); the world cannot style it. x, y (from the safe area's top left), w and h are UI units and apply when the window opens; while it stays open a replacing ui_page_set keeps where the player put it and takes only the new title and flags. Without x/y windows cascade; without w/h a window is 360 x 300. A window is held to 60% x 84% of the safe area, at least 120 x 80 (or min_w x min_h), and always stays on the screen; at most 4 are shown at once. The title bar is a keyboard stop: arrows move the window 16 units, Shift+arrows resize it; Esc inside a closable window closes it. on_ui_event(page, 0, kind): 7 opened, 5 closed by the player, 8 moved or resized by the player; ui_value(page, 0) is \"x,y,w,h\".",
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "maxLength": 64
        },
        "x": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8192
        },
        "y": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8192
        },
        "w": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8192
        },
        "h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 8192
        },
        "min_w": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4096
        },
        "min_h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4096
        },
        "resizable": {
          "type": "boolean",
          "description": "The player may resize it (default true)."
        },
        "closable": {
          "type": "boolean",
          "description": "It has a close button and Esc closes it (default true)."
        }
      },
      "additionalProperties": false,
      "examples": [
        {
          "title": "Map of the vale",
          "x": 40,
          "y": 60,
          "w": 420,
          "h": 320,
          "min_w": 200,
          "min_h": 120,
          "resizable": true,
          "closable": true
        }
      ]
    }
  }
}
