Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

2.4 KB
Raw Blame
// Auto-generated by scripts/generate-sandbox.ts — do not edit.
export const CANVAS_SANDBOX_CODE =
  'class CanvasEditor {\n  refs;\n  ops = [];\n  constructor(refs) {\n    this.refs = refs;\n  }\n  nextId() {\n    const id = this.refs.shift();\n    if (!id)\n      throw new Error("At most 100 new items per snippet.");\n    return id;\n  }\n  add(op) {\n    if (this.ops.length >= 100)\n      throw new Error("At most 100 operations per snippet.");\n    this.ops.push(op);\n  }\n  create(options) {\n    const id = this.nextId();\n    this.add({ ...options, kind: "create", id });\n    return id;\n  }\n  connect(options) {\n    const id = this.nextId();\n    this.add({\n      ...options,\n      route: options.route ?? "stepped",\n      kind: "connect",\n      id\n    });\n    return id;\n  }\n  move(ids, dx, dy) {\n    this.add({ kind: "move", ids, dx, dy });\n  }\n  resize(id, width, height, fitText) {\n    this.add({ kind: "resize", id, width, height, fitText });\n  }\n  style(ids, style) {\n    this.add({ kind: "style", ids, style });\n  }\n  text(id, text, fitText) {\n    this.add({ kind: "text", id, text, fitText });\n  }\n  mentionUser(id, at, person, fitText) {\n    this.add({ kind: "mentionUser", id, at, person, fitText });\n  }\n  fitText(id, mode = "grow", width) {\n    this.add({ kind: "fitText", id, mode, width });\n  }\n  textStyle(id, style) {\n    this.add({ ...style, kind: "textStyle", id });\n  }\n  delete(ids) {\n    this.add({ kind: "delete", ids });\n  }\n  group(ids) {\n    const id = this.nextId();\n    this.add({ kind: "group", ids, id });\n    return id;\n  }\n  ungroup(id) {\n    this.add({ kind: "ungroup", id });\n  }\n  reparent(id, parentId) {\n    this.add({ kind: "reparent", id, parentId });\n  }\n  order(ids, position) {\n    this.add({ kind: "order", ids, position });\n  }\n  createArtifact(options) {\n    const id = this.nextId();\n    this.add({ ...options, kind: "createArtifact", id });\n    return id;\n  }\n  artifactSource(id, content) {\n    this.add({ ...content, kind: "artifactSource", id });\n  }\n  artifactEdit(id, find, replace) {\n    this.add({ kind: "artifactEdit", id, find, replace });\n  }\n  defineStyle(name, css) {\n    this.add({ kind: "defineStyle", name, css });\n  }\n  defineComponent(name, html) {\n    this.add({ kind: "defineComponent", name, html });\n  }\n  presentOrder(ids) {\n    this.add({ kind: "presentOrder", ids });\n  }\n  drain() {\n    return this.ops.splice(0);\n  }\n}';