Jace Design

🧰 Making apps for Jace Design

An app is a web page you host anywhere on https:// (GitHub Pages, Vercel, Netlify…). In the editor it opens in a window next to the design, and it talks to Jace Design with postMessage. Then add it here.

What an app can do

Apps can only add things to the design. They run in a locked-down frame: they can’t see the rest of the design, your account or your cookies.

Messages your app sends (to parent)

{ jaceDesign: 'ready' }Ask for the design’s size. Jace Design answers with { jaceDesign: 'hello', version: 1, design: { width, height, kind }, selection }, where selection is { type, text } for selected text or null.
{ jaceDesign: 'insert', text: {…} }Add text. text, and optionally fontSize, fontFamily (any Google Font), fontWeight, color, align, bgColor, x, y, w.
{ jaceDesign: 'insert', image: { src } }Add a picture. src is a data:image/… URL (PNG, JPG, WebP, GIF or SVG, up to about 6 MB), or an https link that allows CORS.
{ jaceDesign: 'insert', elements: [ … ], width, height }Add several things at once: text, shapes, lines, charts, tables, QR codes and icons, in the same JSON the AI tools use (see the AI tab’s prompts). width/height say what size you laid them out for; they’re scaled to fit.
{ jaceDesign: 'close' }Close your app’s window.

A complete example

<!doctype html>
<html>
<body>
  <h3>Big hello</h3>
  <input id="t" value="Hello!">
  <button id="add">Add to design</button>
  <script>
    let design = null;
    // 1. Say you're ready; Jace Design answers with "hello".
    parent.postMessage({ jaceDesign: 'ready' }, '*');
    addEventListener('message', (e) => {
      if (e.data && e.data.jaceDesign === 'hello') design = e.data.design; // { width, height, kind }
    });
    // 2. Send things to add.
    document.getElementById('add').onclick = () => {
      parent.postMessage({ jaceDesign: 'insert', text: { text: document.getElementById('t').value, fontSize: 96, color: '#1f9d5a', fontFamily: 'Poppins', fontWeight: 700 } }, '*');
    };
  </script>
</body>
</html>

Rules

+ Make an app