پرش به محتویات

اسکیمای Element (Element Schema)

هر المان در Bricks envelope یکسان دارد. کنترل‌های مخصوص هر المان در schema المان‌های جداگانه مستند شده؛ ناحیه‌های محتوا (آرایه‌های تخت) در content area schema.

پوشش المان (Element envelope)

فیلد (Field) نوع (Type) الزامی (Required) توضیح (Description)
id string Yes شناسه alphanumeric ۶ کاراکتری یکتا (مثلاً "dlceeu")
name string Yes نوع المان؛ مطابق نام فایل schema (مثلاً "button", "heading")
parent string | 0 Yes ID والد، یا 0 برای سطح root
children string[] Yes آرایه مرتب ID فرزندان
settings object Yes همه مقادیر کنترل (مخصوص + به‌ارث‌رسیده + meta)
selectors array No selectorهای CSS سفارشی با settings محدود (از Bricks 2.0)
label string No برچسب سفارشی کاربر در سازنده
themeStyles array No overrideهای theme style روی این المان

تنظیمات: سه لایه (Settings: three layers)

شی settings سه لایه کلید دارد:

  1. کنترل‌های مخصوص المان: منحصربه‌فرد هر نوع (مثلاً text, tag, link روی button) — در schema همان المان.
  2. کنترل‌های CSS به‌ارث‌رسیده: مشترک همه المان‌ها با پیشوند _ (مثلاً _typography, _margin) — با suffix breakpoint/pseudo-class (مثلاً _typography:tablet_portrait:hover).
  3. Meta-settings: مشترک همه المان‌ها اما در schema تک‌تک المان‌ها تکرار نمی‌شوند — در ادامه.

متا-تنظیمات (Meta-settings)

این کلیدها در settings هر المان می‌توانند باشند:

_cssGlobalClasses

آرایه ID کلاس‌های سراسری. هر ID به global classes ارجاع می‌دهد.

"_cssGlobalClasses": ["mmdqed", "xkatss"]

_conditions

شرط نمایش المان — آرایه‌ای از آرایه‌ها: بیرونی OR، درونی AND.

"_conditions": [
  [
    { "id": "abc123", "key": "user_logged_in", "compare": "==", "value": true }
  ]
]

Element Conditions — schema کامل conditionItem، ۳۲ کلید شرط و عملگرها.

_interactions

قوانین interaction برای رویدادها (click، scroll، hover و غیره).

"_interactions": [
  {
    "id": "abc123",
    "trigger": "click",
    "action": "startAnimation",
    "target": "self"
  }
]

Element Interactions — schema interactionItem، triggerها و actionها.

_hideElementBuilder

Boolean (پیش‌فرض false). true = مخفی در canvas سازنده، visible در فرانت‌اند.

_hideElementFrontend

Boolean (پیش‌فرض false). true = مخفی در فرانت‌اند، visible در سازنده.

_attributes

attributeهای HTML سفارشی روی root DOM.

"_attributes": [
  { "id": "abc123", "name": "data-aos", "value": "fade-up" }
]

انتخابگرها (Selectors)

آرایه selectors settings را به selector CSS محدود می‌کند (از Bricks 2.0):

"selectors": [
  {
    "id": "nopzhs",
    "selector": "#brxe-opxcoa h3",
    "settings": {
      "_typography": { "color": { "raw": "blue" } }
    },
    "label": "Heading within container"
  }
]
فیلد (Field) نوع (Type) الزامی (Required) توضیح (Description)
id string Yes شناسه یکتا
selector string Yes رشته CSS selector
settings object Yes تنظیمات محدود به selector
label string No برچسب در UI سازنده

اسکیمای selector item

{
  "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"
    },
    "selector": {
      "type": "string",
      "description": "CSS selector string (e.g. \".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."
    },
    "label": {
      "type": "string",
      "description": "Optional display label for this selector in the builder UI"
    }
  },
  "required": [
    "id",
    "selector",
    "settings"
  ],
  "additionalProperties": false
}

ارتباط با schema المان‌های جداگانه

هر schema المان (مثلاً button، heading) کنترل‌های مخصوص و CSS _ را در settings مستند می‌کند. فیلدهای envelope و meta-settings این صفحه برای همه انواع المان یکسان است.

برای ساخت المان کامل:

  1. فیلدهای envelope از این صفحه
  2. کنترل‌های مخصوص از schema المان
  3. کنترل‌های CSS _ از schema المان
  4. meta-settings لازم از این صفحه