agent-canvas 0.1.13 → 0.1.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.
@@ -81,7 +81,11 @@ export function createApiHandlers(ctx: ApiContext): Route[] {
81
81
  if (result.ok) {
82
82
  sessionManager.saveCompiled(sessionId, result.js, rev);
83
83
  compiled = result.js;
84
+ } else {
85
+ console.warn(`[plan.js] compilation failed for ${sessionId} rev ${rev}: ${result.error}`);
84
86
  }
87
+ } else {
88
+ console.warn(`[plan.js] no JSX found for ${sessionId} rev ${rev}`);
85
89
  }
86
90
  }
87
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-canvas",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Interactive visual canvas for Claude Code — rich annotatable documents in the browser",
5
5
  "bin": {
6
6
  "agent-canvas": "bin/agent-canvas.js"
@@ -3,6 +3,20 @@
3
3
  All components are available globally in canvas JSX — no imports needed.
4
4
  For inline styling use `style={{ ... }}`. Tailwind classes are NOT available.
5
5
 
6
+ ## Theming
7
+
8
+ **Never hardcode hex colors** — canvas supports light/dark themes. Use CSS variables in `style={{ }}`:
9
+
10
+ - **Text:** `--color-text-primary`, `--color-text-secondary`, `--color-text-tertiary`, `--color-text-code`, `--color-text-inverse`
11
+ - **Backgrounds:** `--color-bg-base`, `--color-bg-surface`, `--color-bg-elevated`, `--color-bg-code`, `--color-bg-input`
12
+ - **Accents:** `--color-accent-{green,amber,red,blue}`, `--color-accent-{green,amber,red,blue}-muted`
13
+ - **Borders:** `--color-border-subtle`, `--color-border-medium`, `--color-border-hover`
14
+ - **Fonts:** `--font-heading`, `--font-body`, `--font-mono`
15
+
16
+ ```jsx
17
+ <span style={{ color: 'var(--color-text-tertiary)', fontSize: '0.75rem' }}>meta text</span>
18
+ ```
19
+
6
20
  ---
7
21
 
8
22
  ## Layout
@@ -333,10 +347,10 @@ When you use the full module format (`export default function Canvas()`), you ca
333
347
 
334
348
  ```jsx
335
349
  function Metric({ label, value, trend }) {
336
- const color = trend === 'up' ? '#4a9e6d' : trend === 'down' ? '#c45a5a' : '#a09a92';
350
+ const color = trend === 'up' ? 'var(--color-accent-green)' : trend === 'down' ? 'var(--color-accent-red)' : 'var(--color-text-secondary)';
337
351
  return (
338
352
  <div style={{ display: 'flex', gap: 12, alignItems: 'baseline' }}>
339
- <span style={{ color: '#6b6560', fontSize: '0.75rem' }}>{label}</span>
353
+ <span style={{ color: 'var(--color-text-tertiary)', fontSize: '0.75rem' }}>{label}</span>
340
354
  <span style={{ color, fontSize: '1.25rem', fontWeight: 600 }}>{value}</span>
341
355
  </div>
342
356
  );
@@ -360,27 +374,27 @@ Standard components remain available without import even in full module format.
360
374
  ## Diagrams with Raw SVG
361
375
 
362
376
  For custom visuals that Mermaid can't express, write `<svg>` directly.
363
- Use Canvas CSS variables for colors to match the theme:
377
+ Use CSS variables for colors to match the theme automatically:
364
378
 
365
379
  ```jsx
366
380
  <svg viewBox="0 0 400 200" style={{ width: '100%', maxWidth: 400 }}>
367
- <rect x="10" y="10" width="120" height="50" rx="8"
368
- fill="rgba(90, 142, 196, 0.12)" stroke="rgba(90, 142, 196, 0.3)" />
369
- <text x="70" y="40" textAnchor="middle" fill="#e8e4df" fontSize="13"
370
- fontFamily="Inter, sans-serif">API Gateway</text>
371
-
372
- <line x1="130" y1="35" x2="180" y2="35" stroke="#6b6560" strokeWidth="1.5"
381
+ <rect x="10" y="10" width="120" height="50" rx="8"
382
+ fill="var(--color-accent-blue-muted)" stroke="var(--color-accent-blue)" strokeOpacity="0.3" />
383
+ <text x="70" y="40" textAnchor="middle" fill="var(--color-text-primary)" fontSize="13"
384
+ fontFamily="var(--font-body)">API Gateway</text>
385
+
386
+ <line x1="130" y1="35" x2="180" y2="35" stroke="var(--color-text-tertiary)" strokeWidth="1.5"
373
387
  markerEnd="url(#arrow)" />
374
-
388
+
375
389
  <rect x="180" y="10" width="120" height="50" rx="8"
376
- fill="rgba(74, 158, 109, 0.12)" stroke="rgba(74, 158, 109, 0.3)" />
377
- <text x="240" y="40" textAnchor="middle" fill="#e8e4df" fontSize="13"
378
- fontFamily="Inter, sans-serif">Auth Service</text>
379
-
390
+ fill="var(--color-accent-green-muted)" stroke="var(--color-accent-green)" strokeOpacity="0.3" />
391
+ <text x="240" y="40" textAnchor="middle" fill="var(--color-text-primary)" fontSize="13"
392
+ fontFamily="var(--font-body)">Auth Service</text>
393
+
380
394
  <defs>
381
395
  <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6"
382
396
  orient="auto-start-reverse">
383
- <path d="M 0 0 L 10 5 L 0 10 z" fill="#6b6560" />
397
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="var(--color-text-tertiary)" />
384
398
  </marker>
385
399
  </defs>
386
400
  </svg>