Bricks Schema 中文文档:Bricks 全局类

标签TAGS: 

📄 原始资料  |  展开查看原始 JSON(global-classes.json){ “$schema”: “https://json-schema.org/draft/2020-12/schema”, “$id”: “bricks://global/global-classes”, “schemaVersion”: “2.3”, “title”: “Bricks Global Classes”, “type”: “array”, “items”: { “type”: “object”, “properties”: { “id”: { “type”: “string” …

📄 原始资料  |  展开查看原始 JSON(global-classes.json)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "bricks://global/global-classes",
  "schemaVersion": "2.3",
  "title": "Bricks Global Classes",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "category": {
        "type": "string"
      },
      "settings": {
        "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys."
      },
      "selectors": {
        "type": "array",
        "description": "Custom CSS selectors with scoped settings (since Bricks 2.0)",
        "items": {
          "type": "object",
          "description": "Custom CSS selector on an element or global class (since Bricks 2.0). Allows scoping control settings to arbitrary CSS selectors.",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for this selector entry",
              "descriptionZh": "此选择器条目的唯一标识符。"
            },
            "selector": {
              "type": "string",
              "description": "CSS selector string (e.g. \".my-class\", \"&::before\", \"& > span\")",
              "descriptionZh": "CSS 选择器字符串(例如 \".my-class\"、\"&::before\"、\"& > span\")。"
            },
            "settings": {
              "description": "Control settings scoped to this selector (same shape as element settings)",
              "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys.",
              "descriptionZh": "作用域限定到此选择器的控件设置(结构与元素设置相同)。"
            },
            "label": {
              "type": "string",
              "description": "Optional display label for this selector in the builder UI",
              "descriptionZh": "此选择器在构建器 UI 中的可选显示标签。"
            }
          },
          "required": [
            "id",
            "selector",
            "settings"
          ],
          "additionalProperties": false,
          "descriptionZh": "元素或全局类上的自定义 CSS 选择器(Bricks 2.0 起)。允许将控件设置作用域限定到任意 CSS 选择器。"
        },
        "descriptionZh": "带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。"
      },
      "modified": {
        "type": [
          "integer",
          "string"
        ]
      },
      "user_id": {
        "type": [
          "integer",
          "string"
        ]
      },
      "deletedAt": {
        "type": [
          "integer",
          "string"
        ]
      }
    },
    "required": [
      "id",
      "name"
    ],
    "additionalProperties": false
  },
  "titleZh": "Bricks 全局类"
}

基本信息

  • 英文名称Bricks Global Classes
  • 中文名称:Bricks 全局类
  • Schema IDbricks://global/global-classes
  • Schema 版本2.3
  • 类型array

条目属性

  • id (string)
  • name (string)
  • category (string)
  • settings
  • selectors (array):带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。
  • modified (["integer", "string"])
  • user_id (["integer", "string"])
  • deletedAt (["integer", "string"])

Schema 定义

完整 JSON 定义

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "bricks://global/global-classes",
  "schemaVersion": "2.3",
  "title": "Bricks Global Classes",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "category": {
        "type": "string"
      },
      "settings": {
        "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys."
      },
      "selectors": {
        "type": "array",
        "description": "Custom CSS selectors with scoped settings (since Bricks 2.0)",
        "items": {
          "type": "object",
          "description": "Custom CSS selector on an element or global class (since Bricks 2.0). Allows scoping control settings to arbitrary CSS selectors.",
          "properties": {
            "id": {
              "type": "string",
              "description": "Unique identifier for this selector entry",
              "descriptionZh": "此选择器条目的唯一标识符。"
            },
            "selector": {
              "type": "string",
              "description": "CSS selector string (e.g. \".my-class\", \"&::before\", \"& > span\")",
              "descriptionZh": "CSS 选择器字符串(例如 \".my-class\"、\"&::before\"、\"& > span\")。"
            },
            "settings": {
              "description": "Control settings scoped to this selector (same shape as element settings)",
              "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys.",
              "descriptionZh": "作用域限定到此选择器的控件设置(结构与元素设置相同)。"
            },
            "label": {
              "type": "string",
              "description": "Optional display label for this selector in the builder UI",
              "descriptionZh": "此选择器在构建器 UI 中的可选显示标签。"
            }
          },
          "required": [
            "id",
            "selector",
            "settings"
          ],
          "additionalProperties": false,
          "descriptionZh": "元素或全局类上的自定义 CSS 选择器(Bricks 2.0 起)。允许将控件设置作用域限定到任意 CSS 选择器。"
        },
        "descriptionZh": "带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。"
      },
      "modified": {
        "type": [
          "integer",
          "string"
        ]
      },
      "user_id": {
        "type": [
          "integer",
          "string"
        ]
      },
      "deletedAt": {
        "type": [
          "integer",
          "string"
        ]
      }
    },
    "required": [
      "id",
      "name"
    ],
    "additionalProperties": false
  },
  "titleZh": "Bricks 全局类"
}

补充说明

更多细节可参考 Bricks 官方 Academy 文档