@browxai/plugin-tldraw 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +195 -0
- package/package.json +61 -0
- package/schema.d.ts +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kalebtec
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @browxai/plugin-tldraw
|
|
2
|
+
|
|
3
|
+
First-party browxai canvas-app adapter for Tldraw. Exposes five small,
|
|
4
|
+
useful tools (`tldraw.get_selected_shapes`, `tldraw.get_viewport`,
|
|
5
|
+
`tldraw.create_shape`, `tldraw.delete_shape`, `tldraw.select_shapes`)
|
|
6
|
+
over the `window.editor` global that Tldraw v2+ exposes when an Editor
|
|
7
|
+
component is mounted on the page. Each tool is a thin wrapper around an
|
|
8
|
+
`eval_js` round-trip: the plugin builds the appropriate `editor.*`
|
|
9
|
+
expression, dispatches through `eval_js`, and parses the value back.
|
|
10
|
+
When `window.editor` is undefined (Tldraw not mounted), every tool
|
|
11
|
+
returns the structured `code:"tldraw-not-loaded"` envelope.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
$ browxai plugin install @browxai/plugin-tldraw
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The host must have the `eval` and `canvas` capabilities enabled — the
|
|
20
|
+
plugin declares both at the manifest level. Restart the browxai server
|
|
21
|
+
after install (plugin lifecycle is resolved-once-at-server-start).
|
|
22
|
+
|
|
23
|
+
The tools surface as `tldraw.get_selected_shapes` (etc.) on MCP
|
|
24
|
+
`tools/list`, and on the SDK as
|
|
25
|
+
`client.plugins.tldraw.get_selected_shapes(...)`.
|
|
26
|
+
|
|
27
|
+
## Targeted Tldraw API surface
|
|
28
|
+
|
|
29
|
+
This plugin pokes the Tldraw v2.x Editor API as of 2026-06:
|
|
30
|
+
`editor.getSelectedShapes()`, `editor.getViewportPageBounds()`,
|
|
31
|
+
`editor.getZoomLevel()`, `editor.createShapes([...])`,
|
|
32
|
+
`editor.deleteShapes([...])`, `editor.setSelectedShapes(...)`. The
|
|
33
|
+
v2 API has been stable across minor versions; if Tldraw renames a
|
|
34
|
+
method, swap the eval-expression string in `src/index.ts` and the
|
|
35
|
+
unit tests stay green.
|
|
36
|
+
|
|
37
|
+
## Full reference
|
|
38
|
+
|
|
39
|
+
The per-tool reference for this adapter — every op with args, return
|
|
40
|
+
shape, and error codes, plus a usage walkthrough — lives at
|
|
41
|
+
<https://browxai.com/plugins/first-party/>.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface ToolResponse {
|
|
2
|
+
readonly content: ReadonlyArray<{
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "image";
|
|
7
|
+
data: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
interface PluginApi {
|
|
12
|
+
readonly namespace: string;
|
|
13
|
+
readonly declaredCapabilities: ReadonlyArray<string>;
|
|
14
|
+
registerTool(name: string, def: {
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema?: Record<string, any> | undefined;
|
|
17
|
+
}, handler: (args: unknown) => Promise<ToolResponse>): void;
|
|
18
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<ToolResponse>;
|
|
19
|
+
log: {
|
|
20
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
21
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
22
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const handlers: {
|
|
26
|
+
/** `tldraw.get_selected_shapes()` → `{ok, shapes:[{id,type,x,y,props}]}`. */
|
|
27
|
+
get_selected_shapes(api: PluginApi, _args: unknown): Promise<ToolResponse>;
|
|
28
|
+
/** `tldraw.get_viewport()` → `{ok, x, y, w, h, zoom}`. */
|
|
29
|
+
get_viewport(api: PluginApi, _args: unknown): Promise<ToolResponse>;
|
|
30
|
+
/** `tldraw.create_shape({type, x, y, props?})` → `{ok, shapeId}`. */
|
|
31
|
+
create_shape(api: PluginApi, args: unknown): Promise<ToolResponse>;
|
|
32
|
+
/** `tldraw.delete_shape({shapeId})` — `editor.deleteShapes([shapeId])`. */
|
|
33
|
+
delete_shape(api: PluginApi, args: unknown): Promise<ToolResponse>;
|
|
34
|
+
/** `tldraw.select_shapes({shapeIds})` — `editor.setSelectedShapes(shapeIds)`. */
|
|
35
|
+
select_shapes(api: PluginApi, args: unknown): Promise<ToolResponse>;
|
|
36
|
+
};
|
|
37
|
+
export declare function register(api: PluginApi): void;
|
|
38
|
+
export default register;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// @browxai/plugin-tldraw — Tldraw canvas-app adapter.
|
|
2
|
+
//
|
|
3
|
+
// Surfaces five small, useful tools over the `window.editor` global that
|
|
4
|
+
// Tldraw (v2+) exposes when an Editor component is mounted on the page.
|
|
5
|
+
// Each tool routes through `eval_js` — the plugin builds the
|
|
6
|
+
// `editor.*` expression, dispatches it, and parses the value back.
|
|
7
|
+
//
|
|
8
|
+
// Targeted API surface (Tldraw v2.x, current as of 2026-06):
|
|
9
|
+
// - editor.getSelectedShapes() → Shape[]
|
|
10
|
+
// - editor.getViewportPageBounds() → {x,y,w,h}
|
|
11
|
+
// - editor.getZoomLevel() → number
|
|
12
|
+
// - editor.createShapes([...]) → void (assigns shape ids)
|
|
13
|
+
// - editor.deleteShapes([ids]) → void
|
|
14
|
+
// - editor.setSelectedShapes(ids) → void
|
|
15
|
+
//
|
|
16
|
+
// When `window.editor` is undefined (Tldraw not mounted / not on the
|
|
17
|
+
// page), every tool returns `code:"tldraw-not-loaded"`.
|
|
18
|
+
const json = (obj) => ({
|
|
19
|
+
content: [{ type: "text", text: JSON.stringify(obj, null, 2) }],
|
|
20
|
+
});
|
|
21
|
+
const NOT_LOADED = {
|
|
22
|
+
ok: false,
|
|
23
|
+
error: "Tldraw not loaded — open the app first OR the surface is not exposed on this version of the app",
|
|
24
|
+
code: "tldraw-not-loaded",
|
|
25
|
+
};
|
|
26
|
+
const badArg = (which) => ({
|
|
27
|
+
ok: false,
|
|
28
|
+
error: `bad-arg: missing or invalid \`${which}\``,
|
|
29
|
+
code: "bad-arg",
|
|
30
|
+
});
|
|
31
|
+
function parseEvalEnvelope(res) {
|
|
32
|
+
const first = res.content[0];
|
|
33
|
+
if (!first || first.type !== "text") {
|
|
34
|
+
return { ok: false, error: "eval_js returned no text content" };
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(first.text);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
return { ok: false, error: `eval_js envelope parse failure: ${e.message}` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function runEval(api, expr) {
|
|
44
|
+
const res = await api.callTool("eval_js", { expr });
|
|
45
|
+
const env = parseEvalEnvelope(res);
|
|
46
|
+
if (!env.ok)
|
|
47
|
+
return { ok: false, error: env.error ?? "eval_js failed" };
|
|
48
|
+
return { ok: true, value: env.value };
|
|
49
|
+
}
|
|
50
|
+
async function tldrawLoaded(api) {
|
|
51
|
+
const r = await runEval(api, `(typeof window !== "undefined" && typeof window.editor !== "undefined" && window.editor !== null)`);
|
|
52
|
+
return r.ok && r.value === true;
|
|
53
|
+
}
|
|
54
|
+
export const handlers = {
|
|
55
|
+
/** `tldraw.get_selected_shapes()` → `{ok, shapes:[{id,type,x,y,props}]}`. */
|
|
56
|
+
async get_selected_shapes(api, _args) {
|
|
57
|
+
if (!(await tldrawLoaded(api)))
|
|
58
|
+
return json(NOT_LOADED);
|
|
59
|
+
const expr = `(() => {
|
|
60
|
+
const e = window.editor;
|
|
61
|
+
const shapes = (e.getSelectedShapes ? e.getSelectedShapes() : []) || [];
|
|
62
|
+
return {
|
|
63
|
+
shapes: shapes.map(s => ({
|
|
64
|
+
id: s.id,
|
|
65
|
+
type: s.type,
|
|
66
|
+
x: s.x,
|
|
67
|
+
y: s.y,
|
|
68
|
+
props: s.props || {},
|
|
69
|
+
})),
|
|
70
|
+
};
|
|
71
|
+
})()`;
|
|
72
|
+
const r = await runEval(api, expr);
|
|
73
|
+
if (!r.ok)
|
|
74
|
+
return json({ ok: false, error: r.error, code: "eval-failed" });
|
|
75
|
+
return json({ ok: true, ...r.value });
|
|
76
|
+
},
|
|
77
|
+
/** `tldraw.get_viewport()` → `{ok, x, y, w, h, zoom}`. */
|
|
78
|
+
async get_viewport(api, _args) {
|
|
79
|
+
if (!(await tldrawLoaded(api)))
|
|
80
|
+
return json(NOT_LOADED);
|
|
81
|
+
const expr = `(() => {
|
|
82
|
+
const e = window.editor;
|
|
83
|
+
const b = e.getViewportPageBounds ? e.getViewportPageBounds() : { x: 0, y: 0, w: 0, h: 0 };
|
|
84
|
+
const z = e.getZoomLevel ? e.getZoomLevel() : 1;
|
|
85
|
+
return { x: b.x, y: b.y, w: b.w, h: b.h, zoom: z };
|
|
86
|
+
})()`;
|
|
87
|
+
const r = await runEval(api, expr);
|
|
88
|
+
if (!r.ok)
|
|
89
|
+
return json({ ok: false, error: r.error, code: "eval-failed" });
|
|
90
|
+
return json({ ok: true, ...r.value });
|
|
91
|
+
},
|
|
92
|
+
/** `tldraw.create_shape({type, x, y, props?})` → `{ok, shapeId}`. */
|
|
93
|
+
async create_shape(api, args) {
|
|
94
|
+
const a = (args ?? {});
|
|
95
|
+
if (typeof a.type !== "string" || a.type.length === 0)
|
|
96
|
+
return json(badArg("type"));
|
|
97
|
+
if (typeof a.x !== "number")
|
|
98
|
+
return json(badArg("x"));
|
|
99
|
+
if (typeof a.y !== "number")
|
|
100
|
+
return json(badArg("y"));
|
|
101
|
+
if (a.props !== undefined && (typeof a.props !== "object" || a.props === null)) {
|
|
102
|
+
return json(badArg("props"));
|
|
103
|
+
}
|
|
104
|
+
if (!(await tldrawLoaded(api)))
|
|
105
|
+
return json(NOT_LOADED);
|
|
106
|
+
const shape = {
|
|
107
|
+
type: a.type,
|
|
108
|
+
x: a.x,
|
|
109
|
+
y: a.y,
|
|
110
|
+
props: a.props ?? {},
|
|
111
|
+
};
|
|
112
|
+
const shapeJson = JSON.stringify(shape);
|
|
113
|
+
const expr = `(() => {
|
|
114
|
+
const e = window.editor;
|
|
115
|
+
const shape = ${shapeJson};
|
|
116
|
+
const before = new Set((e.getCurrentPageShapes ? e.getCurrentPageShapes() : []).map(s => s.id));
|
|
117
|
+
e.createShapes([shape]);
|
|
118
|
+
const after = (e.getCurrentPageShapes ? e.getCurrentPageShapes() : []);
|
|
119
|
+
const created = after.find(s => !before.has(s.id));
|
|
120
|
+
return { shapeId: created ? created.id : null };
|
|
121
|
+
})()`;
|
|
122
|
+
const r = await runEval(api, expr);
|
|
123
|
+
if (!r.ok)
|
|
124
|
+
return json({ ok: false, error: r.error, code: "eval-failed" });
|
|
125
|
+
const v = r.value;
|
|
126
|
+
if (!v.shapeId)
|
|
127
|
+
return json({
|
|
128
|
+
ok: false,
|
|
129
|
+
error: "tldraw create_shape did not produce a new shape id",
|
|
130
|
+
code: "create-failed",
|
|
131
|
+
});
|
|
132
|
+
return json({ ok: true, shapeId: v.shapeId });
|
|
133
|
+
},
|
|
134
|
+
/** `tldraw.delete_shape({shapeId})` — `editor.deleteShapes([shapeId])`. */
|
|
135
|
+
async delete_shape(api, args) {
|
|
136
|
+
const a = (args ?? {});
|
|
137
|
+
if (typeof a.shapeId !== "string" || a.shapeId.length === 0)
|
|
138
|
+
return json(badArg("shapeId"));
|
|
139
|
+
if (!(await tldrawLoaded(api)))
|
|
140
|
+
return json(NOT_LOADED);
|
|
141
|
+
const id = JSON.stringify(a.shapeId);
|
|
142
|
+
const expr = `(() => {
|
|
143
|
+
const e = window.editor;
|
|
144
|
+
e.deleteShapes([${id}]);
|
|
145
|
+
return { deleted: ${id} };
|
|
146
|
+
})()`;
|
|
147
|
+
const r = await runEval(api, expr);
|
|
148
|
+
if (!r.ok)
|
|
149
|
+
return json({ ok: false, error: r.error, code: "eval-failed" });
|
|
150
|
+
return json({ ok: true, shapeId: a.shapeId });
|
|
151
|
+
},
|
|
152
|
+
/** `tldraw.select_shapes({shapeIds})` — `editor.setSelectedShapes(shapeIds)`. */
|
|
153
|
+
async select_shapes(api, args) {
|
|
154
|
+
const a = (args ?? {});
|
|
155
|
+
if (!Array.isArray(a.shapeIds) || a.shapeIds.some((id) => typeof id !== "string")) {
|
|
156
|
+
return json(badArg("shapeIds"));
|
|
157
|
+
}
|
|
158
|
+
if (!(await tldrawLoaded(api)))
|
|
159
|
+
return json(NOT_LOADED);
|
|
160
|
+
const ids = JSON.stringify(a.shapeIds);
|
|
161
|
+
const expr = `(() => {
|
|
162
|
+
const e = window.editor;
|
|
163
|
+
e.setSelectedShapes(${ids});
|
|
164
|
+
return { selected: ${ids} };
|
|
165
|
+
})()`;
|
|
166
|
+
const r = await runEval(api, expr);
|
|
167
|
+
if (!r.ok)
|
|
168
|
+
return json({ ok: false, error: r.error, code: "eval-failed" });
|
|
169
|
+
return json({ ok: true, shapeIds: a.shapeIds });
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
export function register(api) {
|
|
173
|
+
api.log.info("tldraw plugin: registering tools", { namespace: api.namespace });
|
|
174
|
+
api.registerTool(`${api.namespace}.get_selected_shapes`, {
|
|
175
|
+
description: "Read `editor.getSelectedShapes()` — returns `{ok, shapes:[{id,type,x,y,props}]}`. App-not-loaded surfaces `code:'tldraw-not-loaded'`.",
|
|
176
|
+
inputSchema: {},
|
|
177
|
+
}, (args) => handlers.get_selected_shapes(api, args));
|
|
178
|
+
api.registerTool(`${api.namespace}.get_viewport`, {
|
|
179
|
+
description: "Read `editor.getViewportPageBounds()` + `editor.getZoomLevel()` — returns `{ok, x, y, w, h, zoom}`. App-not-loaded surfaces `code:'tldraw-not-loaded'`.",
|
|
180
|
+
inputSchema: {},
|
|
181
|
+
}, (args) => handlers.get_viewport(api, args));
|
|
182
|
+
api.registerTool(`${api.namespace}.create_shape`, {
|
|
183
|
+
description: "Create a shape via `editor.createShapes([{type, x, y, props}])`. Returns `{ok, shapeId}` (resolved by diffing the page shape list before/after). Bad-arg / app-not-loaded / create-failed surface structured errors.",
|
|
184
|
+
inputSchema: {},
|
|
185
|
+
}, (args) => handlers.create_shape(api, args));
|
|
186
|
+
api.registerTool(`${api.namespace}.delete_shape`, {
|
|
187
|
+
description: "Delete one shape via `editor.deleteShapes([shapeId])`. Returns `{ok, shapeId}` on success.",
|
|
188
|
+
inputSchema: {},
|
|
189
|
+
}, (args) => handlers.delete_shape(api, args));
|
|
190
|
+
api.registerTool(`${api.namespace}.select_shapes`, {
|
|
191
|
+
description: "Set the active selection via `editor.setSelectedShapes(shapeIds)`. Returns `{ok, shapeIds}`.",
|
|
192
|
+
inputSchema: {},
|
|
193
|
+
}, (args) => handlers.select_shapes(api, args));
|
|
194
|
+
}
|
|
195
|
+
export default register;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@browxai/plugin-tldraw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tldraw canvas-app adapter plugin for browxai — surfaces shapes/viewport/create/delete/select over the `window.editor` page-side global.",
|
|
5
|
+
"author": "Kalebtec",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"browxai",
|
|
10
|
+
"browxai-plugin",
|
|
11
|
+
"tldraw",
|
|
12
|
+
"canvas",
|
|
13
|
+
"mcp",
|
|
14
|
+
"browser-automation",
|
|
15
|
+
"ai-agent"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://browxai.com/plugins/first-party/",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/kalebteccom/browxai.git",
|
|
21
|
+
"directory": "packages/plugins/tldraw"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/kalebteccom/browxai/issues"
|
|
25
|
+
},
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"schema.d.ts",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"provenance": true
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc -p tsconfig.json",
|
|
39
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
40
|
+
"test": "vitest run"
|
|
41
|
+
},
|
|
42
|
+
"browxai": {
|
|
43
|
+
"apiVersion": "1.0.0",
|
|
44
|
+
"browxaiVersion": "^0.7.0",
|
|
45
|
+
"namespace": "tldraw",
|
|
46
|
+
"register": "dist/index.js",
|
|
47
|
+
"capabilities": [
|
|
48
|
+
"eval",
|
|
49
|
+
"canvas"
|
|
50
|
+
],
|
|
51
|
+
"trust": "kalebtec",
|
|
52
|
+
"dependsOn": []
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=20"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"typescript": "^5.5.0",
|
|
59
|
+
"vitest": "^2.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/schema.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Typed SDK overlay for `@browxai/plugin-tldraw` consumers.
|
|
2
|
+
|
|
3
|
+
interface TldrawBrowxaiResult {
|
|
4
|
+
readonly content: ReadonlyArray<
|
|
5
|
+
{ type: "text"; text: string } | { type: "image"; data: string; mimeType: string }
|
|
6
|
+
>;
|
|
7
|
+
readonly data?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TldrawShape {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly type: string;
|
|
13
|
+
readonly x: number;
|
|
14
|
+
readonly y: number;
|
|
15
|
+
readonly props: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TldrawPluginSchema {
|
|
19
|
+
readonly tldraw: {
|
|
20
|
+
/** Read `editor.getSelectedShapes()` — returns `{ok, shapes:[...]}`. */
|
|
21
|
+
get_selected_shapes(args?: Record<string, never>): Promise<TldrawBrowxaiResult>;
|
|
22
|
+
/** Read viewport page bounds + zoom — returns `{ok, x, y, w, h, zoom}`. */
|
|
23
|
+
get_viewport(args?: Record<string, never>): Promise<TldrawBrowxaiResult>;
|
|
24
|
+
/** Create a shape via `editor.createShapes(...)` — returns `{ok, shapeId}`. */
|
|
25
|
+
create_shape(args: {
|
|
26
|
+
type: string;
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
props?: Record<string, unknown>;
|
|
30
|
+
}): Promise<TldrawBrowxaiResult>;
|
|
31
|
+
/** Delete one shape via `editor.deleteShapes([shapeId])`. */
|
|
32
|
+
delete_shape(args: { shapeId: string }): Promise<TldrawBrowxaiResult>;
|
|
33
|
+
/** Set the selected-shape ids via `editor.setSelectedShapes(shapeIds)`. */
|
|
34
|
+
select_shapes(args: { shapeIds: ReadonlyArray<string> }): Promise<TldrawBrowxaiResult>;
|
|
35
|
+
};
|
|
36
|
+
}
|