Operazioni sui layout
2 operazioni di nome layout.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| layout.read | Read the site's layout frames as its draft resolves them: with layoutId (the frame a page names in frame, such as default or scale-canvas) that frame, without it every frame of the theme. | site.read | none |
| layout.update | Replace this site's version of one of the theme's layout frames (layoutId, the frame a page names in frame, such as default or scale-canvas) with layout, the whole frame object (its id is layoutId; read it first with layout.read, which answers it as the site resolves it now). | site.structure | none |
layout.read
Read the site's layout frames as its draft resolves them: with layoutId (the frame a page names in frame, such as default or scale-canvas) that frame, without it every frame of the theme. Each comes as { layoutId, source, layout }: layout is the whole frame object layout.update takes (its frame with responsiveMode, designWidth and scaleFromWidth, and the header, footer, background, scroll, chrome and overridePolicy layers), source is site when the site already replaced it with layout.update and theme when it is the theme's. Change the frame you read and send it whole to layout.update. A page may still override some layers for itself in meta.layoutOverrides; an unknown layoutId is layout_not_found (404).
Esempio di input
{
"layoutId": "default"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| layoutId | string | no | At least 1 character. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| layouts | array of object | yes | |
| layouts[].layoutId | string | yes | |
| layouts[].source | string | yes | One of "theme", "site". |
| layouts[].layout | object | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash layout.read '{"layoutId":"default"}' --dry-runlayout.update
Replace this site's version of one of the theme's layout frames (layoutId, the frame a page names in frame, such as default or scale-canvas) with layout, the whole frame object (its id is layoutId; read it first with layout.read, which answers it as the site resolves it now). frame.responsiveMode decides how its pages fit the window: breakpoint reflows them at the site breakpoints, with fluid tokens growing with the window; scale lays them out at designWidth and scales the whole canvas to the window from scaleFromWidth (769 px by default) up, reflowing below it. The other layers are header, footer, background, scroll, chrome and overridePolicy (which meta.layoutOverrides layers a page may apply). Answers the frame as the site now resolves it, with warnings.
Esempio di input
{
"layoutId": "default",
"layout": {
"id": "default",
"label": {
"en-US": "Default"
}
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| layoutId | string | yes | At least 1 character. |
| layout | object | yes | |
| layout.id | string | yes | At least 1 character. |
| layout.label | record of string | yes | |
| layout.chrome | object | no | |
| layout.frame | object | no | |
| layout.canvasPreset | value | no | |
| layout.header | object | no | |
| layout.footer | object | no | |
| layout.background | object | no | |
| layout.scroll | object | no | |
| layout.overridePolicy | object | no |
{
"type": "object",
"properties": {
"layoutId": {
"type": "string",
"minLength": 1
},
"layout": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"label": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"chrome": {
"type": "object",
"properties": {
"elements": {
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
}
},
"frame": {
"type": "object",
"properties": {
"responsiveMode": {
"type": "string",
"enum": [
"breakpoint",
"scale"
]
},
"scaleOrigin": {
"type": "string",
"enum": [
"top-left",
"top-center"
]
},
"containerMode": {
"type": "string",
"enum": [
"measure",
"content",
"wide",
"full-bleed"
]
},
"sectionSpacingDefault": {
"type": "string",
"enum": [
"none",
"sm",
"md",
"lg",
"xl"
]
},
"designWidth": {
"type": "number",
"exclusiveMinimum": 0
},
"maxWidth": {
"type": "string"
},
"insetX": {
"type": "string"
},
"minHeight": {
"type": "string"
},
"overflowX": {
"type": "string",
"enum": [
"visible",
"hidden",
"clip"
]
},
"minScale": {
"type": "number"
},
"maxScale": {
"type": "number"
},
"scaleFromWidth": {
"type": "integer",
"minimum": 0,
"maximum": 10000
},
"scaleRegions": {
"type": "boolean"
}
}
},
"canvasPreset": {},
"header": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"variant": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]*$"
},
"palette": {
"type": "object",
"properties": {
"bgColor": {
"type": "string"
},
"textColor": {
"type": "string"
},
"navLinkColor": {
"type": "string"
},
"navLinkHoverColor": {
"type": "string"
},
"accentBarColor": {
"type": "string"
},
"scrollFade": {
"type": "boolean"
}
}
}
}
},
"footer": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"position": {
"type": "string",
"enum": [
"normal",
"sticky-bottom"
]
},
"palette": {
"type": "object",
"properties": {
"bgColor": {
"type": "string"
},
"textColor": {
"type": "string"
},
"linkColor": {
"type": "string"
}
}
}
}
},
"background": {
"type": "object",
"properties": {
"color": {
"type": "string"
},
"image": {
"type": "object",
"properties": {
"src": {
"type": "string"
},
"repeat": {
"type": "string",
"enum": [
"none",
"repeat",
"repeat-x",
"repeat-y"
]
},
"size": {
"type": "string"
},
"position": {
"type": "string"
},
"attachment": {
"type": "string",
"enum": [
"scroll",
"fixed"
]
},
"opacity": {
"type": "number"
}
}
},
"overlay": {
"type": "object",
"properties": {
"color": {
"type": "string"
},
"opacity": {
"type": "number"
},
"blendMode": {
"type": "string"
}
}
},
"texture": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"noise",
"grain"
]
},
"opacity": {
"type": "number"
}
}
}
}
},
"scroll": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"normal",
"snap-y",
"magnet"
]
},
"magnet": {
"type": "object",
"properties": {
"idleMs": {
"type": "integer",
"minimum": 0,
"maximum": 5000
},
"coarseIdleMs": {
"type": "integer",
"minimum": 0,
"maximum": 5000
},
"windowVh": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"minPx": {
"type": "number",
"minimum": 0,
"maximum": 500
},
"exclude": {
"type": "string",
"enum": [
"first",
"none"
]
},
"includeFooter": {
"type": "boolean"
}
}
},
"snapType": {
"type": "string",
"enum": [
"mandatory",
"proximity"
]
},
"snapAlign": {
"type": "string",
"enum": [
"start",
"center"
]
},
"smoothScroll": {
"type": "boolean"
}
}
},
"overridePolicy": {
"type": "object",
"properties": {
"allowPageHeaderOverride": {
"type": "boolean"
},
"allowPageFooterOverride": {
"type": "boolean"
},
"allowPageBackgroundOverride": {
"type": "boolean"
},
"allowPageChromeOverride": {
"type": "boolean"
},
"allowPageChromeAdditions": {
"type": "boolean"
},
"allowPageScrollOverride": {
"type": "boolean"
}
}
}
},
"required": [
"id",
"label"
]
}
},
"required": [
"layoutId",
"layout"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema1"
},
"type": {
"$ref": "#/$defs/__schema2"
},
"enabled": {
"$ref": "#/$defs/__schema3"
},
"position": {
"$ref": "#/$defs/__schema4"
},
"coordSpace": {
"$ref": "#/$defs/__schema5"
},
"anchor": {
"$ref": "#/$defs/__schema6"
},
"offsetX": {
"$ref": "#/$defs/__schema7"
},
"offsetY": {
"$ref": "#/$defs/__schema8"
},
"zIndex": {
"$ref": "#/$defs/__schema9"
},
"opacity": {
"$ref": "#/$defs/__schema10"
},
"blendMode": {
"$ref": "#/$defs/__schema11"
},
"pointerEvents": {
"$ref": "#/$defs/__schema12"
},
"hideBelow": {
"$ref": "#/$defs/__schema13"
},
"layer": {
"$ref": "#/$defs/__schema14"
},
"positionMode": {
"$ref": "#/$defs/__schema15"
},
"orientation": {
"$ref": "#/$defs/__schema16"
},
"color": {
"$ref": "#/$defs/__schema17"
},
"thickness": {
"$ref": "#/$defs/__schema18"
},
"length": {
"$ref": "#/$defs/__schema19"
},
"shape": {
"$ref": "#/$defs/__schema20"
},
"width": {
"$ref": "#/$defs/__schema21"
},
"height": {
"$ref": "#/$defs/__schema22"
},
"radius": {
"$ref": "#/$defs/__schema23"
},
"rotation": {
"$ref": "#/$defs/__schema24"
},
"src": {
"$ref": "#/$defs/__schema25"
},
"alt": {
"$ref": "#/$defs/__schema26"
},
"objectFit": {
"$ref": "#/$defs/__schema27"
},
"text": {
"$ref": "#/$defs/__schema28"
},
"indicator": {
"$ref": "#/$defs/__schema29"
},
"trackColor": {
"$ref": "#/$defs/__schema30"
},
"edge": {
"$ref": "#/$defs/__schema31"
},
"size": {
"$ref": "#/$defs/__schema32"
},
"showLabel": {
"$ref": "#/$defs/__schema33"
}
},
"required": [
"id",
"type",
"enabled",
"position"
]
},
"__schema1": {
"type": "string",
"minLength": 1
},
"__schema2": {
"type": "string",
"enum": [
"line",
"shape",
"image",
"text",
"progress"
]
},
"__schema3": {
"type": "boolean"
},
"__schema4": {
"type": "string",
"enum": [
"fixed",
"absolute"
]
},
"__schema5": {
"type": "string",
"enum": [
"viewport",
"design"
]
},
"__schema6": {
"type": "string",
"enum": [
"top-left",
"top-right",
"bottom-left",
"bottom-right",
"center"
]
},
"__schema7": {
"type": "string"
},
"__schema8": {
"type": "string"
},
"__schema9": {
"type": "number"
},
"__schema10": {
"type": "number"
},
"__schema11": {
"type": "string"
},
"__schema12": {
"type": "string",
"enum": [
"none",
"auto"
]
},
"__schema13": {
"anyOf": [
{
"type": "string",
"enum": [
"sm",
"md",
"lg"
]
},
{
"type": "null"
}
]
},
"__schema14": {
"type": "string",
"enum": [
"background",
"foreground"
]
},
"__schema15": {
"type": "string",
"enum": [
"viewport-fixed",
"flow"
]
},
"__schema16": {
"type": "string",
"enum": [
"vertical",
"horizontal"
]
},
"__schema17": {
"type": "string"
},
"__schema18": {
"type": "string"
},
"__schema19": {
"type": "string"
},
"__schema20": {
"type": "string",
"enum": [
"rectangle",
"circle",
"pill"
]
},
"__schema21": {
"type": "string"
},
"__schema22": {
"type": "string"
},
"__schema23": {
"type": "string"
},
"__schema24": {
"type": "string"
},
"__schema25": {
"type": "string"
},
"__schema26": {
"type": "string"
},
"__schema27": {
"type": "string",
"enum": [
"contain",
"cover"
]
},
"__schema28": {
"type": "string"
},
"__schema29": {
"type": "string",
"enum": [
"bar",
"ring"
]
},
"__schema30": {
"type": "string"
},
"__schema31": {
"type": "string",
"enum": [
"top",
"bottom"
]
},
"__schema32": {
"type": "string"
},
"__schema33": {
"type": "boolean"
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| ok | true | yes | |
| layout | object | yes | |
| layout.id | string | yes | At least 1 character. |
| layout.label | record of string | yes | |
| layout.chrome | object | no | |
| layout.frame | object | no | |
| layout.canvasPreset | value | no | |
| layout.header | object | no | |
| layout.footer | object | no | |
| layout.background | object | no | |
| layout.scroll | object | no | |
| layout.overridePolicy | object | no | |
| warnings | array of string | yes |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash layout.update '{"layoutId":"default","layout":{"id":"default","label":{"en-US":"Default"}}}' --dry-runGenerato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente a6927afe2c466b2f).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.