use-canvas
Create or edit an Endless Design Studio canvas, an .excalidraw page of views, documents, notes and arrows. Use only when the Canvases module is enabled.
Files1
View on GitHubSKILL.mdsrc/modules/canvas/skills/use-canvas/SKILL.md
GitHubRead this module's README first; it describes the file, the tools and how a canvas shows.
Before you change anything
- Run
yarn studio context src/prototypes/<key>/<id> --jsonand respectcanEdit. Only the prototype's owner or an Admin may change its canvases, and only while the prototype is active. - A canvas is one
<name>.excalidrawfile inside a prototype. Create it through the file menu (+ → New canvas), or write the empty scene fromtypes/canvas/check.ts(template). For files written by hand, runyarn studio identify <prototype folder>and apply with--yes; never change or copy an existingstudioId. - Read the current tool help instead of assuming arguments:
yarn canvas help, thenyarn canvas help createfor the element types.
Changing a canvas
Prefer the tools over editing the JSON: they keep arrows attached, labels inside their shapes, element versions raised and links in their stored form.
- On the file:
yarn canvas <file.excalidraw> <tool> '<json>'. When the shell can change quotes (PowerShell, cmd), pass--json-file <path>or pipe the JSON with-; all three give the same result. The result is JSON on stdout; an open canvas takes the change in live. - In the open canvas (a browser on the local studio):
window.__studioCanvashas the same tools, pluscontext,point,screenshotandpersist. Read itshelp()first. Each call is one undo step for the person. - If the command says files have no identity yet, run the command it names, or repeat the call with
--identify.
Work in small, reviewable steps:
describebefore changing anything (contextfirst in the browser when the person says "this" or "here").- Keep items in the canvas's own prototype:
artifactslists what can go on it. To show another prototype's view, copy it into this prototype first. - Prefer native elements:
textfor annotations, with shapes, arrows, lines andsections. Stickynotes are optional, not the default. - To show a view's named states, use
stateswith the view's file, such as{ "artifact": "flows/Home.vue" }: one call places every state side by side, titled and linked to each state's permanent address. For a view without states, usecreatewithtype: "artifact". - Preserve the person's arrangement; move existing content only when the request needs it.
- Never write images yourself: a person pastes or drops them in the studio, which stores each picture in the prototype's
_canvas-images/folder. Prefer the working view to a screenshot of it. describeagain afterwards, and in the browserpointat what you placed so the person sees it.
If you must edit the JSON directly, keep each element's id, raise its version with a new versionNonce when you change it, keep "files" and "studioVersion" as they are, and write the file in one go. An item is an "embeddable" whose link is /prototypes/<prototype-id>/artifacts/<artifact-id>.
Check the result
Open the canvas in the studio and look at the rendered result: items show live previews or cards, nothing overlaps by accident (create warns about overlaps), arrows join what they should. yarn build refuses a canvas with invalid JSON, a picture's bytes inside the file, images whose picture files doesn't list, links to another prototype or an unknown studioVersion. Report which canvas changed, what you placed, and the canvas's link.