API 1.0.0 · 靜態前端提供的探索介面,不需要存取專案檔案。
在使用者指定的編輯器分頁執行 window.pinban.agent.describe()。本說明頁不含文件內容,也不是可寫入的 API 端點。
範例不會自動執行。只在使用者要求該修改,且確認目標分頁後執行。
{
"name": "selected-style",
"title": "調整選取元件的圓角",
"requirements": [
"A user-requested style edit and at least one selected editable node."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "調整選取元件的圓角",
"operations": [
{
"type": "setStyle",
"id": "<selected node id>",
"breakpoint": "desktop",
"style": {
"borderRadius": 24
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization",
"javascript": "(() => {\n const api = window.pinban.agent;\n const selected = api.inspect({scope: \"selection\"});\n if (!selected.ok) return selected;\n if (!selected.nodes.length) return {ok:false, error:{code:\"NO_SELECTION\", message:\"Select the user-requested target first.\"}};\n const request = {\n documentId: selected.documentId, expectedRevision: selected.revision,\n requestId: crypto.randomUUID(), label: \"Set selected corner radius\",\n operations: selected.nodes.map(n => ({type:\"setStyle\", id:n.id, breakpoint:\"desktop\", style:{borderRadius:24}}))\n };\n const validation = api.validate(request);\n if (!validation.ok) return validation;\n const result = api.apply(request);\n return result.ok ? {result, measurement:api.measure({ids:selected.nodes.map(n => n.id)})} : result;\n})()",
"javascriptNotice": "This snippet WRITES after successful validation. Execute only when the user requested this edit; reading examples() never executes it."
}{
"name": "create-section",
"title": "新增容器與標題",
"requirements": [
"Known target container; new IDs are unique and at most 40 characters."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "新增容器與標題",
"operations": [
{
"type": "create",
"id": "<fresh frame id>",
"nodeType": "frame",
"parentId": "<target frame id or null>",
"style": {
"display": "flex",
"flexDirection": "column",
"gap": 20
}
},
{
"type": "create",
"id": "<fresh heading id>",
"nodeType": "heading",
"parentId": "<fresh frame id>",
"props": {
"text": "New section"
},
"style": {
"fontSize": 32,
"fontWeight": "700"
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "mobile-layout",
"title": "手機改成單欄",
"requirements": [
"Target is a frame; desktop values must remain intact."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "手機改成單欄",
"operations": [
{
"type": "setLayout",
"id": "<frame id>",
"breakpoint": "mobile",
"layout": {
"display": "flex",
"flexDirection": "column",
"gap": 16
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "reset-override",
"title": "移除手機版圓角覆寫",
"requirements": [
"Null removes the override; it is not the numeric zero."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "移除手機版圓角覆寫",
"operations": [
{
"type": "setStyle",
"id": "<node id>",
"breakpoint": "mobile",
"style": {
"borderRadius": null
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "move",
"title": "移動物件",
"requirements": [
"Coordinates are document pixels, not screenshot pixels."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "移動物件",
"operations": [
{
"type": "move",
"id": "<node id>",
"dx": 24,
"dy": 12
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "reparent",
"title": "移至另一容器",
"requirements": [
"Target frame is not a descendant of the moving node."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "移至另一容器",
"operations": [
{
"type": "reparent",
"id": "<node id>",
"parentId": "<target frame id>",
"index": 0
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "duplicate",
"title": "複製圖層與資料綁定",
"requirements": [
"User requested a copy; cloned data sources keep their configured refresh behaviour."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "複製圖層與資料綁定",
"operations": [
{
"type": "duplicate",
"id": "<node id>",
"newId": "<fresh node id>"
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "delete",
"title": "刪除指定物件",
"requirements": [
"Explicit user deletion intent. Do not infer permission from this template."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "刪除指定物件",
"operations": [
{
"type": "delete",
"id": "<explicitly authorized node id>"
}
],
"allowDelete": true
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "data-mapping",
"title": "修改圖表欄位",
"requirements": [
"Field names must exist in the configured data source. This does not change the source URL."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "修改圖表欄位",
"operations": [
{
"type": "setData",
"id": "<widget scene node id>",
"binding": {
"fields": [
"revenue"
],
"xField": "month",
"agg": "sum"
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "set-text",
"title": "修改標題文字",
"requirements": [
"Target type supports text."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "修改標題文字",
"operations": [
{
"type": "setNode",
"id": "<heading node id>",
"props": {
"text": "Updated heading"
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "page-background",
"title": "修改頁面背景",
"requirements": [
"User authorized a page-wide background change."
],
"requestTemplate": {
"documentId": "<documentId from inspect>",
"expectedRevision": "<revision from inspect>",
"requestId": "<fresh requestId>",
"label": "修改頁面背景",
"operations": [
{
"type": "setPage",
"props": {
"background": "#f8fafc"
}
}
]
},
"templateNotice": "Angle-bracket values are placeholders. Replace them from the intended live tab; never apply a template blindly.",
"validation": "api.validate(request)",
"execution": "api.apply(request) only after ok:true and within user authorization"
}{
"name": "undo",
"title": "復原上一個步驟",
"requirements": [
"The last history step is the one the user intends to undo; history includes human edits."
],
"method": "undo",
"requestTemplate": {
"documentId": "<documentId from new inspect>",
"expectedRevision": "<revision from new inspect>",
"requestId": "<fresh requestId>"
},
"templateNotice": "No operations field for undo or redo. Re-inspect first."
}