Operazioni sull’albero della pagina

3 operazioni di nome tree.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.

Aggiornato il
OperationWhat it doesPermissionConfirmation
tree.readRead a draft page tree and its revision.site.readnone
tree.commitApply an invertible batch of splash.ops/2 ops to a page tree.content.editnone
tree.nodeRead one node of a page's draft tree with its props, styles, meta, variant and theme, and its children down to depth levels (1 by default, 0 for the node alone), without reading the whole tree.site.readnone

tree.read

Read a draft page tree and its revision.

permission: site.readreads onlyclass: read

Esempio di input

{
  "pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"
}

Input

FieldTypeRequiredNotes
pageIdstringyesAt least 1 character.

Output

FieldTypeRequiredNotes
format"splash.tree"yes
v3yes
revisionintegeryesAt least 0.
rootobject | object | object | object | object | object | objectyes

Provala

yarn splash tree.read '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"}' --dry-run

tree.commit

Apply an invertible batch of splash.ops/2 ops to a page tree. Each op names its node by id (insert names parentId and index): insert { parentId, index, node }, remove { id }, move { id, parentId, index }, set_props { id, patch } (a patch of props; null removes one), set_style { id, scope, patch }, set_meta { id, anchor?, name?, meta?, visibleTo?, locked? }, set_attrs { id, patch }, set_variant { id, variant }, set_theme { id, theme }, set_mixins { id, mixins }, set_visibility { id, visibility }, set_type { id, type }, set_override { id, target, patch }; only insert carries a whole node with its props. A node's section anchor is the node field anchor, not a prop or meta key. In a set_style patch and in the styles.sheet of an inserted node, each declaration value may be a raw CSS string ("clamp(22px, 2.3vw, 34px)", "{color.text}" for a token) or { kind: "raw", css }; the server tokenizes it with the inspector's parser and refuses a value the style catalogue does not allow, at its path. A scope is a scope key, base or segments joined by | in this order: bp:<breakpoint> (a site breakpoint, mobile-first: bp:md from 768 px up), cq:(max-width:767px) or cq:<name>(min-width:480px) (a container condition, the way to style a desktop-first range; a named container is an ancestor whose base container-name names it), mq:(prefers-reduced-motion:reduce) (one media condition: reduced motion, colour scheme, contrast, forced colours, hover, pointer, orientation or print), v:<variant>, th:<theme>, a:<type>[data-state="<state>"] (the nearest ancestor of that type in a state its entry declares, such as a:sticky-bar[data-state="scrolled"]), p:<part> (a part of the node's component), s:<state> (pseudo-classes, at most one pseudo-element and attribute selectors on the node: s::hover, s::focus-visible, s::has(> img), s:[data-state="open"]) and t:<selector> (a descendant, t: img, or a child, t:> .icon, that the value applies to). So bp:md|s::hover|t: img styles the node's images while the node is hovered, from 768 px up. bp: and cq: compile to container queries on the page's content box (or on the nearest node that sets container-type): where a page's frame scales (responsiveMode: "scale", from its scaleFromWidth, 769 px by default), that box keeps the frame's design width, so they resolve at the design width there. A hover state applies only on a device that hovers. The class is content.edit, but only a content-prop edit (a set_props of a content field) needs no more: every other op of the batch needs site.edit.

permission: content.editwrites: tree:{pageId}class: transactionundo: yes

Esempio di input

{
  "pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
  "ops": [
    {
      "op": "insert",
      "parentId": "root0000",
      "index": 0,
      "node": {
        "id": "hero0001",
        "kind": "section",
        "type": "section",
        "anchor": "hero",
        "name": "Opening section",
        "styles": {
          "sheet": {
            "base": {
              "position": "sticky",
              "top": "0",
              "min-height": "100svh",
              "max-width": "none",
              "padding-inline": "0"
            }
          }
        },
        "children": [
          {
            "id": "claim001",
            "kind": "primitive",
            "type": "text",
            "props": {
              "text": {
                "en-US": "Architecture for the places we live in"
              }
            },
            "styles": {
              "sheet": {
                "base": {
                  "font-size": "clamp(22px, 2.3vw, 34px)",
                  "color": {
                    "kind": "raw",
                    "css": "{color.text.accent}"
                  }
                }
              }
            }
          }
        ]
      }
    },
    {
      "op": "set_props",
      "id": "claim001",
      "patch": {
        "text": {
          "en-US": "Architecture for the places we live and work in"
        }
      }
    },
    {
      "op": "set_style",
      "id": "claim001",
      "scope": "bp:md",
      "patch": {
        "margin-inline-start": "50%"
      }
    },
    {
      "op": "set_meta",
      "id": "hero0001",
      "anchor": "opening",
      "name": "Opening"
    },
    {
      "op": "set_attrs",
      "id": "claim001",
      "patch": {
        "data-tone": "quiet"
      }
    },
    {
      "op": "set_variant",
      "id": "button01",
      "variant": [
        "ghost"
      ]
    },
    {
      "op": "move",
      "id": "intro001",
      "parentId": "hero0001",
      "index": 1
    },
    {
      "op": "remove",
      "id": "old00001"
    }
  ]
}

Input

FieldTypeRequiredNotes
pageIdstringyesAt least 1 character.
opsarray of object | object | object | object | object | object | object | object | object | object | object | object | objectyesAt least 1 item.

Output

FieldTypeRequiredNotes
revisionintegeryesAt least 0.
inversearray of object | object | object | object | object | object | object | object | object | object | object | object | objectyes

Provala

yarn splash tree.commit '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","ops":[{"op":"insert","parentId":"root0000","index":0,"node":{"id":"hero0001","kind":"section","type":"section","anchor":"hero","name":"Opening section","styles":{"sheet":{"base":{"position":"sticky","top":"0","min-height":"100svh","max-width":"none","padding-inline":"0"}}},"children":[{"id":"claim001","kind":"primitive","type":"text","props":{"text":{"en-US":"Architecture for the places we live in"}},"styles":{"sheet":{"base":{"font-size":"clamp(22px, 2.3vw, 34px)","color":{"kind":"raw","css":"{color.text.accent}"}}}}}]}},{"op":"set_props","id":"claim001","patch":{"text":{"en-US":"Architecture for the places we live and work in"}}},{"op":"set_style","id":"claim001","scope":"bp:md","patch":{"margin-inline-start":"50%"}},{"op":"set_meta","id":"hero0001","anchor":"opening","name":"Opening"},{"op":"set_attrs","id":"claim001","patch":{"data-tone":"quiet"}},{"op":"set_variant","id":"button01","variant":["ghost"]},{"op":"move","id":"intro001","parentId":"hero0001","index":1},{"op":"remove","id":"old00001"}]}' --dry-run

tree.node

Read one node of a page's draft tree with its props, styles, meta, variant and theme, and its children down to depth levels (1 by default, 0 for the node alone), without reading the whole tree. path names its ancestors from the root; cut lists the child ids left out at the depth limit. Find node ids in the page's outline resource; the answer's revision is the tree:<pageId> base revision of the batch that changes it.

permission: site.readreads onlyclass: read

Esempio di input

{
  "pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
  "nodeId": "claim001",
  "depth": 1
}

Input

FieldTypeRequiredNotes
pageIdstringyesAt least 1 character.
nodeIdstringyes
depthintegernoAt least 0. At most 4. Default 1.

Output

FieldTypeRequiredNotes
pageIdstringyes
revisionintegeryesAt least 0.
patharray of objectyes
path[].idstringyes
path[].kindstringyesOne of "root", "section", "repeater", "outlet", "primitive", "component", "instance".
path[].typestringyes
nodeobject | object | object | object | object | object | objectyes
cutrecord of array of stringyes

Provala

yarn splash tree.node '{"pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","nodeId":"claim001","depth":1}' --dry-run

Generato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente a92cc294dd62daec).

Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.

Guida di Libretto

Colophon. Questa guida è un sito Libretto: 70 pagine in due lingue, 21 pagine della guida importate da Markdown e 42 pagine di riferimento generate dal registro delle operazioni. Composta in Softcore, il codice in IBM Plex Mono. La sua struttura:

/it/ Guida di Libretto /it/start Per iniziare /it/start/request-access Richiedere l'accesso /it/start/workspace Il tuo spazio di lavoro /it/start/first-site Il tuo primo sito /it/start/invite-a-client Invitare un cliente /it/start/connect-claude Connettere Claude a Libretto /it/build Costruire /it/build/first-page Costruire una pagina /it/build/layers-and-canvas Livelli e canvas /it/build/site-components Componenti del sito /it/design-system Design system /it/design-system/tokens Colori, spazi e temi /it/design-system/components Componenti e varianti /it/design-system/fonts Tipografia e font /it/motion Movimento /it/motion/scenes Scene e ricette /it/motion/image-sequences Sequenze di immagini /it/motion/reduced-motion Movimento ridotto /it/publish Pubblicazione /it/publish/languages Le lingue del sito /it/publish/versions Pubblicazione e versioni /it/publish/members-and-forms Iscritti e moduli /it/publish/domains Domini /it/publish/redirects Reindirizzamenti /it/handover Consegnare un sito al cliente /it/glossary Glossario /it/agents Agenti e API /it/agents/mcp Server MCP /it/agents/cli CLI /it/agents/batches Batch /it/agents/errors Errori e segnalazioni /it/agents/operations Operazioni /it/search Cerca