@compilr-dev/sdk 0.17.13 → 0.17.14
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/dist/skills/canvas-skills.js +28 -3
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ export const canvasSkill = defineSkill({
|
|
|
46
46
|
- Do NOT include \`<html>\`, \`<head>\`, \`<meta>\`, \`<!doctype>\`, or your own CSP — the host injects the sandbox and CSP. Just the body content + a \`<style>\` and optional \`<script>\`.
|
|
47
47
|
- The sandbox is \`allow-scripts\` with NO same-origin and CSP \`default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:\`. So: inline \`<style>\`/\`<script>\` only, no external fonts/CSS/JS/network, no remote images (use inline SVG or data: URIs).
|
|
48
48
|
- **Match the app theme by default.** The host injects its live theme palette as CSS variables you MUST use instead of hardcoded colors: \`var(--canvas-bg)\` (page background), \`var(--canvas-fg)\` (text), \`var(--canvas-accent)\` and \`var(--canvas-secondary)\` (highlights), \`var(--canvas-muted)\` (secondary text), \`var(--canvas-border)\` (lines), \`var(--canvas-card)\` (raised surfaces). Only hardcode specific colors when the user explicitly asks for a particular palette or brand.
|
|
49
|
-
- **
|
|
49
|
+
- **Background — infographic & carousel: always set it EXPLICITLY to \`var(--canvas-bg)\`** on your outermost wrapper (and each \`<section data-sheet>\` for a carousel). Do NOT use \`background: transparent\` and do NOT hardcode a fixed color like \`#0a0a0a\`: transparent looks fine in-app but **exports to PDF/HTML on WHITE**, and a fixed color ignores the theme. **EXCEPTION — infinite board: do the OPPOSITE.** Keep the \`data-board\` root **transparent** (do not fill it) — the host paints a dot-grid backdrop that must show through, and filling it turns the infinite surface into a finite rectangle. On a board you style only the node cards; the space between them stays transparent. (See the \`board\` skill.)
|
|
50
50
|
- Make it look intentional: a clear grid, strong type scale, generous spacing. Use \`var(--canvas-accent)\` sparingly for emphasis. Prefer inline SVG for shapes/charts/icons (fill/stroke with the theme vars).
|
|
51
51
|
- For a **carousel**, wrap each slide in \`<section data-sheet>…</section>\` — a natural unit to add one per \`canvas_edit\` append.
|
|
52
52
|
|
|
@@ -164,12 +164,37 @@ export const boardSkill = defineSkill({
|
|
|
164
164
|
tags: ['visual', 'canvas', 'board', 'diagram', 'design'],
|
|
165
165
|
prompt: `Craft guide for an INFINITE BOARD — a pannable/zoomable 2D space (mind-map, system/architecture diagram, UI-layout sketch). This is design guidance; author with the canvas tools (see the \`canvas\` skill). YOU author the board; the user pans, zooms, and lightly restyles — they do NOT drag nodes, so your layout is the final layout.
|
|
166
166
|
|
|
167
|
+
## SHOW, don't TELL (the #1 rule)
|
|
168
|
+
A board is a VISUAL surface — its value is that it *depicts* things, not that it holds text. If your board is mostly paragraphs and bullet lists, you've built a text document on a grid and failed the medium. That is what the "propose alternatives" text tool is for — a board must EARN its place by being visual.
|
|
169
|
+
- **Depict, don't describe.** Exploring website / UI options? DRAW each option as a **wireframe mock** — a browser/window frame with a nav bar, a hero block, and content sections as labeled BOXES — laid side by side so they can be compared at a glance. Do NOT write "Option A: terminal-first hero, CLI-style product list…" as prose; SKETCH it.
|
|
170
|
+
- **Architecture / flow?** Draw boxes-and-arrows (nodes + inline-SVG connectors), not a written description of the components.
|
|
171
|
+
- **Mind-map?** A central node with branches and sub-nodes, not an outline.
|
|
172
|
+
- Text belongs INSIDE the visual as short labels (titles, captions, a few key words) — never as the primary content of a node.
|
|
173
|
+
|
|
174
|
+
### Wireframe node — the shape to reach for (UI/website boards)
|
|
175
|
+
Build each screen mock as nested boxes so it reads as a *picture of a page*:
|
|
176
|
+
\`\`\`
|
|
177
|
+
<div style="position:absolute;left:80px;top:120px;width:520px;background:var(--canvas-card);
|
|
178
|
+
border:1px solid var(--canvas-border);border-radius:8px;overflow:hidden">
|
|
179
|
+
<div style="height:28px;background:var(--canvas-bg);display:flex;align-items:center;gap:6px;padding:0 10px">
|
|
180
|
+
<span style="width:8px;height:8px;border-radius:50%;background:var(--canvas-muted)"></span> …traffic lights…
|
|
181
|
+
</div>
|
|
182
|
+
<div style="height:44px;border-bottom:1px solid var(--canvas-border);display:flex;align-items:center;
|
|
183
|
+
justify-content:space-between;padding:0 16px"><b style="color:var(--canvas-fg)">logo</b><span style="color:var(--canvas-muted)">nav · nav · nav</span></div>
|
|
184
|
+
<div style="padding:28px 16px"><div style="height:18px;width:70%;background:var(--canvas-fg);opacity:.85"></div>
|
|
185
|
+
<div style="height:10px;width:50%;background:var(--canvas-muted);margin-top:10px"></div>
|
|
186
|
+
<div style="height:32px;width:120px;background:var(--canvas-accent);margin-top:16px;border-radius:6px"></div></div>
|
|
187
|
+
<div style="display:flex;gap:10px;padding:0 16px 20px"><div style="flex:1;height:70px;background:var(--canvas-bg);border:1px solid var(--canvas-border)"></div>…cards…</div>
|
|
188
|
+
</div>
|
|
189
|
+
\`\`\`
|
|
190
|
+
Give each mock a small title above it ("OPTION A — Terminal-first"). Two or three of these side by side IS the deliverable.
|
|
191
|
+
|
|
167
192
|
## The coordinate-space contract (REQUIRED)
|
|
168
193
|
- The board is ONE HTML document laid out in a logical pixel coordinate space. Wrap everything in a root with an EXPLICIT declared size:
|
|
169
194
|
\`<div data-board style="position:relative;width:2400px;height:1500px">…</div>\`
|
|
170
195
|
The \`data-board\` element and its px \`width\`/\`height\` ARE the board's extent — the host uses them to fit-to-view and to export. Pick a size that comfortably holds your content with margins (e.g. 2000–4000 wide). Keep all content INSIDE these bounds.
|
|
171
196
|
- **Nodes** are self-contained blocks, ABSOLUTELY positioned inside the board: \`position:absolute; left:Xpx; top:Ypx; width:Wpx\`. Snap X/Y/W to a grid (e.g. multiples of 20) so the board reads as ordered, not scattered.
|
|
172
|
-
-
|
|
197
|
+
- **Keep the \`data-board\` root TRANSPARENT** — do NOT set a background on it (this is the one canvas type where you do NOT paint \`var(--canvas-bg)\`). The host paints a dot-grid backdrop that must show through; a solid fill turns the infinite surface into a finite dark rectangle. Style only the NODE CARDS with the theme vars (\`var(--canvas-card)\` fill, \`var(--canvas-border)\` edge, \`var(--canvas-fg)\` text, \`var(--canvas-accent)\` for emphasis) — the space BETWEEN nodes stays transparent (the grid).
|
|
173
198
|
|
|
174
199
|
## Connectors — inline SVG overlay
|
|
175
200
|
- Draw relationships as ONE inline-SVG layer spanning the whole board, BEHIND the nodes:
|
|
@@ -189,5 +214,5 @@ export const boardSkill = defineSkill({
|
|
|
189
214
|
- Add 2–4 **bound** Tweaks (accent color, node title size, a toggle for connector labels or a cluster).
|
|
190
215
|
|
|
191
216
|
## Anti-patterns (fix on sight)
|
|
192
|
-
- No \`data-board\` wrapper / no declared size (breaks fit + export). • Content outside the declared bounds. • Nodes scattered off-grid with no clusters. •
|
|
217
|
+
- **Text cards instead of visuals** — paragraphs/bullet lists where a wireframe, diagram, or sketch belongs. This is the most common failure: a board of prose is just the alternatives text tool in disguise. SHOW it. • Filling the \`data-board\` background (turns the infinite surface into a finite rectangle — keep it transparent). • No \`data-board\` wrapper / no declared size (breaks fit + export). • Content outside the declared bounds. • Nodes scattered off-grid with no clusters. • Connectors that cross through nodes or are unlabeled where the relation is ambiguous. • Text only readable when zoomed in. • Reinventing a whiteboard — this is an authored diagram, not a drag-and-drop surface.`,
|
|
193
218
|
});
|