@pinepaper.studio/mcp-server 1.4.3 → 1.5.1

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.
Files changed (74) hide show
  1. package/README.md +89 -0
  2. package/dist/__tests__/fixtures/mock-generators.d.ts +147 -0
  3. package/dist/__tests__/fixtures/mock-generators.d.ts.map +1 -1
  4. package/dist/__tests__/fixtures/mock-generators.js +85 -0
  5. package/dist/__tests__/fixtures/mock-generators.js.map +1 -1
  6. package/dist/agent/export-manager.d.ts +77 -0
  7. package/dist/agent/export-manager.d.ts.map +1 -0
  8. package/dist/agent/export-manager.js +465 -0
  9. package/dist/agent/export-manager.js.map +1 -0
  10. package/dist/agent/index.d.ts +9 -0
  11. package/dist/agent/index.d.ts.map +1 -0
  12. package/dist/agent/index.js +12 -0
  13. package/dist/agent/index.js.map +1 -0
  14. package/dist/agent/session-manager.d.ts +109 -0
  15. package/dist/agent/session-manager.d.ts.map +1 -0
  16. package/dist/agent/session-manager.js +311 -0
  17. package/dist/agent/session-manager.js.map +1 -0
  18. package/dist/agent/types.d.ts +385 -0
  19. package/dist/agent/types.d.ts.map +1 -0
  20. package/dist/agent/types.js +141 -0
  21. package/dist/agent/types.js.map +1 -0
  22. package/dist/browser/index.d.ts +1 -1
  23. package/dist/browser/index.d.ts.map +1 -1
  24. package/dist/browser/index.js +1 -1
  25. package/dist/browser/index.js.map +1 -1
  26. package/dist/browser/puppeteer-controller.d.ts +89 -5
  27. package/dist/browser/puppeteer-controller.d.ts.map +1 -1
  28. package/dist/browser/puppeteer-controller.js +412 -11
  29. package/dist/browser/puppeteer-controller.js.map +1 -1
  30. package/dist/cli.js +61 -65
  31. package/dist/cli.js.map +1 -1
  32. package/dist/index.d.ts +6 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +2769 -150
  35. package/dist/index.js.map +1 -1
  36. package/dist/metrics/types.d.ts +3 -1
  37. package/dist/metrics/types.d.ts.map +1 -1
  38. package/dist/prompts/index.d.ts +30 -0
  39. package/dist/prompts/index.d.ts.map +1 -0
  40. package/dist/prompts/index.js +163 -0
  41. package/dist/prompts/index.js.map +1 -0
  42. package/dist/tools/compact-descriptions.d.ts +9 -0
  43. package/dist/tools/compact-descriptions.d.ts.map +1 -0
  44. package/dist/tools/compact-descriptions.js +291 -0
  45. package/dist/tools/compact-descriptions.js.map +1 -0
  46. package/dist/tools/definitions.d.ts +14 -0
  47. package/dist/tools/definitions.d.ts.map +1 -1
  48. package/dist/tools/definitions.js +4954 -1552
  49. package/dist/tools/definitions.js.map +1 -1
  50. package/dist/tools/handlers.d.ts.map +1 -1
  51. package/dist/tools/handlers.js +1302 -19
  52. package/dist/tools/handlers.js.map +1 -1
  53. package/dist/tools/index.d.ts +4 -1
  54. package/dist/tools/index.d.ts.map +1 -1
  55. package/dist/tools/index.js +2 -1
  56. package/dist/tools/index.js.map +1 -1
  57. package/dist/tools/minimal-descriptions.d.ts +9 -0
  58. package/dist/tools/minimal-descriptions.d.ts.map +1 -0
  59. package/dist/tools/minimal-descriptions.js +158 -0
  60. package/dist/tools/minimal-descriptions.js.map +1 -0
  61. package/dist/tools/toolkits.d.ts +51 -0
  62. package/dist/tools/toolkits.d.ts.map +1 -0
  63. package/dist/tools/toolkits.js +336 -0
  64. package/dist/tools/toolkits.js.map +1 -0
  65. package/dist/types/code-generator.d.ts +193 -1
  66. package/dist/types/code-generator.d.ts.map +1 -1
  67. package/dist/types/code-generator.js +2167 -26
  68. package/dist/types/code-generator.js.map +1 -1
  69. package/dist/types/schemas.d.ts +5278 -1141
  70. package/dist/types/schemas.d.ts.map +1 -1
  71. package/dist/types/schemas.js +863 -5
  72. package/dist/types/schemas.js.map +1 -1
  73. package/manifest.json +94 -2
  74. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11,92 +11,128 @@
11
11
  */
12
12
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
13
13
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
- import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
15
- import { PINEPAPER_TOOLS } from './tools/definitions.js';
14
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
15
+ import { PINEPAPER_TOOLS, getToolsForVerbosity } from './tools/definitions.js';
16
+ import { getToolsForToolkit, detectToolkitFromEnvironment, detectVerbosityFromEnvironment, isToolkitExplicitlySet, isVerbosityExplicitlySet, getClientProfile, } from './tools/toolkits.js';
16
17
  import { handleToolCall, getExecutionMode } from './tools/handlers.js';
17
18
  import { initI18n, DEFAULT_LOCALE, } from './i18n/index.js';
19
+ import { PROMPTS, getPromptMessages } from './prompts/index.js';
18
20
  // =============================================================================
19
21
  // SERVER INFO
20
22
  // =============================================================================
21
23
  const SERVER_INFO = {
22
24
  name: 'pinepaper-mcp',
23
- version: '1.4.0',
25
+ version: '1.5.1',
24
26
  description: 'MCP Server for PinePaper Studio - Create animated graphics with AI',
25
27
  };
26
28
  // =============================================================================
27
29
  // RESOURCES (Documentation & Examples)
28
30
  // =============================================================================
29
31
  const RESOURCES = [
32
+ // === CORE GUIDES (Start here) ===
30
33
  {
31
34
  uri: 'pinepaper://docs/getting-started',
32
- name: 'Getting Started Guide',
33
- description: 'Introduction to PinePaper MCP tools',
35
+ name: '🚀 Getting Started',
36
+ description: 'START HERE: Tool categories, quick examples, and how to find the right tools',
37
+ mimeType: 'text/markdown',
38
+ },
39
+ {
40
+ uri: 'pinepaper://docs/templates',
41
+ name: '📋 Templates Guide',
42
+ description: 'Pre-built templates with animations ready - just change content. Check here first!',
43
+ mimeType: 'text/markdown',
44
+ },
45
+ // === FEATURE GUIDES (How to use each feature) ===
46
+ {
47
+ uri: 'pinepaper://docs/map-tools',
48
+ name: '🗺️ Maps Guide',
49
+ description: 'Create USA state maps, world maps, choropleth coloring, and animated map regions',
50
+ mimeType: 'text/markdown',
51
+ },
52
+ {
53
+ uri: 'pinepaper://docs/diagrams',
54
+ name: '📊 Diagrams Guide',
55
+ description: 'Create flowcharts, UML diagrams, network diagrams, and auto-layout',
56
+ mimeType: 'text/markdown',
57
+ },
58
+ {
59
+ uri: 'pinepaper://docs/masks',
60
+ name: '🎭 Masks Guide',
61
+ description: 'Create reveal effects: wipes, iris, curtains, and custom animated masks',
34
62
  mimeType: 'text/markdown',
35
63
  },
36
64
  {
37
65
  uri: 'pinepaper://docs/relations',
38
- name: 'Relations Guide',
39
- description: 'How to use relations for behavior-driven animation',
66
+ name: '🔄 Animation Guide',
67
+ description: 'Animate with relations: orbit, follow, attached, bounce, and more',
40
68
  mimeType: 'text/markdown',
41
69
  },
42
70
  {
43
71
  uri: 'pinepaper://docs/generators',
44
- name: 'Background Generators',
45
- description: 'Available procedural background generators',
72
+ name: '🎨 Backgrounds Guide',
73
+ description: 'Create procedural backgrounds: 14 generators including sunburst, grid, waves, bokeh, gradient mesh, wind field, noise textures',
46
74
  mimeType: 'text/markdown',
47
75
  },
48
76
  {
49
- uri: 'pinepaper://docs/custom-paths',
50
- name: 'Custom Paths Guide',
51
- description: 'Advanced path creation with SVG, Paper.js paths, and animations',
77
+ uri: 'pinepaper://docs/effects-and-filters',
78
+ name: '✨ Effects Guide',
79
+ description: 'Add visual effects: sparkle, blast, filters, and post-processing',
52
80
  mimeType: 'text/markdown',
53
81
  },
54
82
  {
55
- uri: 'pinepaper://docs/mathematical-patterns',
56
- name: 'Mathematical Patterns',
57
- description: 'Create spirals, waves, fractals, geometric patterns, and physics simulations',
83
+ uri: 'pinepaper://docs/customization',
84
+ name: '🔧 Customization Guide',
85
+ description: 'How to adapt templates, create custom designs, and handle any user request',
58
86
  mimeType: 'text/markdown',
59
87
  },
88
+ // === EXAMPLES (Copy-paste workflows) ===
60
89
  {
61
- uri: 'pinepaper://docs/effects-and-filters',
62
- name: 'Effects & Filters Guide',
63
- description: 'Complete reference for visual effects, filters, and post-processing',
90
+ uri: 'pinepaper://examples/us-states-animated',
91
+ name: '🇺🇸 US States Animated',
92
+ description: 'EXAMPLE: Create a US map with random colors that animate in a loop',
64
93
  mimeType: 'text/markdown',
65
94
  },
66
95
  {
67
- uri: 'pinepaper://docs/interactive-animations',
68
- name: 'Interactive Animations',
69
- description: 'Create game-like behaviors with follows, bounds, and dynamic interactions',
96
+ uri: 'pinepaper://examples/world-population-map',
97
+ name: '🌍 World Population Map',
98
+ description: 'EXAMPLE: Choropleth map with population data and color scale',
70
99
  mimeType: 'text/markdown',
71
100
  },
72
101
  {
73
- uri: 'pinepaper://docs/paperjs-in-pinepaper',
74
- name: 'Paper.js in PinePaper',
75
- description: 'Write Paper.js code directly in PinePaper - API reference and examples',
102
+ uri: 'pinepaper://examples/flowchart',
103
+ name: '📋 Flowchart Example',
104
+ description: 'EXAMPLE: Create a decision flowchart with auto-layout',
76
105
  mimeType: 'text/markdown',
77
106
  },
78
107
  {
79
108
  uri: 'pinepaper://examples/solar-system',
80
- name: 'Solar System Example',
81
- description: 'Create an animated solar system with custom paths, orbital rings, and planetary details',
109
+ name: '🪐 Solar System',
110
+ description: 'EXAMPLE: Orbiting planets with relations',
82
111
  mimeType: 'text/markdown',
83
112
  },
84
113
  {
85
- uri: 'pinepaper://examples/logo-animation',
86
- name: 'Logo Animation Example',
87
- description: 'Animate a company logo with entrance effects and continuous motion',
114
+ uri: 'pinepaper://examples/reveal-animation',
115
+ name: '🎬 Reveal Animation',
116
+ description: 'EXAMPLE: Text reveal with mask animations',
88
117
  mimeType: 'text/markdown',
89
118
  },
90
119
  {
91
- uri: 'pinepaper://examples/data-visualization',
92
- name: 'Data Visualization Example',
93
- description: 'Create animated charts, graphs, and infographics',
120
+ uri: 'pinepaper://docs/fonts',
121
+ name: 'Guide: Font Studio',
122
+ description: 'Create custom hand-drawn fonts with Font Studio tools',
94
123
  mimeType: 'text/markdown',
95
124
  },
125
+ // === ADVANCED (For developers) ===
96
126
  {
97
- uri: 'pinepaper://examples/particle-systems',
98
- name: 'Particle Systems Example',
99
- description: 'Build particle effects like fireworks, snow, and starfields',
127
+ uri: 'pinepaper://docs/custom-paths',
128
+ name: 'Advanced: Custom Paths',
129
+ description: 'SVG paths, Paper.js paths, and path animations',
130
+ mimeType: 'text/markdown',
131
+ },
132
+ {
133
+ uri: 'pinepaper://docs/paperjs-in-pinepaper',
134
+ name: 'Advanced: Paper.js API',
135
+ description: 'Write Paper.js code directly for full control',
100
136
  mimeType: 'text/markdown',
101
137
  },
102
138
  ];
@@ -105,70 +141,457 @@ const RESOURCE_CONTENTS = {
105
141
 
106
142
  ## Overview
107
143
 
108
- PinePaper is a canvas-based animation tool. This MCP server lets you create and animate graphics using natural language.
144
+ PinePaper is a canvas-based animation tool with 121 tools for creating animated graphics, custom fonts, maps, diagrams, and more. This guide helps you find the right tools.
109
145
 
110
- ## Quick Start
146
+ ## FIRST: Check Templates
111
147
 
112
- 1. **Connect to browser**: Use \`pinepaper_browser_connect\` to launch PinePaper Studio
113
- 2. **Clear the canvas**: Use \`pinepaper_clear_canvas\` or \`pinepaper_refresh_page\` to start fresh
114
- 3. **Create items**: Use \`pinepaper_create_item\` to add text, shapes, or graphics
115
- 4. **Add animation**: Use \`pinepaper_add_relation\` for behavior-based animation
116
- 5. **Verify**: Use \`pinepaper_browser_screenshot\` to see your work
117
- 6. **Export**: Use \`pinepaper_export_svg\` to save your work
148
+ PinePaper Studio includes pre-built templates for common use cases. **Templates already have animations configured** - you just change the content!
118
149
 
119
- ## IMPORTANT: Welcome Template
150
+ **Before building from scratch, consider:**
151
+ - Is there a template that matches this use case?
152
+ - Can I modify an existing template instead of building new?
153
+ - Templates save time: just update text, colors, or data
154
+
155
+ **Use \`pinepaper_create_scene\` for complex animated scenes** - it's 4-8x faster than individual tool calls:
156
+
157
+ \`\`\`
158
+ pinepaper_create_scene
159
+ backgroundColor: "#0a0a0a"
160
+ items:
161
+ - name: "sun", itemType: "circle", position: {x: 400, y: 300}, properties: {radius: 50, color: "#fbbf24"}
162
+ - name: "earth", itemType: "circle", position: {x: 550, y: 300}, properties: {radius: 20, color: "#3b82f6"}
163
+ relations:
164
+ - source: "earth", target: "sun", type: "orbits", params: {radius: 150, speed: 0.5}
165
+ animations:
166
+ - target: "sun", type: "pulse", speed: 0.3
167
+ \`\`\`
168
+
169
+ ## Tool Categories at a Glance
170
+
171
+ | Category | Use When | Key Tools |
172
+ |----------|----------|-----------|
173
+ | **Scenes** | Multi-item animated scenes | \`pinepaper_create_scene\` (FASTEST) |
174
+ | **Maps** | US states, world maps, choropleth | \`pinepaper_load_map\`, \`pinepaper_apply_data_colors\`, \`pinepaper_animate_map_regions\` |
175
+ | **Shapes** | Circles, stars, text, rectangles | \`pinepaper_create_item\` |
176
+ | **Animation** | Orbiting, following, pulsing | \`pinepaper_add_relation\`, \`pinepaper_animate\` |
177
+ | **Masks** | Reveal effects, wipes, transitions | \`pinepaper_apply_animated_mask\` |
178
+ | **Diagrams** | Flowcharts, UML, connections | \`pinepaper_create_diagram_shape\`, \`pinepaper_connect\` |
179
+ | **Backgrounds** | Patterns, gradients, generators | \`pinepaper_execute_generator\` |
180
+
181
+ ## Quick Examples
182
+
183
+ ### Create a US Map with Animated Colors
184
+ \`\`\`
185
+ 1. pinepaper_load_map mapId: "usa", options: { projection: "albers" }
186
+ 2. pinepaper_apply_data_colors data: { "CA": 100, "TX": 80, "NY": 70 }, options: { colorScale: "blues" }
187
+ 3. pinepaper_animate_map_wave duration: 10, loop: true, colors: ["#ef4444", "#22c55e", "#3b82f6"]
188
+ \`\`\`
189
+
190
+ ### Create Orbiting Animation (Using create_scene - Recommended)
191
+ \`\`\`
192
+ pinepaper_create_scene
193
+ items:
194
+ - name: "sun", itemType: "circle", position: {x: 400, y: 300}, properties: {radius: 50, color: "#fbbf24"}
195
+ - name: "planet", itemType: "circle", position: {x: 550, y: 300}, properties: {radius: 15, color: "#3b82f6"}
196
+ relations:
197
+ - source: "planet", target: "sun", type: "orbits"
198
+ \`\`\`
199
+
200
+ ### Create Reveal Animation
201
+ \`\`\`
202
+ 1. pinepaper_create_item type: "text", params: { x: 400, y: 300, content: "Hello", fontSize: 48 }
203
+ 2. pinepaper_apply_animated_mask itemId: "item_1", preset: "wipeLeft", options: { duration: 0.5 }
204
+ \`\`\`
205
+
206
+ ## Quick Start
207
+
208
+ Agent mode connects automatically on first tool call. Just start creating!
120
209
 
121
- First-time visitors to PinePaper Studio see a **welcome template** with example items on the canvas. Before creating your own content:
210
+ 1. **Check templates first** - existing designs just need content changes
211
+ 2. **Use \`pinepaper_create_scene\`** for multi-item animated scenes (fastest)
212
+ 3. **Or create items individually**: \`pinepaper_create_item\` for shapes/text
213
+ 4. **Add animation**: \`pinepaper_add_relation\` for behavior-based animation
214
+ 5. **Verify**: \`pinepaper_browser_screenshot\` to see your work
215
+ 6. **Export**: \`pinepaper_export_svg\` to save
122
216
 
123
- ### To Clear the Welcome Template:
124
- - **Option 1**: Use \`pinepaper_clear_canvas\` to remove all items
125
- - **Option 2**: Use \`pinepaper_refresh_page\` to reload the page (most reliable)
126
- - After clearing, verify with \`pinepaper_get_items\` that the canvas is empty
217
+ ## IMPORTANT: Welcome Template
127
218
 
128
- The welcome template only appears once. After refreshing or clearing, it won't appear again.
219
+ First-time visitors see a welcome template. Clear it with:
220
+ - \`pinepaper_clear_canvas\` - removes all items
221
+ - \`pinepaper_agent_reset\` - quick reset
129
222
 
130
223
  ## Key Concepts
131
224
 
132
225
  ### Items
133
- Everything on the canvas is an item with a registry ID (e.g., "item_1"). Use this ID to reference items in other operations.
134
-
135
- **Creating Items:**
136
- - Use \`pinepaper_create_item\` with \`itemType\` (text, circle, star, rectangle, etc.)
137
- - Specify \`position\` as {x, y} coordinates
138
- - Add \`properties\` for styling (color, fontSize, radius, etc.)
139
-
140
- ### Relations (Primary Animation Method)
141
- Relations describe HOW items behave relative to each other. This is the **recommended way** to create animations:
142
- - \`orbits\`: Circular motion around another item
143
- - \`follows\`: Move toward another item with smoothing
144
- - \`attached_to\`: Fixed offset from parent item
145
- - \`points_at\`: Rotate to face another item
146
- - \`maintains_distance\`: Keep fixed distance from target
147
-
148
- **Verifying Animations:**
149
- After adding a relation, use \`pinepaper_browser_screenshot\` to verify the animation is working. Check that:
150
- 1. Items are positioned correctly
151
- 2. Animation is visibly moving (take multiple screenshots at intervals)
152
- 3. The relation appears in \`pinepaper_query_relations\`
153
-
154
- ### Deleting Items
155
- - Use \`pinepaper_delete_item\` with the item's registry ID
156
- - Use \`pinepaper_get_items\` first to find item IDs
157
- - If deletion fails, try \`pinepaper_clear_canvas\` to remove everything
158
-
159
- ### Generators
160
- Procedural backgrounds like sunburst, waves, grid patterns.
161
-
162
- ## Example Workflow
163
-
164
- \`\`\`
165
- 1. Connect: pinepaper_browser_connect
166
- 2. Clear canvas: pinepaper_clear_canvas (removes welcome template)
167
- 3. Verify empty: pinepaper_get_items (should return count: 0)
168
- 4. Create sun: pinepaper_create_item type=circle, color=#fbbf24, radius=60
169
- 5. Create earth: pinepaper_create_item type=circle, color=#3b82f6, radius=20
170
- 6. Add orbit: pinepaper_add_relation earth orbits sun, radius=150
171
- 7. Screenshot: pinepaper_browser_screenshot (verify animation)
226
+ Everything on canvas has a registry ID (e.g., "item_1"). Use this ID for animations and modifications.
227
+
228
+ ### Relations (Animation)
229
+ Describe behavior between items:
230
+ - \`orbits\`: Circular motion around target
231
+ - \`follows\`: Move toward target with smoothing
232
+ - \`attached_to\`: Fixed offset from parent
233
+ - \`points_at\`: Rotate to face target
234
+
235
+ ### Maps
236
+ Built-in maps: \`world\`, \`worldHighRes\`, \`usa\` (US states)
237
+ Load with \`pinepaper_load_map\`, animate with \`pinepaper_animate_map_regions\` or \`pinepaper_animate_map_wave\`
238
+
239
+ ### Masks
240
+ Reveal effects: wipeLeft, wipeRight, wipeUp, wipeDown, iris, irisOut, star, heart, curtainHorizontal, curtainVertical, cinematic, diagonalWipe, revealUp, revealDown
241
+ Apply with \`pinepaper_apply_animated_mask\`
242
+
243
+ ## Agent Workflow (Recommended)
244
+
245
+ For AI agents, use the batch pipeline for maximum efficiency:
246
+
247
+ 1. \`pinepaper_agent_start_job\` — clear canvas, set preset → returns canvasSize {width, height} for positioning
248
+ 2. \`pinepaper_agent_batch_execute\` — ONE call with ALL operations (12 types: canvas, background, generators, items, animations, keyframes, relations, masks, effects, playback)
249
+ 3. \`pinepaper_agent_end_job\` — returns screenshot for user validation
250
+ 4. User reviews → modify specific items or start new job
251
+
252
+ See the \`pinepaper_agent_batch_execute\` tool description for full operation reference.
253
+
254
+ **Note:** Diagrams (flowcharts, UML) use their own tools — \`pinepaper_create_diagram_shape\` + \`pinepaper_connect\` — not batch_execute. See \`pinepaper://docs/diagrams\`.
255
+
256
+ ## Detailed Guides
257
+
258
+ - Maps: Read \`pinepaper://docs/map-tools\`
259
+ - Diagrams: Read \`pinepaper://docs/diagrams\`
260
+ - Masks: Read \`pinepaper://docs/masks\`
261
+ - Relations: Read \`pinepaper://docs/relations\`
262
+ - Generators: Read \`pinepaper://docs/generators\`
263
+ - Fonts: Read \`pinepaper://docs/fonts\`
264
+ - Customization: Read \`pinepaper://docs/customization\`
265
+ `,
266
+ 'pinepaper://docs/customization': `# Customization Guide
267
+
268
+ **Intent:** Learn how to handle any user design request by combining tools, adapting templates, and creating custom solutions.
269
+
270
+ ## Understanding User Requests
271
+
272
+ Users will ask for varied graphics. Here's how to approach any request:
273
+
274
+ ### Step 1: Identify the Category
275
+
276
+ | Request Type | Primary Tools | Example |
277
+ |-------------|---------------|---------|
278
+ | Map visualization | \`load_map\`, \`apply_data_colors\` | "Show sales by state" |
279
+ | Animated logo | \`create_item\`, \`add_relation\` | "Make my logo pulse" |
280
+ | Infographic | \`create_diagram_shape\`, \`connect\` | "Create a flowchart" |
281
+ | Social media | \`set_canvas_size\`, \`create_item\` | "Instagram post" |
282
+ | Data chart | \`create_item\` (rectangles for bars) | "Bar chart of values" |
283
+ | Reveal/intro | \`apply_animated_mask\` | "Text wipe animation" |
284
+
285
+ ### Step 2: Choose Your Approach
286
+
287
+ | Complexity | Approach | When |
288
+ |------------|----------|------|
289
+ | Simple | Single tools | One shape, one animation |
290
+ | Medium | \`create_scene\` | Multiple items with relations |
291
+ | Complex | Step-by-step tools | Custom logic, conditional design |
292
+
293
+ ## Customization Patterns
294
+
295
+ ### Pattern 1: Color Scheme Changes
296
+
297
+ User: "Make it blue instead of red"
298
+
299
+ \`\`\`
300
+ // Original
301
+ pinepaper_create_item itemType: "circle" properties: {color: "#ef4444"}
302
+
303
+ // Customized - change color property
304
+ pinepaper_create_item itemType: "circle" properties: {color: "#3b82f6"}
305
+ \`\`\`
306
+
307
+ **Common color palettes:**
308
+ | Theme | Colors |
309
+ |-------|--------|
310
+ | Professional | #1e293b, #3b82f6, #f8fafc |
311
+ | Vibrant | #ef4444, #fbbf24, #22c55e, #3b82f6 |
312
+ | Pastel | #fecaca, #fef08a, #bbf7d0, #bfdbfe |
313
+ | Dark mode | #0f172a, #1e293b, #334155, #f8fafc |
314
+
315
+ ### Pattern 2: Size and Position Adjustments
316
+
317
+ User: "Make it bigger" or "Center it"
318
+
319
+ \`\`\`
320
+ // Get canvas size first
321
+ pinepaper_get_canvas_size → {width: 800, height: 600}
322
+
323
+ // Center position = (width/2, height/2)
324
+ pinepaper_create_item itemType: "text" position: {x: 400, y: 300}
325
+ properties: {content: "Centered", fontSize: 48}
326
+
327
+ // Make bigger - increase radius, fontSize, width/height
328
+ pinepaper_modify_item itemId: "item_1" properties: {scale: 1.5}
329
+ \`\`\`
330
+
331
+ ### Pattern 3: Animation Speed/Style Changes
332
+
333
+ User: "Make it faster" or "Smoother animation"
334
+
335
+ \`\`\`
336
+ // Faster orbit
337
+ pinepaper_add_relation sourceId: "item_1" targetId: "item_2" relationType: "orbits"
338
+ params: {speed: 2.0} // Higher = faster
339
+
340
+ // Smoother following
341
+ pinepaper_add_relation sourceId: "item_1" targetId: "item_2" relationType: "follows"
342
+ params: {smoothing: 0.95} // Higher = smoother (0-1)
343
+
344
+ // Different easing for masks
345
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeLeft"
346
+ options: {easing: "easeInOut"} // linear, easeIn, easeOut, easeInOut, bounce
347
+ \`\`\`
348
+
349
+ ### Pattern 4: Adding Text to Any Design
350
+
351
+ User: "Add a title" or "Label the items"
352
+
353
+ \`\`\`
354
+ // Title at top
355
+ pinepaper_create_item itemType: "text" position: {x: 400, y: 50}
356
+ properties: {content: "My Title", fontSize: 36, fontWeight: "bold", color: "#ffffff"}
357
+
358
+ // Label attached to item (moves with it)
359
+ pinepaper_create_item itemType: "text" position: {x: 400, y: 280}
360
+ properties: {content: "Earth", fontSize: 14, color: "#94a3b8"}
361
+ → label_1
362
+
363
+ pinepaper_add_relation sourceId: "label_1" targetId: "earth" relationType: "attached_to"
364
+ params: {offset: [0, -30]} // Above the item
365
+ \`\`\`
366
+
367
+ ### Pattern 5: Creating Data-Driven Graphics
368
+
369
+ User: "Show these numbers as a chart"
370
+
371
+ \`\`\`
372
+ // Bar chart from data
373
+ // Data: [10, 25, 15, 30, 20]
374
+
375
+ // Bar 1 (height proportional to value)
376
+ pinepaper_create_item itemType: "rectangle" position: {x: 150, y: 350}
377
+ properties: {width: 40, height: 100, color: "#3b82f6"} // height = value * scale
378
+
379
+ // Bar 2
380
+ pinepaper_create_item itemType: "rectangle" position: {x: 210, y: 275}
381
+ properties: {width: 40, height: 250, color: "#3b82f6"}
382
+
383
+ // Continue for each data point...
384
+ // Position x increases by spacing, height = value * multiplier
385
+ \`\`\`
386
+
387
+ ### Pattern 6: Responsive Canvas Sizes
388
+
389
+ User: "Make it for Instagram" or "YouTube thumbnail"
390
+
391
+ \`\`\`
392
+ // Set canvas FIRST, then position items relative to it
393
+ pinepaper_set_canvas_size preset: "instagram-post" // 1080x1080
394
+
395
+ // Now center = (540, 540)
396
+ pinepaper_create_item itemType: "text" position: {x: 540, y: 540}
397
+ properties: {content: "Centered!", fontSize: 64}
398
+ \`\`\`
399
+
400
+ **Common presets:**
401
+ | Preset | Size | Use |
402
+ |--------|------|-----|
403
+ | instagram-post | 1080x1080 | Square posts |
404
+ | instagram-story | 1080x1920 | Stories, Reels |
405
+ | youtube-thumbnail | 1280x720 | Video thumbnails |
406
+ | twitter-post | 1200x675 | Twitter/X images |
407
+
408
+ ### Pattern 7: Complex Animations with Multiple Relations
409
+
410
+ User: "Make planets orbit the sun with moons"
411
+
412
+ \`\`\`
413
+ pinepaper_create_scene
414
+ backgroundColor: "#0a0a0a"
415
+ items:
416
+ - name: "sun", itemType: "circle", position: {x: 400, y: 300}
417
+ properties: {radius: 50, color: "#fbbf24"}
418
+ - name: "earth", itemType: "circle", position: {x: 550, y: 300}
419
+ properties: {radius: 20, color: "#3b82f6"}
420
+ - name: "moon", itemType: "circle", position: {x: 580, y: 300}
421
+ properties: {radius: 6, color: "#9ca3af"}
422
+ - name: "mars", itemType: "circle", position: {x: 650, y: 300}
423
+ properties: {radius: 15, color: "#ef4444"}
424
+ relations:
425
+ - source: "earth", target: "sun", type: "orbits", params: {radius: 150, speed: 0.5}
426
+ - source: "moon", target: "earth", type: "orbits", params: {radius: 30, speed: 2}
427
+ - source: "mars", target: "sun", type: "orbits", params: {radius: 250, speed: 0.3}
428
+ animations:
429
+ - target: "sun", type: "pulse", speed: 0.3
430
+ \`\`\`
431
+
432
+ ## Handling Edge Cases
433
+
434
+ ### User Provides Specific Colors
435
+ Always use their exact hex codes:
436
+ \`\`\`
437
+ User: "Use #FF5733 for the background"
438
+ → properties: {color: "#FF5733"}
439
+ \`\`\`
440
+
441
+ ### User Wants Something Not Directly Supported
442
+ Combine tools creatively:
443
+ \`\`\`
444
+ User: "3D cube effect"
445
+ → Create 3 parallelograms with offset positions and colors
446
+ Use paths with segments to draw isometric shapes
447
+ \`\`\`
448
+
449
+ ### User Changes Mind Mid-Design
450
+ Use modify and delete:
451
+ \`\`\`
452
+ pinepaper_modify_item itemId: "item_1" properties: {color: "#new_color"}
453
+ pinepaper_delete_item itemId: "item_2"
454
+ \`\`\`
455
+
456
+ ### Performance with Many Items
457
+ Use batch operations:
458
+ \`\`\`
459
+ pinepaper_batch_create items: [{...}, {...}, {...}] // Instead of multiple create_item calls
460
+ \`\`\`
461
+
462
+ ## Decision Tree for Any Request
463
+
464
+ \`\`\`
465
+ Is it a MAP? → pinepaper_load_map
466
+ Is it a DIAGRAM/FLOWCHART? → pinepaper_create_diagram_shape + pinepaper_connect
467
+ Is it ANIMATED? → pinepaper_add_relation or pinepaper_animate
468
+ Is it a REVEAL/INTRO? → pinepaper_apply_animated_mask
469
+ Is it DATA VISUALIZATION? → Create shapes proportional to data values
470
+ Is it a BACKGROUND? → pinepaper_execute_generator
471
+ Otherwise → pinepaper_create_item for shapes/text
472
+ \`\`\`
473
+
474
+ ## Example: Complete Custom Request
475
+
476
+ User: "Create an animated infographic showing 3 steps with arrows"
477
+
478
+ \`\`\`
479
+ // 1. Set canvas
480
+ pinepaper_set_canvas_size preset: "presentation-16x9"
481
+
482
+ // 2. Create step boxes
483
+ pinepaper_create_diagram_shape shapeType: "process" position: {x: 300, y: 400}
484
+ label: "Step 1: Research" style: {fillColor: "#3b82f6"} → item_1
485
+
486
+ pinepaper_create_diagram_shape shapeType: "process" position: {x: 600, y: 400}
487
+ label: "Step 2: Design" style: {fillColor: "#8b5cf6"} → item_2
488
+
489
+ pinepaper_create_diagram_shape shapeType: "process" position: {x: 900, y: 400}
490
+ label: "Step 3: Build" style: {fillColor: "#22c55e"} → item_3
491
+
492
+ // 3. Connect with arrows
493
+ pinepaper_connect sourceItemId: "item_1" targetItemId: "item_2"
494
+ routing: "direct" animated: true
495
+
496
+ pinepaper_connect sourceItemId: "item_2" targetItemId: "item_3"
497
+ routing: "direct" animated: true
498
+
499
+ // 4. Add title
500
+ pinepaper_create_item itemType: "text" position: {x: 600, y: 150}
501
+ properties: {content: "Our Process", fontSize: 48, fontWeight: "bold"}
502
+
503
+ // 5. Apply reveal animations
504
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeLeft"
505
+ options: {startTime: 0, duration: 0.4}
506
+
507
+ pinepaper_apply_animated_mask itemId: "item_2" preset: "wipeLeft"
508
+ options: {startTime: 0.3, duration: 0.4}
509
+
510
+ pinepaper_apply_animated_mask itemId: "item_3" preset: "wipeLeft"
511
+ options: {startTime: 0.6, duration: 0.4}
512
+ \`\`\`
513
+
514
+ ## Key Principles
515
+
516
+ 1. **Understand first** - What is the user trying to achieve?
517
+ 2. **Start simple** - Use the most direct tool for the job
518
+ 3. **Build incrementally** - Add complexity one step at a time
519
+ 4. **Verify with screenshots** - \`pinepaper_browser_screenshot\` after each major step
520
+ 5. **Offer alternatives** - If something can't be done exactly, suggest similar approaches
521
+ `,
522
+ 'pinepaper://docs/templates': `# Templates & Timed Animation Guide
523
+
524
+ ## Apply a Template
525
+
526
+ \`pinepaper_list_templates\` — browse available pre-built templates.
527
+ \`pinepaper_apply_template\` — load a template by name. Animations are pre-configured.
528
+ After applying: modify text/colors with \`pinepaper_modify_item\`, then export.
529
+
530
+ ## Template Categories
531
+
532
+ | Category | Examples |
533
+ |----------|----------|
534
+ | Map | US Election, World Data, Travel Route |
535
+ | Animation | Solar System, Logo Reveal, Text Intro, Particle Burst |
536
+ | Diagram | Flowchart, Org Chart, Network |
537
+ | Social Media | YouTube Thumbnail (1280x720), Instagram Story (1080x1920), TikTok |
538
+
539
+ ## Modifying Templates
540
+
541
+ Change safely: \`properties.content\`, \`properties.color\`, \`backgroundColor\`, positions, sizes.
542
+ Preserve: \`relations\` array, \`animations\` array, item \`name\` values (relations reference these).
543
+
544
+ ## Building Timed Animations (4 steps)
545
+
546
+ For invitations, intros, promos, reveals — any timed animation:
547
+
548
+ **1. Create items** — \`pinepaper_create_scene\` with all items. Timed reveals: set \`opacity: 0\`.
549
+ Items get sequential IDs: first = \`item_1\`, second = \`item_2\`, etc.
550
+
551
+ **2. Animate items** — ONE \`pinepaper_execute_custom_code\` call with all animations:
552
+ \`\`\`
553
+ app.addAnimation(registryId, keyframes, options)
554
+ registryId: 'item_1'
555
+ keyframes: [{time: 0, properties: {opacity: 0}, easing: 'easeInOut'},
556
+ {time: 1, properties: {opacity: 1}}]
557
+ options: {duration: number, loop?: boolean, pingPong?: boolean}
558
+ \`\`\`
559
+ Animatable properties: \`opacity\`, \`scale\`, \`scaleX\`, \`scaleY\`, \`x\`, \`y\`, \`rotation\`, \`fillColor\`, \`strokeColor\`, \`fontSize\`.
560
+ Stagger items by offsetting \`time\` values across items.
561
+
562
+ **3. Play** — \`pinepaper_play_timeline\`
563
+
564
+ **4. Export** — \`pinepaper_agent_export\` (SVG/PNG/GIF/MP4/WebM/PDF)
565
+
566
+ ## Text Reveal Pattern
567
+
568
+ Create text items, then apply mask reveals with staggered start times:
569
+ \`\`\`
570
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeLeft" options: {duration: 0.5}
571
+ pinepaper_apply_animated_mask itemId: "item_2" preset: "wipeLeft" options: {startTime: 0.3, duration: 0.5}
572
+ \`\`\`
573
+ Mask presets: wipeLeft, wipeRight, wipeUp, wipeDown, iris, irisOut, star, heart, curtainHorizontal, curtainVertical, cinematic, diagonalWipe, revealUp, revealDown.
574
+
575
+ ## Advanced Capabilities (via execute_custom_code)
576
+
577
+ **Time-scoped relations** — relation active only during a time window:
578
+ \`\`\`
579
+ app.addRelation(sourceId, targetId, type, {startTime: 2, endTime: 5, autoRemove: true, ...params})
580
+ \`\`\`
581
+
582
+ **Keyframe priority** — when keyframes and relations target the same property:
583
+ \`\`\`
584
+ app.addRelation(sourceId, targetId, type, {relationBehavior: 'keyframeFirst', ...params})
585
+ \`\`\`
586
+
587
+ **Per-item timing** — offset an item into the global timeline:
588
+ \`\`\`
589
+ app.setTimeOffset(registryId, offsetSeconds)
590
+ \`\`\`
591
+
592
+ **Atomic relation replace** — swap relation params without remove+add:
593
+ \`\`\`
594
+ app.replaceRelation(sourceId, targetId, type, newParams)
172
595
  \`\`\`
173
596
  `,
174
597
  'pinepaper://docs/relations': `# Relations Guide
@@ -226,6 +649,101 @@ Stay within target's bounds.
226
649
  - \`padding\`: Inner padding
227
650
  - \`bounce\`: Bounce off edges
228
651
 
652
+ ### morphs_to
653
+ Smoothly transform source shape into target shape over time.
654
+ - \`duration\`: Morph duration in seconds (default: 1)
655
+ - \`hideTarget\`: Hide target item since it's just a shape reference (default: true)
656
+ - \`removeTargetOnComplete\`: Delete target after morph completes (default: false)
657
+ - \`easing\`: Timing function ('linear', 'easeIn', 'easeOut', 'easeInOut')
658
+
659
+ **Usage patterns:**
660
+ \`\`\`
661
+ // Default: Circle morphs to star's shape, star stays hidden
662
+ pinepaper_add_relation sourceId: "circle" targetId: "star" relationType: "morphs_to"
663
+ params: {duration: 1}
664
+
665
+ // Clean up: Delete star after morph completes
666
+ pinepaper_add_relation sourceId: "circle" targetId: "star" relationType: "morphs_to"
667
+ params: {duration: 1, removeTargetOnComplete: true}
668
+
669
+ // Both visible: Keep star visible (you'll see two stars at end)
670
+ pinepaper_add_relation sourceId: "circle" targetId: "star" relationType: "morphs_to"
671
+ params: {duration: 1, hideTarget: false}
672
+ \`\`\`
673
+
674
+ **Great for:** Logo animations, shape transitions, loading indicators, morphing icons
675
+
676
+ ### camera_follows
677
+ Camera pans to follow a target item (like Manim MovingCameraScene).
678
+ - \`smoothing\`: 0-1 (higher = smoother following)
679
+ - \`offset\`: [x, y] offset from target
680
+ - \`zoom\`: Zoom level to maintain
681
+ - \`deadzone\`: Pixels before camera starts moving
682
+ - \`bounds\`: {minX, maxX, minY, maxY} camera movement limits
683
+
684
+ \`\`\`
685
+ // Camera follows the player character
686
+ pinepaper_add_relation sourceId: "camera" targetId: "player" relationType: "camera_follows"
687
+ params: {smoothing: 0.9, zoom: 1.5, deadzone: 50}
688
+ \`\`\`
689
+
690
+ **Great for:** Game-like scenes, following animations, focus tracking
691
+
692
+ ### camera_animates
693
+ Keyframe-based camera zoom and pan animations. Use the special "camera" virtual item.
694
+ - \`keyframes\`: Array of keyframe objects with time, zoom, center, easing
695
+ - \`duration\`: Total animation duration in seconds
696
+ - \`loop\`: Whether to loop the animation
697
+ - \`delay\`: Delay before starting
698
+
699
+ **Keyframe properties:**
700
+ - \`time\`: Normalized time 0-1
701
+ - \`zoom\`: Zoom level (1 = normal, 2 = 2x zoom in)
702
+ - \`center\`: [x, y] pan center position
703
+ - \`easing\`: Easing function for this keyframe
704
+
705
+ \`\`\`
706
+ // Cinematic zoom and pan sequence
707
+ pinepaper_add_relation sourceId: "camera" targetId: "camera" relationType: "camera_animates"
708
+ params:
709
+ duration: 5
710
+ loop: false
711
+ keyframes:
712
+ - time: 0, zoom: 1, center: [400, 300], easing: "easeOut"
713
+ - time: 0.3, zoom: 1.5, center: [200, 200], easing: "easeInOut"
714
+ - time: 0.7, zoom: 2, center: [600, 400], easing: "easeInOut"
715
+ - time: 1, zoom: 1, center: [400, 300], easing: "easeIn"
716
+ \`\`\`
717
+
718
+ **Great for:** Cinematic intros, presentations, dramatic reveals, tour animations
719
+
720
+ ## Camera API (Direct Code)
721
+
722
+ For simpler camera control, use the \`app.camera\` helper API:
723
+
724
+ \`\`\`javascript
725
+ // Zoom
726
+ app.camera.zoomIn(1.5, 0.5); // Zoom to 1.5x over 0.5 seconds
727
+ app.camera.zoomOut(0.5, 0.5); // Zoom out to 0.5x
728
+
729
+ // Pan
730
+ app.camera.panTo(200, 300, 1); // Pan to coordinates
731
+ app.camera.panBy(100, 0, 0.5); // Pan right by 100px
732
+ app.camera.panLeft(50, 0.3); // Pan left
733
+ app.camera.panRight(50, 0.3); // Pan right
734
+ app.camera.panUp(50, 0.3); // Pan up
735
+ app.camera.panDown(50, 0.3); // Pan down
736
+
737
+ // Combined
738
+ app.camera.moveTo(200, 300, 2, 1); // Pan to (200,300) and zoom to 2x
739
+
740
+ // Control
741
+ app.camera.reset(0.5); // Reset to default
742
+ app.camera.stop(); // Stop current animation
743
+ app.camera.getState(); // Returns { zoom, center: [x, y] }
744
+ app.camera.isAnimating(); // Check if animating
745
+ \`\`\`
746
+
229
747
  ## Verifying Animations Are Working
230
748
 
231
749
  After adding a relation, **always verify** that the animation is actually running:
@@ -268,44 +786,136 @@ addRelation(label, planet, 'attached_to', { offset: [0, -30] })
268
786
 
269
787
  The label will follow the planet as it orbits the star!
270
788
  `,
271
- 'pinepaper://docs/generators': `# Background Generators
789
+ 'pinepaper://docs/generators': `# Background Generators Guide
790
+
791
+ **Intent:** Create procedural backgrounds with 14 generators covering patterns, effects, organic flows, particles, and textures.
272
792
 
273
- Procedural backgrounds that create dynamic patterns.
793
+ ## Key Tool
274
794
 
275
- ## Available Generators
795
+ \`\`\`
796
+ pinepaper_execute_generator
797
+ generatorName: "drawSunburst"
798
+ params: { rayCount: 16, colors: ["#fbbf24", "#f59e0b"], animated: true }
799
+ \`\`\`
800
+
801
+ ## Classic Generators (7)
276
802
 
277
803
  ### drawSunburst
278
- Radial rays from center.
279
- - \`rayCount\`: Number of rays (default: 16)
280
- - \`colors\`: Array of ray colors
281
- - \`bgColor\`: Background color
282
- - \`animated\`: Enable rotation
804
+ Radial rays from center — energy, attention-grabbing backgrounds.
805
+ - **Core:** rayCount (16), colors, bgColor, animated
806
+ - **Enhanced:** opacity, rayGap (degrees between rays), gradientRays (radial gradient per ray)
283
807
 
284
808
  ### drawSunsetScene
285
- Animated sunset with clouds.
286
- - \`sunColor\`: Sun fill color
287
- - \`skyColors\`: Array for gradient
288
- - \`cloudCount\`: Number of clouds
809
+ Animated sunset with clouds — calm, atmospheric.
810
+ - **Core:** sunColor, skyColors, cloudCount
811
+ - **Enhanced:** skyOpacity, starCount, starColor, reflectionEnabled, reflectionOpacity
289
812
 
290
813
  ### drawGrid
291
- Geometric grid patterns.
292
- - \`gridType\`: 'lines', 'dots', or 'squares'
293
- - \`spacing\`: Cell size
294
- - \`lineColor\`: Grid color
814
+ Lines, dots, or squares — clean, technical, modern.
815
+ - **Core:** gridType (lines|dots|squares), spacing (40), lineColor, bgColor, lineWidth
816
+ - **Enhanced:** opacity, gap (pixel gap), randomRotation, colorMode (checkerboard|gradient|random|rows|columns), strokeColor, strokeWidth
295
817
 
296
818
  ### drawWaves
297
- Layered wave pattern.
298
- - \`waveCount\`: Number of layers
299
- - \`colors\`: Wave colors
300
- - \`amplitude\`: Wave height
301
- - \`animated\`: Animate waves
819
+ Layered wave pattern — organic, flowing.
820
+ - **Core:** waveCount (5), colors, amplitude (50), frequency (2), bgColor, animated
821
+ - **Enhanced:** opacity, fill (fill between waves), fillOpacity, amplitudeVariation, blendMode
302
822
 
303
823
  ### drawCircuit
304
- Tech circuit board.
305
- - \`lineColor\`: Circuit lines
306
- - \`nodeColor\`: Junction color
307
- - \`density\`: 0-1 complexity
308
- - \`animated\`: Enable bolt effect
824
+ Circuit board pattern — futuristic, digital.
825
+ - **Core:** lineColor, nodeColor, bgColor, density (0-1), animated, boltColor
826
+ - **Enhanced:** traceOpacity, nodeOpacity, diagonalPaths (45-degree traces), chipDensity (auto|none|low|medium|high)
827
+
828
+ ### drawStackedCircles
829
+ Overlapping circles with distribution algorithms.
830
+ - **Core:** count (8), colors, distribution (random|poisson|golden)
831
+ - **Enhanced:** opacityMin/opacityMax, blendMode, strokeWidth, strokeColor, sizeGradient, animationType (pulse|float|none)
832
+
833
+ ### drawPattern
834
+ Geometric shapes in orbit rings.
835
+ - **Core:** patternType, size, color, bgColor
836
+ - **Enhanced:** opacity, blendMode, layers (1-5 concentric rings), layerScaleDecay
837
+
838
+ ## New Generators (7)
839
+
840
+ ### drawBokeh (effects)
841
+ Soft-focus circles — dreamy, photographic depth-of-field.
842
+ \`\`\`
843
+ params: { count: 30, colors: ["#f472b6", "#818cf8", "#34d399"], bgColor: "#0f172a",
844
+ shadowBlur: 20, distribution: "poisson", driftAnimation: true }
845
+ \`\`\`
846
+
847
+ ### drawGradientMesh (organic)
848
+ Radial gradient blobs with screen blending — modern, vibrant.
849
+ \`\`\`
850
+ params: { colors: ["#ec4899", "#8b5cf6", "#06b6d4"], blobCount: 5,
851
+ blendMode: "screen", drift: true }
852
+ \`\`\`
853
+
854
+ ### drawGeometricAbstract (geometric)
855
+ Mixed translucent shapes with blend modes — artistic, contemporary.
856
+ \`\`\`
857
+ params: { colors: ["#f43f5e", "#3b82f6", "#10b981"], shapeCount: 12,
858
+ blendMode: "multiply", rotation: true }
859
+ \`\`\`
860
+
861
+ ### drawWindField (particles)
862
+ Directional wind particles with noise turbulence — weather, motion.
863
+ \`\`\`
864
+ params: { particleCount: 200, colors: ["#e0f2fe", "#bae6fd"], direction: 45,
865
+ turbulence: 0.5, trailLength: 30, speed: 1.5 }
866
+ \`\`\`
867
+
868
+ ### drawFluidFlow (organic)
869
+ Sinusoidal stream paths with depth layering — liquid, flowing.
870
+ \`\`\`
871
+ params: { streamCount: 8, colors: ["#67e8f9", "#a78bfa", "#f9a8d4"],
872
+ depthLayers: 3, speed: 0.8 }
873
+ \`\`\`
874
+
875
+ ### drawOrganicFlow (organic)
876
+ Aurora/silk layers — natural, ethereal glow.
877
+ \`\`\`
878
+ params: { layerCount: 4, colors: ["#34d399", "#6ee7b7", "#a7f3d0"],
879
+ blendMode: "screen", fillToBottom: true, animated: true }
880
+ \`\`\`
881
+
882
+ ### drawNoiseTexture (textures)
883
+ Perlin/grain/stipple noise — subtle, textured.
884
+ \`\`\`
885
+ params: { noiseType: "perlin", colors: ["#94a3b8", "#64748b"],
886
+ scale: 0.01, density: 0.7, animated: true }
887
+ \`\`\`
888
+ noiseType options: perlin, grain, stipple
889
+
890
+ ## Quick Mood Guide
891
+
892
+ | Mood | Generators |
893
+ |------|-----------|
894
+ | Dreamy/soft | drawBokeh, drawGradientMesh, drawOrganicFlow |
895
+ | Techy/modern | drawCircuit, drawGrid, drawWindField |
896
+ | Nature/warm | drawSunsetScene, drawSunburst, drawWaves |
897
+ | Abstract | drawGeometricAbstract, drawFluidFlow, drawNoiseTexture |
898
+ | Decorative | drawPattern, drawStackedCircles |
899
+
900
+ ## Combining Generators with Items
901
+
902
+ \`\`\`
903
+ // Background + content on top
904
+ pinepaper_execute_generator
905
+ generatorName: "drawBokeh"
906
+ params: {count: 20, colors: ["#f472b6", "#818cf8"], shadowBlur: 25}
907
+
908
+ pinepaper_create_item itemType: "text" position: {x: 400, y: 300}
909
+ properties: {content: "Welcome", fontSize: 72, color: "#ffffff"}
910
+ \`\`\`
911
+
912
+ ## Best Practices
913
+
914
+ 1. **Call generator first** — before creating items
915
+ 2. **Use complementary colors** — items should contrast with background
916
+ 3. **Consider animation performance** — animated generators + many animated items can slow down
917
+ 4. **Match themes** — sunburst for energy, waves for calm, circuit for tech, bokeh for elegance, noise for texture
918
+ 5. **Use blendMode** — "screen" brightens, "multiply" darkens, great for layered effects
309
919
  `,
310
920
  'pinepaper://docs/custom-paths': `# Custom Paths Guide
311
921
 
@@ -593,8 +1203,7 @@ Create an animated solar system featuring custom paths, orbital rings, and plane
593
1203
  ## Step 1: Canvas Setup
594
1204
 
595
1205
  \`\`\`
596
- pinepaper_browser_connect
597
- pinepaper_clear_canvas
1206
+ pinepaper_clear_canvas # Browser auto-connects in agent mode
598
1207
  pinepaper_set_background_color color: "#0a0a1a"
599
1208
  \`\`\`
600
1209
 
@@ -2341,8 +2950,7 @@ An animated company logo featuring:
2341
2950
  ## Step 1: Canvas Setup
2342
2951
 
2343
2952
  \`\`\`
2344
- pinepaper_browser_connect
2345
- pinepaper_clear_canvas
2953
+ pinepaper_clear_canvas # Browser auto-connects in agent mode
2346
2954
  pinepaper_set_background_color color: "#0f172a"
2347
2955
  pinepaper_set_canvas_size width: 800 height: 600
2348
2956
  \`\`\`
@@ -2581,8 +3189,7 @@ Create animated charts and infographics that bring data to life.
2581
3189
 
2582
3190
  ### Step 1: Setup
2583
3191
  \`\`\`
2584
- pinepaper_browser_connect
2585
- pinepaper_clear_canvas
3192
+ pinepaper_clear_canvas # Browser auto-connects in agent mode
2586
3193
  pinepaper_set_background_color color: "#1f2937"
2587
3194
  \`\`\`
2588
3195
 
@@ -2903,8 +3510,7 @@ Build dynamic particle effects like fireworks, starfields, snow, and fire.
2903
3510
 
2904
3511
  ### Step 1: Create Background
2905
3512
  \`\`\`
2906
- pinepaper_browser_connect
2907
- pinepaper_clear_canvas
3513
+ pinepaper_clear_canvas # Browser auto-connects in agent mode
2908
3514
  pinepaper_set_background_color color: "#000011"
2909
3515
  \`\`\`
2910
3516
 
@@ -3183,29 +3789,1995 @@ pinepaper_animate_item itemId: "bubble4" animationType: "wobble" speed: 0.7
3183
3789
  | Dust | Tiny circles, slow fade, random positions |
3184
3790
  | Confetti | Small rectangles, rotate + bounce, rainbow colors |
3185
3791
  `,
3186
- };
3187
- // =============================================================================
3188
- // SERVER CREATION
3189
- // =============================================================================
3190
- export async function createServer(options = {}) {
3191
- // Initialize i18n with specified locale
3192
- const locale = options.locale || detectLocaleFromEnvironment();
3193
- const i18n = await initI18n(locale);
3194
- const server = new Server(SERVER_INFO, {
3195
- capabilities: {
3196
- tools: {},
3197
- resources: {},
3198
- },
3199
- });
3200
- // ---------------------------------------------------------------------------
3201
- // TOOL HANDLERS
3792
+ 'pinepaper://docs/map-tools': `# Map Tools Guide
3793
+
3794
+ Create geographic visualizations with world maps, choropleth coloring, markers, and labels.
3795
+
3796
+ ## Available Maps
3797
+
3798
+ | Map | Description | Region ID Format |
3799
+ |-----|-------------|------------------|
3800
+ | \`world\` | World countries (110m) | Full names: "United States of America", "France" |
3801
+ | \`worldHighRes\` | World countries (50m, detailed) | Full names |
3802
+ | \`usa\` | US states | State codes: "CA", "TX", "NY" |
3803
+
3804
+ ## Projections
3805
+
3806
+ | Projection | Best For |
3807
+ |------------|----------|
3808
+ | \`naturalEarth\` | World maps (recommended) |
3809
+ | \`mercator\` | Web-style maps |
3810
+ | \`equalEarth\` | Equal-area comparisons |
3811
+ | \`orthographic\` | Globe/3D sphere view |
3812
+ | \`albers\` | USA maps (recommended) |
3813
+ | \`stereographic\` | Polar regions |
3814
+
3815
+ ## Loading Maps
3816
+
3817
+ \`\`\`
3818
+ // Load world map with Natural Earth projection
3819
+ pinepaper_load_map mapId: "world"
3820
+ options:
3821
+ projection: "naturalEarth"
3822
+ quality: "balanced"
3823
+ fillColor: "#e5e7eb"
3824
+ strokeColor: "#9ca3af"
3825
+ enableHover: true
3826
+
3827
+ // Load USA with Albers projection
3828
+ pinepaper_load_map mapId: "usa"
3829
+ options:
3830
+ projection: "albers"
3831
+ quality: "professional"
3832
+ \`\`\`
3833
+
3834
+ ## Highlighting Regions
3835
+
3836
+ \`\`\`
3837
+ // Highlight countries (use full names for world map)
3838
+ pinepaper_highlight_regions
3839
+ regionIds: ["United States of America", "Canada", "Mexico"]
3840
+ options:
3841
+ fillColor: "#3b82f6"
3842
+ strokeColor: "#1d4ed8"
3843
+ animate: true
3844
+
3845
+ // Highlight US states (use state codes)
3846
+ pinepaper_highlight_regions
3847
+ regionIds: ["CA", "TX", "NY", "FL"]
3848
+ options:
3849
+ fillColor: "#22c55e"
3850
+
3851
+ // Remove highlights
3852
+ pinepaper_unhighlight_regions regionIds: "all"
3853
+ \`\`\`
3854
+
3855
+ ## Choropleth (Data-Driven Colors)
3856
+
3857
+ \`\`\`
3858
+ // Population data visualization
3859
+ pinepaper_apply_data_colors
3860
+ data:
3861
+ "California": 39538223
3862
+ "Texas": 29145505
3863
+ "Florida": 21538187
3864
+ "New York": 20201249
3865
+ options:
3866
+ colorScale: "blues"
3867
+ showLegend: true
3868
+ legendPosition: "bottom-right"
3869
+ legendTitle: "Population"
3870
+ \`\`\`
3871
+
3872
+ ### Color Scales
3873
+ - \`blues\` - Light to dark blue
3874
+ - \`greens\` - Light to dark green
3875
+ - \`reds\` - Light to dark red
3876
+ - \`oranges\` - Light to dark orange
3877
+ - \`purples\` - Light to dark purple
3878
+ - \`heat\` - Yellow to red heat map
3879
+
3880
+ ## Map Markers
3881
+
3882
+ \`\`\`
3883
+ // Add marker at coordinates
3884
+ pinepaper_add_marker
3885
+ lat: 37.7749
3886
+ lon: -122.4194
3887
+ label: "San Francisco"
3888
+ color: "#ef4444"
3889
+ size: 8
3890
+ pulse: true
3891
+
3892
+ // Add marker with different shape
3893
+ pinepaper_add_marker
3894
+ lat: 40.7128
3895
+ lon: -74.0060
3896
+ label: "New York"
3897
+ shape: "pin"
3898
+ \`\`\`
3899
+
3900
+ ### Marker Shapes
3901
+ - \`circle\` - Simple circle (default)
3902
+ - \`pin\` - Map pin icon
3903
+ - \`star\` - Star shape
3904
+
3905
+ ## Map Labels
3906
+
3907
+ \`\`\`
3908
+ // Add labels to all visible regions
3909
+ pinepaper_add_map_labels
3910
+ options:
3911
+ fontSize: 10
3912
+ fontColor: "#374151"
3913
+ labelType: "name"
3914
+
3915
+ // Add labels to specific regions
3916
+ pinepaper_add_map_labels
3917
+ regions: ["California", "Texas"]
3918
+ options:
3919
+ labelType: "code"
3920
+ \`\`\`
3921
+
3922
+ ### Label Types
3923
+ - \`name\` - Full region name
3924
+ - \`code\` - Region code (e.g., "CA")
3925
+ - \`value\` - Data value (after applyDataColors)
3926
+
3927
+ ## Map Navigation
3928
+
3929
+ \`\`\`
3930
+ // Pan to coordinates
3931
+ pinepaper_pan_map lat: 50 lon: 10 animate: true duration: 1
3932
+
3933
+ // Zoom in
3934
+ pinepaper_zoom_map level: 2 animate: true
3935
+ \`\`\`
3936
+
3937
+ ## Importing Custom Maps
3938
+
3939
+ \`\`\`
3940
+ // Import from URL
3941
+ pinepaper_import_custom_map
3942
+ url: "https://example.com/custom-boundaries.geojson"
3943
+ options:
3944
+ projection: "mercator"
3945
+
3946
+ // Import GeoJSON directly
3947
+ pinepaper_import_custom_map
3948
+ geoJson: { "type": "FeatureCollection", "features": [...] }
3949
+ options:
3950
+ projection: "naturalEarth"
3951
+ \`\`\`
3952
+
3953
+ ## Example: US Population Map
3954
+
3955
+ \`\`\`
3956
+ // 1. Load USA map
3957
+ pinepaper_load_map mapId: "usa"
3958
+ options:
3959
+ projection: "albers"
3960
+ quality: "professional"
3961
+ fillColor: "#e5e7eb"
3962
+ strokeColor: "#9ca3af"
3963
+ strokeWidth: 0.5
3964
+ enableHover: true
3965
+
3966
+ // 2. Apply population data
3967
+ pinepaper_apply_data_colors
3968
+ data:
3969
+ "CA": 39538223
3970
+ "TX": 29145505
3971
+ "FL": 21538187
3972
+ "NY": 20201249
3973
+ "PA": 13002700
3974
+ "IL": 12812508
3975
+ "OH": 11799448
3976
+ "GA": 10711908
3977
+ options:
3978
+ colorScale: "blues"
3979
+ showLegend: true
3980
+ legendTitle: "Population"
3981
+
3982
+ // 3. Add major city markers
3983
+ pinepaper_add_marker lat: 34.0522 lon: -118.2437 label: "Los Angeles" pulse: true
3984
+ pinepaper_add_marker lat: 40.7128 lon: -74.0060 label: "New York" pulse: true
3985
+ pinepaper_add_marker lat: 41.8781 lon: -87.6298 label: "Chicago" pulse: true
3986
+
3987
+ // 4. Export final map
3988
+ pinepaper_export_map
3989
+ \`\`\`
3990
+
3991
+ ## Example: World Comparison
3992
+
3993
+ \`\`\`
3994
+ // 1. Load world map
3995
+ pinepaper_load_map mapId: "worldHighRes"
3996
+ options:
3997
+ projection: "naturalEarth"
3998
+ quality: "balanced"
3999
+ fillColor: "#f3f4f6"
4000
+ strokeColor: "#d1d5db"
4001
+
4002
+ // 2. Highlight regions of interest
4003
+ pinepaper_highlight_regions
4004
+ regionIds: ["United States of America", "China", "Japan", "Germany", "United Kingdom"]
4005
+ options:
4006
+ fillColor: "#3b82f6"
4007
+ animate: true
4008
+
4009
+ // 3. Add capital markers
4010
+ pinepaper_add_marker lat: 38.9072 lon: -77.0369 label: "Washington DC"
4011
+ pinepaper_add_marker lat: 39.9042 lon: 116.4074 label: "Beijing"
4012
+ pinepaper_add_marker lat: 35.6762 lon: 139.6503 label: "Tokyo"
4013
+ pinepaper_add_marker lat: 52.5200 lon: 13.4050 label: "Berlin"
4014
+ pinepaper_add_marker lat: 51.5074 lon: -0.1278 label: "London"
4015
+ \`\`\`
4016
+
4017
+ ## Hit Testing
4018
+
4019
+ \`\`\`
4020
+ // Find region at canvas coordinates
4021
+ pinepaper_get_region_at_point x: 400 y: 300
4022
+ // Returns: { regionId, regionName, properties }
4023
+ \`\`\`
4024
+
4025
+ ## Region Animations
4026
+
4027
+ Animate map regions with keyframe-based color transitions:
4028
+
4029
+ \`\`\`
4030
+ // Animate specific regions with keyframes
4031
+ pinepaper_animate_map_regions
4032
+ duration: 8
4033
+ loop: true
4034
+ regions:
4035
+ "USA":
4036
+ - time: 0, fillColor: "#ef4444"
4037
+ - time: 4, fillColor: "#22c55e"
4038
+ - time: 8, fillColor: "#ef4444"
4039
+ "France":
4040
+ - time: 0, fillColor: "#3b82f6"
4041
+ - time: 8, fillColor: "#fbbf24"
4042
+
4043
+ // Wave animation across all regions
4044
+ pinepaper_animate_map_wave
4045
+ duration: 10
4046
+ loop: true
4047
+ colors: ["#ef4444", "#fbbf24", "#22c55e", "#3b82f6"]
4048
+ waveDirection: "horizontal"
4049
+
4050
+ // Stop animations
4051
+ pinepaper_stop_map_animations
4052
+ pinepaper_stop_map_animations regions: ["USA", "France"] resetColors: true
4053
+
4054
+ // Query animated regions
4055
+ pinepaper_get_animated_map_regions
4056
+ \`\`\`
4057
+
4058
+ ## CSV Export & Import
4059
+
4060
+ Export and import map state via CSV for data-driven workflows:
4061
+
4062
+ \`\`\`
4063
+ // Export region data as CSV
4064
+ pinepaper_export_map_region_csv
4065
+ includeHighlighted: true
4066
+ includeColors: true
4067
+ download: true
4068
+ filename: "map-export.csv"
4069
+
4070
+ // Import CSV to update regions
4071
+ pinepaper_import_map_region_csv
4072
+ csvText: "regionId,fillColor,highlighted\\nUSA,#22c55e,1\\nFrance,#3b82f6,0"
4073
+ applyColors: true
4074
+ applyHighlight: true
4075
+ \`\`\`
4076
+
4077
+ ## Programmatic Selection
4078
+
4079
+ Control region selection programmatically:
4080
+
4081
+ \`\`\`
4082
+ // Select regions
4083
+ pinepaper_select_map_regions regionIds: ["USA", "Canada", "Mexico"]
4084
+
4085
+ // Deselect specific regions
4086
+ pinepaper_deselect_map_regions regionIds: ["USA"]
4087
+
4088
+ // Deselect all
4089
+ pinepaper_deselect_map_regions
4090
+
4091
+ // Query highlighted regions
4092
+ pinepaper_get_highlighted_map_regions
4093
+ \`\`\`
4094
+ `,
4095
+ 'pinepaper://examples/world-population-map': `# World Population Map Example
4096
+
4097
+ Create an animated choropleth map showing world population data with country highlights and major city markers.
4098
+
4099
+ ## Final Result
4100
+
4101
+ A beautiful world map showing population density by color intensity, with pulsing markers on major capitals.
4102
+
4103
+ ---
4104
+
4105
+ ## Step 1: Set Up Canvas and Background
4106
+
4107
+ \`\`\`
4108
+ // Set dark background for contrast
4109
+ pinepaper_set_background_color color: "#1a1a2e"
4110
+
4111
+ // Set canvas size for presentation
4112
+ pinepaper_set_canvas_size preset: "presentation-16x9"
4113
+ \`\`\`
4114
+
4115
+ ---
4116
+
4117
+ ## Step 2: Load World Map
4118
+
4119
+ \`\`\`
4120
+ pinepaper_load_map mapId: "worldHighRes"
4121
+ options:
4122
+ projection: "naturalEarth"
4123
+ quality: "professional"
4124
+ fillColor: "#374151"
4125
+ strokeColor: "#4b5563"
4126
+ strokeWidth: 0.3
4127
+ enableHover: true
4128
+ hoverFill: "#6b7280"
4129
+ \`\`\`
4130
+
4131
+ ---
4132
+
4133
+ ## Step 3: Apply Population Data (Choropleth)
4134
+
4135
+ \`\`\`
4136
+ pinepaper_apply_data_colors
4137
+ data:
4138
+ "China": 1412
4139
+ "India": 1408
4140
+ "United States of America": 332
4141
+ "Indonesia": 276
4142
+ "Pakistan": 229
4143
+ "Brazil": 215
4144
+ "Nigeria": 218
4145
+ "Bangladesh": 169
4146
+ "Russia": 144
4147
+ "Mexico": 130
4148
+ "Japan": 125
4149
+ "Ethiopia": 120
4150
+ "Philippines": 113
4151
+ "Egypt": 104
4152
+ "Vietnam": 99
4153
+ "Germany": 84
4154
+ "Turkey": 85
4155
+ "Iran": 87
4156
+ "Thailand": 70
4157
+ "United Kingdom": 67
4158
+ "France": 68
4159
+ "Italy": 59
4160
+ "South Africa": 60
4161
+ "Tanzania": 63
4162
+ "Kenya": 54
4163
+ "South Korea": 52
4164
+ "Colombia": 51
4165
+ "Spain": 47
4166
+ "Argentina": 46
4167
+ "Algeria": 45
4168
+ "Sudan": 45
4169
+ "Ukraine": 41
4170
+ "Iraq": 42
4171
+ "Poland": 38
4172
+ "Canada": 38
4173
+ "Morocco": 37
4174
+ "Saudi Arabia": 35
4175
+ "Peru": 33
4176
+ "Malaysia": 33
4177
+ "Australia": 26
4178
+ options:
4179
+ colorScale: "blues"
4180
+ showLegend: true
4181
+ legendPosition: "bottom-right"
4182
+ legendTitle: "Population (millions)"
4183
+ \`\`\`
4184
+
4185
+ ---
4186
+
4187
+ ## Step 4: Highlight Top 5 Countries
4188
+
4189
+ \`\`\`
4190
+ pinepaper_highlight_regions
4191
+ regionIds: ["China", "India", "United States of America", "Indonesia", "Pakistan"]
4192
+ options:
4193
+ strokeColor: "#fbbf24"
4194
+ strokeWidth: 2
4195
+ animate: true
4196
+ \`\`\`
4197
+
4198
+ ---
4199
+
4200
+ ## Step 5: Add Capital City Markers
4201
+
4202
+ \`\`\`
4203
+ // Beijing - China
4204
+ pinepaper_add_marker lat: 39.9042 lon: 116.4074
4205
+ label: "Beijing"
4206
+ color: "#ef4444"
4207
+ size: 10
4208
+ pulse: true
4209
+
4210
+ // New Delhi - India
4211
+ pinepaper_add_marker lat: 28.6139 lon: 77.2090
4212
+ label: "New Delhi"
4213
+ color: "#ef4444"
4214
+ size: 10
4215
+ pulse: true
4216
+
4217
+ // Washington DC - USA
4218
+ pinepaper_add_marker lat: 38.9072 lon: -77.0369
4219
+ label: "Washington DC"
4220
+ color: "#ef4444"
4221
+ size: 8
4222
+ pulse: true
4223
+
4224
+ // Jakarta - Indonesia
4225
+ pinepaper_add_marker lat: -6.2088 lon: 106.8456
4226
+ label: "Jakarta"
4227
+ color: "#f59e0b"
4228
+ size: 8
4229
+ pulse: true
4230
+
4231
+ // Islamabad - Pakistan
4232
+ pinepaper_add_marker lat: 33.6844 lon: 73.0479
4233
+ label: "Islamabad"
4234
+ color: "#f59e0b"
4235
+ size: 8
4236
+ pulse: true
4237
+ \`\`\`
4238
+
4239
+ ---
4240
+
4241
+ ## Step 6: Add Title
4242
+
4243
+ \`\`\`
4244
+ pinepaper_create_item itemType: "text"
4245
+ position: {x: 640, y: 50}
4246
+ properties:
4247
+ content: "World Population 2024"
4248
+ fontSize: 36
4249
+ fontFamily: "Inter, sans-serif"
4250
+ fontWeight: "bold"
4251
+ color: "#ffffff"
4252
+ \`\`\`
4253
+
4254
+ ---
4255
+
4256
+ ## Step 7: Export
4257
+
4258
+ \`\`\`
4259
+ pinepaper_export_svg
4260
+ pinepaper_export_map
4261
+ \`\`\`
4262
+
4263
+ ---
4264
+
4265
+ ## Variations
4266
+
4267
+ ### Heat Map Version
4268
+ \`\`\`
4269
+ pinepaper_apply_data_colors
4270
+ data: { ... }
4271
+ options:
4272
+ colorScale: "heat"
4273
+ showLegend: true
4274
+ \`\`\`
4275
+
4276
+ ### Regional Focus (Asia)
4277
+ \`\`\`
4278
+ pinepaper_pan_map lat: 35 lon: 100 animate: true duration: 2
4279
+ pinepaper_zoom_map level: 2.5 animate: true
4280
+ \`\`\`
4281
+ `,
4282
+ 'pinepaper://examples/us-election-map': `# US Election Map Example
4283
+
4284
+ Build an interactive US election results visualization with state-by-state coloring and key battleground state highlights.
4285
+
4286
+ ## Final Result
4287
+
4288
+ A classic red/blue election map with swing states highlighted and electoral vote counts.
4289
+
4290
+ ---
4291
+
4292
+ ## Step 1: Set Up Canvas
4293
+
4294
+ \`\`\`
4295
+ pinepaper_set_background_color color: "#f8fafc"
4296
+ pinepaper_set_canvas_size preset: "presentation-16x9"
4297
+ \`\`\`
4298
+
4299
+ ---
4300
+
4301
+ ## Step 2: Load USA Map
4302
+
4303
+ \`\`\`
4304
+ pinepaper_load_map mapId: "usa"
4305
+ options:
4306
+ projection: "albers"
4307
+ quality: "professional"
4308
+ fillColor: "#e2e8f0"
4309
+ strokeColor: "#94a3b8"
4310
+ strokeWidth: 1
4311
+ enableHover: true
4312
+ enableClick: true
4313
+ \`\`\`
4314
+
4315
+ ---
4316
+
4317
+ ## Step 3: Color Democratic States (Blue)
4318
+
4319
+ \`\`\`
4320
+ pinepaper_highlight_regions
4321
+ regionIds: ["CA", "WA", "OR", "NV", "CO", "NM", "MN", "IL", "VA", "MD", "DE", "NJ", "CT", "RI", "MA", "VT", "NH", "ME", "NY", "HI"]
4322
+ options:
4323
+ fillColor: "#2563eb"
4324
+ strokeColor: "#1d4ed8"
4325
+ \`\`\`
4326
+
4327
+ ---
4328
+
4329
+ ## Step 4: Color Republican States (Red)
4330
+
4331
+ \`\`\`
4332
+ pinepaper_highlight_regions
4333
+ regionIds: ["TX", "OK", "KS", "NE", "SD", "ND", "MT", "WY", "ID", "UT", "AZ", "AK", "MO", "AR", "LA", "MS", "AL", "TN", "KY", "WV", "IN", "OH", "SC", "FL"]
4334
+ options:
4335
+ fillColor: "#dc2626"
4336
+ strokeColor: "#b91c1c"
4337
+ \`\`\`
4338
+
4339
+ ---
4340
+
4341
+ ## Step 5: Highlight Swing States
4342
+
4343
+ \`\`\`
4344
+ // Key battleground states with gold border
4345
+ pinepaper_highlight_regions
4346
+ regionIds: ["PA", "MI", "WI", "GA", "NC", "AZ"]
4347
+ options:
4348
+ strokeColor: "#fbbf24"
4349
+ strokeWidth: 3
4350
+ animate: true
4351
+ \`\`\`
4352
+
4353
+ ---
4354
+
4355
+ ## Step 6: Add Electoral Vote Labels
4356
+
4357
+ \`\`\`
4358
+ // California - 54 votes
4359
+ pinepaper_add_marker lat: 36.7783 lon: -119.4179
4360
+ label: "54"
4361
+ color: "#2563eb"
4362
+ size: 12
4363
+
4364
+ // Texas - 40 votes
4365
+ pinepaper_add_marker lat: 31.9686 lon: -99.9018
4366
+ label: "40"
4367
+ color: "#dc2626"
4368
+ size: 12
4369
+
4370
+ // Florida - 30 votes
4371
+ pinepaper_add_marker lat: 27.6648 lon: -81.5158
4372
+ label: "30"
4373
+ color: "#dc2626"
4374
+ size: 10
4375
+
4376
+ // New York - 28 votes
4377
+ pinepaper_add_marker lat: 42.1657 lon: -74.9481
4378
+ label: "28"
4379
+ color: "#2563eb"
4380
+ size: 10
4381
+
4382
+ // Pennsylvania - 19 votes (swing)
4383
+ pinepaper_add_marker lat: 41.2033 lon: -77.1945
4384
+ label: "19"
4385
+ color: "#fbbf24"
4386
+ size: 10
4387
+ pulse: true
4388
+
4389
+ // Michigan - 15 votes (swing)
4390
+ pinepaper_add_marker lat: 44.3148 lon: -85.6024
4391
+ label: "15"
4392
+ color: "#fbbf24"
4393
+ size: 9
4394
+ pulse: true
4395
+
4396
+ // Georgia - 16 votes (swing)
4397
+ pinepaper_add_marker lat: 32.1656 lon: -82.9001
4398
+ label: "16"
4399
+ color: "#fbbf24"
4400
+ size: 9
4401
+ pulse: true
4402
+ \`\`\`
4403
+
4404
+ ---
4405
+
4406
+ ## Step 7: Add Title and Legend
4407
+
4408
+ \`\`\`
4409
+ // Title
4410
+ pinepaper_create_item itemType: "text"
4411
+ position: {x: 640, y: 40}
4412
+ properties:
4413
+ content: "US Presidential Election Results"
4414
+ fontSize: 32
4415
+ fontWeight: "bold"
4416
+ color: "#1e293b"
4417
+
4418
+ // Legend - Democratic
4419
+ pinepaper_create_item itemType: "rectangle"
4420
+ position: {x: 100, y: 550}
4421
+ properties:
4422
+ width: 20
4423
+ height: 20
4424
+ color: "#2563eb"
4425
+
4426
+ pinepaper_create_item itemType: "text"
4427
+ position: {x: 130, y: 550}
4428
+ properties:
4429
+ content: "Democratic"
4430
+ fontSize: 14
4431
+ color: "#1e293b"
4432
+
4433
+ // Legend - Republican
4434
+ pinepaper_create_item itemType: "rectangle"
4435
+ position: {x: 250, y: 550}
4436
+ properties:
4437
+ width: 20
4438
+ height: 20
4439
+ color: "#dc2626"
4440
+
4441
+ pinepaper_create_item itemType: "text"
4442
+ position: {x: 280, y: 550}
4443
+ properties:
4444
+ content: "Republican"
4445
+ fontSize: 14
4446
+ color: "#1e293b"
4447
+
4448
+ // Legend - Swing State
4449
+ pinepaper_create_item itemType: "rectangle"
4450
+ position: {x: 400, y: 550}
4451
+ properties:
4452
+ width: 20
4453
+ height: 20
4454
+ color: "#fbbf24"
4455
+
4456
+ pinepaper_create_item itemType: "text"
4457
+ position: {x: 430, y: 550}
4458
+ properties:
4459
+ content: "Swing State"
4460
+ fontSize: 14
4461
+ color: "#1e293b"
4462
+ \`\`\`
4463
+
4464
+ ---
4465
+
4466
+ ## Step 8: Add Vote Totals
4467
+
4468
+ \`\`\`
4469
+ // Electoral vote boxes
4470
+ pinepaper_create_item itemType: "rectangle"
4471
+ position: {x: 200, y: 100}
4472
+ properties:
4473
+ width: 150
4474
+ height: 80
4475
+ color: "#2563eb"
4476
+ cornerRadius: 8
4477
+
4478
+ pinepaper_create_item itemType: "text"
4479
+ position: {x: 200, y: 90}
4480
+ properties:
4481
+ content: "270"
4482
+ fontSize: 36
4483
+ fontWeight: "bold"
4484
+ color: "#ffffff"
4485
+
4486
+ pinepaper_create_item itemType: "text"
4487
+ position: {x: 200, y: 120}
4488
+ properties:
4489
+ content: "Electoral Votes"
4490
+ fontSize: 12
4491
+ color: "#bfdbfe"
4492
+
4493
+ // Republican votes
4494
+ pinepaper_create_item itemType: "rectangle"
4495
+ position: {x: 1080, y: 100}
4496
+ properties:
4497
+ width: 150
4498
+ height: 80
4499
+ color: "#dc2626"
4500
+ cornerRadius: 8
4501
+
4502
+ pinepaper_create_item itemType: "text"
4503
+ position: {x: 1080, y: 90}
4504
+ properties:
4505
+ content: "268"
4506
+ fontSize: 36
4507
+ fontWeight: "bold"
4508
+ color: "#ffffff"
4509
+
4510
+ pinepaper_create_item itemType: "text"
4511
+ position: {x: 1080, y: 120}
4512
+ properties:
4513
+ content: "Electoral Votes"
4514
+ fontSize: 12
4515
+ color: "#fecaca"
4516
+ \`\`\`
4517
+
4518
+ ---
4519
+
4520
+ ## Step 9: Export
4521
+
4522
+ \`\`\`
4523
+ pinepaper_export_svg
4524
+ \`\`\`
4525
+ `,
4526
+ 'pinepaper://examples/travel-route-map': `# Travel Route Map Example
4527
+
4528
+ Visualize a travel itinerary across Europe with city markers, connecting routes, and animated journey highlights.
4529
+
4530
+ ## Final Result
4531
+
4532
+ An elegant travel map showing a European tour with cities connected by animated paths.
4533
+
4534
+ ---
4535
+
4536
+ ## Step 1: Set Up Canvas
4537
+
4538
+ \`\`\`
4539
+ pinepaper_set_background_color color: "#0f172a"
4540
+ pinepaper_set_canvas_size preset: "presentation-16x9"
4541
+ \`\`\`
4542
+
4543
+ ---
4544
+
4545
+ ## Step 2: Load World Map (Focused on Europe)
4546
+
4547
+ \`\`\`
4548
+ pinepaper_load_map mapId: "worldHighRes"
4549
+ options:
4550
+ projection: "mercator"
4551
+ quality: "professional"
4552
+ fillColor: "#1e293b"
4553
+ strokeColor: "#334155"
4554
+ strokeWidth: 0.5
4555
+ center: [10, 50]
4556
+ enableHover: true
4557
+ \`\`\`
4558
+
4559
+ ---
4560
+
4561
+ ## Step 3: Zoom to Europe
4562
+
4563
+ \`\`\`
4564
+ pinepaper_pan_map lat: 48 lon: 10 animate: true duration: 1
4565
+ pinepaper_zoom_map level: 4 animate: true duration: 1
4566
+ \`\`\`
4567
+
4568
+ ---
4569
+
4570
+ ## Step 4: Highlight Countries on Itinerary
4571
+
4572
+ \`\`\`
4573
+ pinepaper_highlight_regions
4574
+ regionIds: ["United Kingdom", "France", "Germany", "Italy", "Spain"]
4575
+ options:
4576
+ fillColor: "#334155"
4577
+ strokeColor: "#60a5fa"
4578
+ strokeWidth: 1
4579
+ animate: true
4580
+ \`\`\`
4581
+
4582
+ ---
4583
+
4584
+ ## Step 5: Add City Markers (The Journey)
4585
+
4586
+ \`\`\`
4587
+ // Day 1-3: London
4588
+ pinepaper_add_marker lat: 51.5074 lon: -0.1278
4589
+ label: "London"
4590
+ color: "#f59e0b"
4591
+ size: 12
4592
+ shape: "pin"
4593
+ pulse: true
4594
+
4595
+ // Day 4-5: Paris
4596
+ pinepaper_add_marker lat: 48.8566 lon: 2.3522
4597
+ label: "Paris"
4598
+ color: "#f59e0b"
4599
+ size: 12
4600
+ shape: "pin"
4601
+ pulse: true
4602
+
4603
+ // Day 6-7: Berlin
4604
+ pinepaper_add_marker lat: 52.5200 lon: 13.4050
4605
+ label: "Berlin"
4606
+ color: "#f59e0b"
4607
+ size: 12
4608
+ shape: "pin"
4609
+ pulse: true
4610
+
4611
+ // Day 8-10: Rome
4612
+ pinepaper_add_marker lat: 41.9028 lon: 12.4964
4613
+ label: "Rome"
4614
+ color: "#f59e0b"
4615
+ size: 12
4616
+ shape: "pin"
4617
+ pulse: true
4618
+
4619
+ // Day 11-12: Barcelona
4620
+ pinepaper_add_marker lat: 41.3851 lon: 2.1734
4621
+ label: "Barcelona"
4622
+ color: "#f59e0b"
4623
+ size: 12
4624
+ shape: "pin"
4625
+ pulse: true
4626
+ \`\`\`
4627
+
4628
+ ---
4629
+
4630
+ ## Step 6: Draw Route Lines
4631
+
4632
+ \`\`\`
4633
+ // London to Paris
4634
+ pinepaper_create_item itemType: "line"
4635
+ properties:
4636
+ from: {x: 380, y: 180}
4637
+ to: {x: 420, y: 220}
4638
+ strokeColor: "#60a5fa"
4639
+ strokeWidth: 2
4640
+ dashArray: [5, 5]
4641
+ → route1
4642
+
4643
+ // Paris to Berlin
4644
+ pinepaper_create_item itemType: "line"
4645
+ properties:
4646
+ from: {x: 420, y: 220}
4647
+ to: {x: 520, y: 180}
4648
+ strokeColor: "#60a5fa"
4649
+ strokeWidth: 2
4650
+ dashArray: [5, 5]
4651
+ → route2
4652
+
4653
+ // Berlin to Rome
4654
+ pinepaper_create_item itemType: "line"
4655
+ properties:
4656
+ from: {x: 520, y: 180}
4657
+ to: {x: 500, y: 340}
4658
+ strokeColor: "#60a5fa"
4659
+ strokeWidth: 2
4660
+ dashArray: [5, 5]
4661
+ → route3
4662
+
4663
+ // Rome to Barcelona
4664
+ pinepaper_create_item itemType: "line"
4665
+ properties:
4666
+ from: {x: 500, y: 340}
4667
+ to: {x: 380, y: 330}
4668
+ strokeColor: "#60a5fa"
4669
+ strokeWidth: 2
4670
+ dashArray: [5, 5]
4671
+ → route4
4672
+ \`\`\`
4673
+
4674
+ ---
4675
+
4676
+ ## Step 7: Animate Routes
4677
+
4678
+ \`\`\`
4679
+ pinepaper_animate_item itemId: "route1" animationType: "pulse" speed: 2
4680
+ pinepaper_animate_item itemId: "route2" animationType: "pulse" speed: 2
4681
+ pinepaper_animate_item itemId: "route3" animationType: "pulse" speed: 2
4682
+ pinepaper_animate_item itemId: "route4" animationType: "pulse" speed: 2
4683
+ \`\`\`
4684
+
4685
+ ---
4686
+
4687
+ ## Step 8: Add Day Numbers
4688
+
4689
+ \`\`\`
4690
+ // London days
4691
+ pinepaper_create_item itemType: "text"
4692
+ position: {x: 360, y: 160}
4693
+ properties:
4694
+ content: "Days 1-3"
4695
+ fontSize: 10
4696
+ color: "#94a3b8"
4697
+
4698
+ // Paris days
4699
+ pinepaper_create_item itemType: "text"
4700
+ position: {x: 440, y: 235}
4701
+ properties:
4702
+ content: "Days 4-5"
4703
+ fontSize: 10
4704
+ color: "#94a3b8"
4705
+
4706
+ // Berlin days
4707
+ pinepaper_create_item itemType: "text"
4708
+ position: {x: 540, y: 165}
4709
+ properties:
4710
+ content: "Days 6-7"
4711
+ fontSize: 10
4712
+ color: "#94a3b8"
4713
+
4714
+ // Rome days
4715
+ pinepaper_create_item itemType: "text"
4716
+ position: {x: 520, y: 355}
4717
+ properties:
4718
+ content: "Days 8-10"
4719
+ fontSize: 10
4720
+ color: "#94a3b8"
4721
+
4722
+ // Barcelona days
4723
+ pinepaper_create_item itemType: "text"
4724
+ position: {x: 360, y: 345}
4725
+ properties:
4726
+ content: "Days 11-12"
4727
+ fontSize: 10
4728
+ color: "#94a3b8"
4729
+ \`\`\`
4730
+
4731
+ ---
4732
+
4733
+ ## Step 9: Add Title and Decorations
4734
+
4735
+ \`\`\`
4736
+ // Title
4737
+ pinepaper_create_item itemType: "text"
4738
+ position: {x: 640, y: 40}
4739
+ properties:
4740
+ content: "European Adventure 2024"
4741
+ fontSize: 28
4742
+ fontWeight: "bold"
4743
+ color: "#f8fafc"
4744
+
4745
+ // Subtitle
4746
+ pinepaper_create_item itemType: "text"
4747
+ position: {x: 640, y: 70}
4748
+ properties:
4749
+ content: "12 Days • 5 Cities • 1 Amazing Journey"
4750
+ fontSize: 14
4751
+ color: "#94a3b8"
4752
+
4753
+ // Airplane icon at start
4754
+ pinepaper_create_item itemType: "text"
4755
+ position: {x: 340, y: 180}
4756
+ properties:
4757
+ content: "✈️"
4758
+ fontSize: 20
4759
+ \`\`\`
4760
+
4761
+ ---
4762
+
4763
+ ## Step 10: Add Summary Box
4764
+
4765
+ \`\`\`
4766
+ // Summary background
4767
+ pinepaper_create_item itemType: "rectangle"
4768
+ position: {x: 1100, y: 300}
4769
+ properties:
4770
+ width: 180
4771
+ height: 200
4772
+ color: "#1e293b"
4773
+ cornerRadius: 12
4774
+ strokeColor: "#334155"
4775
+ strokeWidth: 1
4776
+
4777
+ // Summary title
4778
+ pinepaper_create_item itemType: "text"
4779
+ position: {x: 1100, y: 230}
4780
+ properties:
4781
+ content: "Trip Summary"
4782
+ fontSize: 14
4783
+ fontWeight: "bold"
4784
+ color: "#f8fafc"
4785
+
4786
+ // Stats
4787
+ pinepaper_create_item itemType: "text"
4788
+ position: {x: 1100, y: 260}
4789
+ properties:
4790
+ content: "📍 5 Cities"
4791
+ fontSize: 12
4792
+ color: "#94a3b8"
4793
+
4794
+ pinepaper_create_item itemType: "text"
4795
+ position: {x: 1100, y: 285}
4796
+ properties:
4797
+ content: "📅 12 Days"
4798
+ fontSize: 12
4799
+ color: "#94a3b8"
4800
+
4801
+ pinepaper_create_item itemType: "text"
4802
+ position: {x: 1100, y: 310}
4803
+ properties:
4804
+ content: "🛫 4 Flights"
4805
+ fontSize: 12
4806
+ color: "#94a3b8"
4807
+
4808
+ pinepaper_create_item itemType: "text"
4809
+ position: {x: 1100, y: 335}
4810
+ properties:
4811
+ content: "🏨 11 Nights"
4812
+ fontSize: 12
4813
+ color: "#94a3b8"
4814
+ \`\`\`
4815
+
4816
+ ---
4817
+
4818
+ ## Step 11: Export
4819
+
4820
+ \`\`\`
4821
+ pinepaper_export_svg
4822
+ \`\`\`
4823
+
4824
+ ---
4825
+
4826
+ ## Variations
4827
+
4828
+ ### Animated Route Reveal
4829
+ Use keyframe animations to reveal the route step by step:
4830
+ \`\`\`
4831
+ pinepaper_keyframe_animate itemId: "route1"
4832
+ keyframes:
4833
+ - time: 0, properties: {opacity: 0}
4834
+ - time: 1, properties: {opacity: 1}
4835
+
4836
+ pinepaper_keyframe_animate itemId: "route2"
4837
+ keyframes:
4838
+ - time: 1, properties: {opacity: 0}
4839
+ - time: 2, properties: {opacity: 1}
4840
+ \`\`\`
4841
+
4842
+ ### Distance Labels
4843
+ Add distance between cities:
4844
+ \`\`\`
4845
+ pinepaper_create_item itemType: "text"
4846
+ position: {x: 400, y: 200}
4847
+ properties:
4848
+ content: "344 km"
4849
+ fontSize: 8
4850
+ color: "#60a5fa"
4851
+ \`\`\`
4852
+ `,
4853
+ 'pinepaper://docs/diagrams': `# Diagrams Guide
4854
+
4855
+ **Intent:** Create flowcharts, UML diagrams, network architectures, and connect any visual elements with smart arrows.
4856
+
4857
+ ## When to Use Diagrams
4858
+
4859
+ Use diagram tools when you need to:
4860
+ - Build flowcharts with decision logic
4861
+ - Create UML diagrams (class, use case)
4862
+ - Design network/architecture diagrams
4863
+ - Connect any items (images, shapes, text) with arrows
4864
+ - Show process flows with animated connectors
4865
+
4866
+ ## Key Tools
4867
+
4868
+ | Tool | Purpose |
4869
+ |------|---------|
4870
+ | \`pinepaper_create_diagram_shape\` | Create flowchart/UML/network shapes |
4871
+ | \`pinepaper_connect\` | Connect items with smart arrows |
4872
+ | \`pinepaper_auto_layout\` | Automatically arrange connected shapes |
4873
+ | \`pinepaper_get_diagram_shapes\` | List available shape types |
4874
+ | \`pinepaper_diagram_mode\` | Enable/disable diagram editing mode |
4875
+
4876
+ ## Shape Types
4877
+
4878
+ ### Flowchart Shapes
4879
+ | Shape | Use For |
4880
+ |-------|---------|
4881
+ | \`process\` | Actions, steps (rectangle) |
4882
+ | \`decision\` | Yes/No branching (diamond) |
4883
+ | \`terminal\` | Start/End points (rounded) |
4884
+ | \`data\` | Input/Output (parallelogram) |
4885
+ | \`document\` | Documents (wavy bottom) |
4886
+ | \`database\` | Data storage (cylinder) |
4887
+ | \`preparation\` | Setup steps (hexagon) |
4888
+
4889
+ ### UML Shapes
4890
+ | Shape | Use For |
4891
+ |-------|---------|
4892
+ | \`uml-class\` | Class definitions |
4893
+ | \`uml-usecase\` | Use case ellipse |
4894
+ | \`uml-actor\` | Stick figure actor |
4895
+
4896
+ ### Network Shapes
4897
+ | Shape | Use For |
4898
+ |-------|---------|
4899
+ | \`cloud\` | Cloud services |
4900
+ | \`server\` | Server/computer |
4901
+
4902
+ ## Creating a Flowchart
4903
+
4904
+ \`\`\`
4905
+ // Step 1: Create shapes
4906
+ pinepaper_create_diagram_shape
4907
+ shapeType: "terminal"
4908
+ position: {x: 400, y: 100}
4909
+ label: "Start"
4910
+ style: {fillColor: "#22c55e"}
4911
+ → item_1
4912
+
4913
+ pinepaper_create_diagram_shape
4914
+ shapeType: "process"
4915
+ position: {x: 400, y: 200}
4916
+ label: "Process Data"
4917
+ → item_2
4918
+
4919
+ pinepaper_create_diagram_shape
4920
+ shapeType: "decision"
4921
+ position: {x: 400, y: 320}
4922
+ label: "Valid?"
4923
+ style: {fillColor: "#fbbf24"}
4924
+ → item_3
4925
+
4926
+ pinepaper_create_diagram_shape
4927
+ shapeType: "terminal"
4928
+ position: {x: 400, y: 440}
4929
+ label: "End"
4930
+ style: {fillColor: "#ef4444"}
4931
+ → item_4
4932
+
4933
+ // Step 2: Connect shapes
4934
+ pinepaper_connect
4935
+ sourceItemId: "item_1"
4936
+ targetItemId: "item_2"
4937
+ routing: "orthogonal"
4938
+
4939
+ pinepaper_connect
4940
+ sourceItemId: "item_2"
4941
+ targetItemId: "item_3"
4942
+
4943
+ pinepaper_connect
4944
+ sourceItemId: "item_3"
4945
+ targetItemId: "item_4"
4946
+ label: "Yes"
4947
+ \`\`\`
4948
+
4949
+ ## Connector Options
4950
+
4951
+ ### Routing Styles
4952
+ | Style | Description |
4953
+ |-------|-------------|
4954
+ | \`orthogonal\` | Right-angle paths (default, best for flowcharts) |
4955
+ | \`curved\` | Smooth curved paths |
4956
+ | \`direct\` | Straight line |
4957
+
4958
+ ### Arrow Styles
4959
+ | Style | Description |
4960
+ |-------|-------------|
4961
+ | \`classic\` | Standard arrow (default) |
4962
+ | \`stealth\` | Sleek pointed arrow |
4963
+ | \`sharp\` | Sharp angular arrow |
4964
+ | \`open\` | Outlined arrow |
4965
+ | \`diamond\` | Diamond shape |
4966
+ | \`circle\` | Circle endpoint |
4967
+ | \`none\` | No arrowhead |
4968
+
4969
+ ### Line Styles
4970
+ | Style | Description |
4971
+ |-------|-------------|
4972
+ | \`solid\` | Continuous line |
4973
+ | \`dashed\` | Dashed line |
4974
+ | \`dotted\` | Dotted line |
4975
+
4976
+ ## Connector Example
4977
+
4978
+ \`\`\`
4979
+ pinepaper_connect
4980
+ sourceItemId: "item_1"
4981
+ targetItemId: "item_2"
4982
+ routing: "curved"
4983
+ lineColor: "#3b82f6"
4984
+ lineWidth: 2
4985
+ lineStyle: "dashed"
4986
+ headStyle: "stealth"
4987
+ label: "Yes"
4988
+ animated: true // Bolt effect shows direction
4989
+ \`\`\`
4990
+
4991
+ ## Connecting Any Items
4992
+
4993
+ Diagram connectors work with ANY canvas items, not just diagram shapes:
4994
+
4995
+ \`\`\`
4996
+ // Connect images
4997
+ pinepaper_import_svg url: "https://example.com/icon1.svg" → item_1
4998
+ pinepaper_import_svg url: "https://example.com/icon2.svg" → item_2
4999
+ pinepaper_connect sourceItemId: "item_1" targetItemId: "item_2"
5000
+
5001
+ // Connect text labels
5002
+ pinepaper_create_item itemType: "text" properties: {content: "A"} → item_3
5003
+ pinepaper_create_item itemType: "text" properties: {content: "B"} → item_4
5004
+ pinepaper_connect sourceItemId: "item_3" targetItemId: "item_4"
5005
+ \`\`\`
5006
+
5007
+ ## Auto Layout
5008
+
5009
+ Automatically arrange connected shapes:
5010
+
5011
+ \`\`\`
5012
+ pinepaper_auto_layout
5013
+ direction: "TB" // TB, BT, LR, RL
5014
+ spacing: {horizontal: 80, vertical: 60}
5015
+ \`\`\`
5016
+
5017
+ | Direction | Description |
5018
+ |-----------|-------------|
5019
+ | \`TB\` | Top to Bottom |
5020
+ | \`BT\` | Bottom to Top |
5021
+ | \`LR\` | Left to Right |
5022
+ | \`RL\` | Right to Left |
5023
+ `,
5024
+ 'pinepaper://docs/masks': `# Masks Guide
5025
+
5026
+ **Intent:** Create reveal animations and transitions using animated clipping masks (wipes, iris, curtains, custom shapes).
5027
+
5028
+ ## When to Use Masks
5029
+
5030
+ Use mask tools when you need to:
5031
+ - Reveal text or images with wipe effects
5032
+ - Create iris/zoom reveal animations
5033
+ - Build curtain-style transitions
5034
+ - Design custom reveal sequences
5035
+ - Add cinematic letterbox effects
5036
+
5037
+ ## Key Tools
5038
+
5039
+ | Tool | Purpose |
5040
+ |------|---------|
5041
+ | \`pinepaper_apply_animated_mask\` | Apply reveal animation (preset or custom) |
5042
+ | \`pinepaper_apply_custom_mask\` | Full keyframe control |
5043
+ | \`pinepaper_remove_mask\` | Remove mask from item |
5044
+ | \`pinepaper_get_mask_animations\` | List available presets |
5045
+ | \`pinepaper_get_mask_types\` | List mask shapes |
5046
+ | \`pinepaper_get_animatable_properties\` | Get keyframeable properties |
5047
+ | \`pinepaper_get_available_easings\` | List easing functions |
5048
+
5049
+ ## Animation Presets
5050
+
5051
+ ### Wipe Effects
5052
+ | Preset | Effect |
5053
+ |--------|--------|
5054
+ | \`wipeLeft\` | Reveal from left to right |
5055
+ | \`wipeRight\` | Reveal from right to left |
5056
+ | \`wipeUp\` | Reveal from bottom to top |
5057
+ | \`wipeDown\` | Reveal from top to bottom |
5058
+ | \`diagonalWipe\` | Angled reveal from corner |
5059
+
5060
+ ### Iris Effects
5061
+ | Preset | Effect |
5062
+ |--------|--------|
5063
+ | \`iris\` | Circle expands from center |
5064
+ | \`irisOut\` | Circle shrinks to center (hide) |
5065
+
5066
+ ### Shape Reveals
5067
+ | Preset | Effect |
5068
+ |--------|--------|
5069
+ | \`star\` | Star shape scales up |
5070
+ | \`heart\` | Heart shape scales up |
5071
+
5072
+ ### Curtain Effects
5073
+ | Preset | Effect |
5074
+ |--------|--------|
5075
+ | \`curtainHorizontal\` | Opens from center horizontally |
5076
+ | \`curtainVertical\` | Opens from center vertically |
5077
+ | \`cinematic\` | Letterbox bars animate away |
5078
+
5079
+ ### Text Reveals
5080
+ | Preset | Effect |
5081
+ |--------|--------|
5082
+ | \`revealUp\` | Text slides up within mask |
5083
+ | \`revealDown\` | Text slides down within mask |
5084
+
5085
+ ## Quick Start: Preset Mode
5086
+
5087
+ \`\`\`
5088
+ // Create an item
5089
+ pinepaper_create_item
5090
+ itemType: "text"
5091
+ position: {x: 400, y: 300}
5092
+ properties: {content: "Hello World", fontSize: 48, color: "#ffffff"}
5093
+ → item_1
5094
+
5095
+ // Apply wipe reveal
5096
+ pinepaper_apply_animated_mask
5097
+ itemId: "item_1"
5098
+ preset: "wipeLeft"
5099
+ options:
5100
+ duration: 0.5
5101
+ easing: "easeOut"
5102
+ \`\`\`
5103
+
5104
+ ## Preset Options
5105
+
5106
+ | Option | Type | Default | Description |
5107
+ |--------|------|---------|-------------|
5108
+ | \`startTime\` | number | 0 | Delay before animation starts (seconds) |
5109
+ | \`duration\` | number | 0.8 | Animation duration (seconds) |
5110
+ | \`easing\` | string | "easeOut" | Timing function |
5111
+ | \`reversed\` | boolean | false | Play in reverse (hide instead of reveal) |
5112
+ | \`loop\` | boolean | false | Loop the animation |
5113
+
5114
+ ## Easing Functions
5115
+
5116
+ | Easing | Description |
5117
+ |--------|-------------|
5118
+ | \`linear\` | Constant speed |
5119
+ | \`easeIn\` | Slow start, fast end |
5120
+ | \`easeOut\` | Fast start, slow end |
5121
+ | \`easeInOut\` | Slow start and end |
5122
+ | \`bounce\` | Bouncing effect at end |
5123
+ | \`elastic\` | Spring-like overshoot |
5124
+
5125
+ ## Custom Keyframe Animation
5126
+
5127
+ For full control, define keyframes manually:
5128
+
5129
+ \`\`\`
5130
+ pinepaper_apply_animated_mask
5131
+ itemId: "item_1"
5132
+ maskType: "rectangle"
5133
+ keyframes:
5134
+ - time: 0
5135
+ properties: {x: 200, y: 250, width: 0, height: 100}
5136
+ easing: "linear"
5137
+ - time: 0.5
5138
+ properties: {x: 200, y: 250, width: 100, height: 100}
5139
+ easing: "easeIn"
5140
+ - time: 1
5141
+ properties: {x: 200, y: 250, width: 200, height: 100}
5142
+ easing: "easeOut"
5143
+ \`\`\`
5144
+
5145
+ ## Mask Types
5146
+
5147
+ | Type | Animatable Properties |
5148
+ |------|----------------------|
5149
+ | \`rectangle\` | x, y, width, height, rotation, opacity |
5150
+ | \`circle\` | x, y, radius, scale, opacity |
5151
+ | \`ellipse\` | x, y, radiusX, radiusY, rotation, scale, opacity |
5152
+ | \`star\` | x, y, radius, scale, rotation, opacity |
5153
+ | \`triangle\` | x, y, scale, rotation, opacity |
5154
+ | \`hexagon\` | x, y, scale, rotation, opacity |
5155
+ | \`heart\` | x, y, scale, rotation, opacity |
5156
+ | \`rounded\` | x, y, width, height, cornerRadius, opacity |
5157
+
5158
+ ## Hybrid Mode: Preset + Custom Keyframes
5159
+
5160
+ Combine preset behavior with custom timing:
5161
+
5162
+ \`\`\`
5163
+ pinepaper_apply_animated_mask
5164
+ itemId: "item_1"
5165
+ preset: "iris"
5166
+ keyframes:
5167
+ - time: 0
5168
+ properties: {scale: 0.01}
5169
+ easing: "linear"
5170
+ - time: 0.3
5171
+ properties: {scale: 0.3}
5172
+ easing: "easeIn"
5173
+ - time: 0.7
5174
+ properties: {scale: 0.8}
5175
+ easing: "easeOut"
5176
+ - time: 1
5177
+ properties: {scale: 1}
5178
+ easing: "bounce"
5179
+ \`\`\`
5180
+
5181
+ ## Staggered Text Reveal
5182
+
5183
+ Reveal multiple words with delays:
5184
+
5185
+ \`\`\`
5186
+ // Create words
5187
+ pinepaper_create_item itemType: "text" position: {x: 200, y: 300}
5188
+ properties: {content: "Hello", fontSize: 36} → item_1
5189
+
5190
+ pinepaper_create_item itemType: "text" position: {x: 350, y: 300}
5191
+ properties: {content: "Beautiful", fontSize: 36} → item_2
5192
+
5193
+ pinepaper_create_item itemType: "text" position: {x: 550, y: 300}
5194
+ properties: {content: "World", fontSize: 36} → item_3
5195
+
5196
+ // Apply staggered reveals
5197
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeUp"
5198
+ options: {startTime: 0, duration: 0.3}
5199
+
5200
+ pinepaper_apply_animated_mask itemId: "item_2" preset: "wipeUp"
5201
+ options: {startTime: 0.2, duration: 0.3}
5202
+
5203
+ pinepaper_apply_animated_mask itemId: "item_3" preset: "wipeUp"
5204
+ options: {startTime: 0.4, duration: 0.3}
5205
+ \`\`\`
5206
+
5207
+ ## Removing Masks
5208
+
5209
+ \`\`\`
5210
+ pinepaper_remove_mask itemId: "item_1"
5211
+ \`\`\`
5212
+ `,
5213
+ 'pinepaper://docs/fonts': `# Font Studio Guide
5214
+
5215
+ **Intent:** Create custom hand-drawn fonts by drawing glyphs on a dedicated canvas, then export as OTF files or use directly in PinePaper documents.
5216
+
5217
+ ## Overview
5218
+
5219
+ Font Studio provides 16 tools for creating custom fonts programmatically. You draw each character as a Paper.js path, clean it up, and convert it to a font glyph.
5220
+
5221
+ ## Key Tools
5222
+
5223
+ | Tool | Purpose |
5224
+ |------|---------|
5225
+ | \`pinepaper_font_show_studio\` | Open the Font Studio UI with guide lines |
5226
+ | \`pinepaper_font_set_name\` | Set font family name |
5227
+ | \`pinepaper_font_get_required_chars\` | Get list of characters needed |
5228
+ | \`pinepaper_font_get_status\` | Check completion progress |
5229
+ | \`pinepaper_font_create_glyph\` | Convert a drawn path to a glyph |
5230
+ | \`pinepaper_font_create_space\` | Create the space character |
5231
+ | \`pinepaper_font_remove_glyph\` | Remove a glyph for redrawing |
5232
+ | \`pinepaper_font_set_metrics\` | Configure font metrics (advanced) |
5233
+ | \`pinepaper_font_export\` | Export as OTF file |
5234
+ | \`pinepaper_font_load_into_document\` | Use font in current document |
5235
+ | \`pinepaper_font_export_data\` | Save progress as JSON |
5236
+ | \`pinepaper_font_import_data\` | Resume from saved data |
5237
+ | \`pinepaper_font_clear\` | Reset all glyphs |
5238
+ | \`pinepaper_font_remove_overlap\` | Merge overlapping path strokes |
5239
+ | \`pinepaper_font_correct_direction\` | Fix path winding for fills |
5240
+ | \`pinepaper_font_cleanup_path\` | All-in-one path preparation |
5241
+
5242
+ ## Workflow
5243
+
5244
+ ### Step 1: Open Font Studio
5245
+ \`\`\`
5246
+ pinepaper_font_show_studio
5247
+ \`\`\`
5248
+
5249
+ Opens the interactive Font Studio UI with typography guide lines:
5250
+ - **Cap Height** (Red): Top of capital letters (H, T, A)
5251
+ - **x-Height** (Cyan): Top of lowercase letters (a, e, x)
5252
+ - **Baseline** (Green): Where letters sit
5253
+ - **Descender** (Purple): Below baseline for g, p, y, j
5254
+
5255
+ ### Step 2: Set Font Name
5256
+ \`\`\`
5257
+ pinepaper_font_set_name name: "MyHandwriting"
5258
+ \`\`\`
5259
+
5260
+ ### Step 3: Check Required Characters
5261
+ \`\`\`
5262
+ pinepaper_font_get_required_chars set: "minimum"
5263
+ \`\`\`
5264
+
5265
+ Two character sets available:
5266
+ - **minimum**: A-Z, a-z, 0-9, space (63 chars) - enough for basic text
5267
+ - **standard**: adds punctuation and symbols (90+ chars)
5268
+
5269
+ ### Step 4: Draw and Create Glyphs
5270
+
5271
+ For each character:
5272
+
5273
+ 1. **Draw the character** as a Paper.js path on the canvas
5274
+ 2. **Clean up the path** (recommended):
5275
+ \`\`\`
5276
+ pinepaper_font_cleanup_path pathId: "item_42"
5277
+ \`\`\`
5278
+ 3. **Create the glyph**:
5279
+ \`\`\`
5280
+ pinepaper_font_create_glyph character: "A" pathId: "item_42"
5281
+ \`\`\`
5282
+
5283
+ For the space character (no visible path needed):
5284
+ \`\`\`
5285
+ pinepaper_font_create_space width: 250
5286
+ \`\`\`
5287
+
5288
+ ### Step 5: Check Progress
5289
+ \`\`\`
5290
+ pinepaper_font_get_status
5291
+ \`\`\`
5292
+
5293
+ Returns: font name, total/completed/pending counts, percentage, and character lists.
5294
+
5295
+ ### Step 6: Export
5296
+
5297
+ Export as OTF file:
5298
+ \`\`\`
5299
+ pinepaper_font_export
5300
+ \`\`\`
5301
+
5302
+ Or load directly into the document:
5303
+ \`\`\`
5304
+ pinepaper_font_load_into_document
5305
+ \`\`\`
5306
+
5307
+ ## Path Cleanup Tools
5308
+
5309
+ Before converting a drawn path to a glyph, clean it up for best results:
5310
+
5311
+ | Tool | What It Does |
5312
+ |------|-------------|
5313
+ | \`pinepaper_font_remove_overlap\` | Merges overlapping strokes into one outline |
5314
+ | \`pinepaper_font_correct_direction\` | Fixes winding so fills render correctly |
5315
+ | \`pinepaper_font_cleanup_path\` | Does all cleanup in one call (overlap + direction + smooth) |
5316
+
5317
+ The \`cleanup_path\` tool accepts options:
5318
+ \`\`\`
5319
+ pinepaper_font_cleanup_path
5320
+ pathId: "item_42"
5321
+ removeOverlap: true
5322
+ correctDirection: true
5323
+ smooth: true
5324
+ smoothTolerance: 2.5
5325
+ \`\`\`
5326
+
5327
+ ## Font Metrics (Advanced)
5328
+
5329
+ Configure the font's coordinate system:
5330
+ \`\`\`
5331
+ pinepaper_font_set_metrics
5332
+ unitsPerEm: 1000
5333
+ ascender: 800
5334
+ descender: -200
5335
+ xHeight: 500
5336
+ capHeight: 700
5337
+ \`\`\`
5338
+
5339
+ ## Save and Resume Progress
5340
+
5341
+ Save work-in-progress:
5342
+ \`\`\`
5343
+ pinepaper_font_export_data
5344
+ \`\`\`
5345
+
5346
+ Resume later:
5347
+ \`\`\`
5348
+ pinepaper_font_import_data data: { ... }
5349
+ \`\`\`
5350
+
5351
+ ## Best Practices
5352
+
5353
+ - Keep stroke width consistent across all characters
5354
+ - Uppercase letters should touch the cap height line
5355
+ - Lowercase (except b, d, f, h, k, l, t) stay within x-height
5356
+ - Letters g, j, p, q, y extend below baseline to descender
5357
+ - Always run \`cleanup_path\` before \`create_glyph\` for cleanest results
5358
+ - Use \`get_status\` frequently to track progress
5359
+ - Save progress with \`export_data\` periodically
5360
+ `,
5361
+ 'pinepaper://examples/us-states-animated': `# US States Animated Map Example
5362
+
5363
+ **Intent:** Create a US map with animated color transitions that loop continuously.
5364
+
5365
+ ## What You'll Build
5366
+
5367
+ A USA map where states randomly change colors in a flowing wave animation.
5368
+
5369
+ ## Step 1: Load the Map
5370
+
5371
+ \`\`\`
5372
+ pinepaper_load_map
5373
+ mapId: "usa"
5374
+ options:
5375
+ projection: "albers"
5376
+ quality: "balanced"
5377
+ fillColor: "#e5e7eb"
5378
+ strokeColor: "#9ca3af"
5379
+ \`\`\`
5380
+
5381
+ ## Step 2: Apply Wave Animation
5382
+
5383
+ \`\`\`
5384
+ pinepaper_animate_map_wave
5385
+ duration: 10
5386
+ loop: true
5387
+ colors: ["#ef4444", "#f97316", "#fbbf24", "#22c55e", "#3b82f6", "#8b5cf6"]
5388
+ options:
5389
+ delayBetween: 0.1
5390
+ easing: "easeInOut"
5391
+ \`\`\`
5392
+
5393
+ ## Result
5394
+
5395
+ States will animate through the color palette in a wave pattern, creating a mesmerizing continuous animation.
5396
+
5397
+ ## Alternative: Data-Driven Colors
5398
+
5399
+ Apply colors based on data values:
5400
+
5401
+ \`\`\`
5402
+ pinepaper_apply_data_colors
5403
+ data:
5404
+ "CA": 100
5405
+ "TX": 85
5406
+ "FL": 70
5407
+ "NY": 65
5408
+ "PA": 50
5409
+ "IL": 45
5410
+ "OH": 40
5411
+ options:
5412
+ colorScale: "blues"
5413
+ legend: true
5414
+ legendPosition: "bottom-right"
5415
+ \`\`\`
5416
+
5417
+ ## Alternative: Highlight Specific States
5418
+
5419
+ \`\`\`
5420
+ pinepaper_highlight_regions
5421
+ regionIds: ["CA", "OR", "WA"]
5422
+ options:
5423
+ fillColor: "#22c55e"
5424
+ strokeColor: "#16a34a"
5425
+ animated: true
5426
+ \`\`\`
5427
+
5428
+ ## Key Tools Used
5429
+
5430
+ | Tool | Purpose |
5431
+ |------|---------|
5432
+ | \`pinepaper_load_map\` | Load USA map with Albers projection |
5433
+ | \`pinepaper_animate_map_wave\` | Create looping color animation |
5434
+ | \`pinepaper_apply_data_colors\` | Color by numeric values |
5435
+ | \`pinepaper_highlight_regions\` | Highlight specific states |
5436
+
5437
+ ## Region ID Format
5438
+
5439
+ For USA maps, use 2-letter state codes:
5440
+ - CA, TX, NY, FL, WA, OR, etc.
5441
+
5442
+ ## Export
5443
+
5444
+ \`\`\`
5445
+ pinepaper_export_svg animated: true
5446
+ \`\`\`
5447
+ `,
5448
+ 'pinepaper://examples/flowchart': `# Flowchart Example
5449
+
5450
+ **Intent:** Create a decision flowchart with auto-layout and animated connectors.
5451
+
5452
+ ## What You'll Build
5453
+
5454
+ A simple decision flowchart: Start → Process → Decision → End
5455
+
5456
+ ## Step 1: Create Shapes
5457
+
5458
+ \`\`\`
5459
+ // Start terminal
5460
+ pinepaper_create_diagram_shape
5461
+ shapeType: "terminal"
5462
+ position: {x: 400, y: 80}
5463
+ label: "Start"
5464
+ style: {fillColor: "#22c55e", strokeColor: "#16a34a"}
5465
+ → item_1
5466
+
5467
+ // Process step
5468
+ pinepaper_create_diagram_shape
5469
+ shapeType: "process"
5470
+ position: {x: 400, y: 180}
5471
+ label: "Check Input"
5472
+ style: {fillColor: "#3b82f6", strokeColor: "#2563eb"}
5473
+ → item_2
5474
+
5475
+ // Decision diamond
5476
+ pinepaper_create_diagram_shape
5477
+ shapeType: "decision"
5478
+ position: {x: 400, y: 300}
5479
+ label: "Valid?"
5480
+ style: {fillColor: "#fbbf24", strokeColor: "#f59e0b"}
5481
+ → item_3
5482
+
5483
+ // Success path
5484
+ pinepaper_create_diagram_shape
5485
+ shapeType: "process"
5486
+ position: {x: 250, y: 420}
5487
+ label: "Process Data"
5488
+ style: {fillColor: "#3b82f6", strokeColor: "#2563eb"}
5489
+ → item_4
5490
+
5491
+ // Error path
5492
+ pinepaper_create_diagram_shape
5493
+ shapeType: "process"
5494
+ position: {x: 550, y: 420}
5495
+ label: "Show Error"
5496
+ style: {fillColor: "#ef4444", strokeColor: "#dc2626"}
5497
+ → item_5
5498
+
5499
+ // End terminal
5500
+ pinepaper_create_diagram_shape
5501
+ shapeType: "terminal"
5502
+ position: {x: 400, y: 540}
5503
+ label: "End"
5504
+ style: {fillColor: "#6b7280", strokeColor: "#4b5563"}
5505
+ → item_6
5506
+ \`\`\`
5507
+
5508
+ ## Step 2: Connect Shapes
5509
+
5510
+ \`\`\`
5511
+ // Start to Check
5512
+ pinepaper_connect
5513
+ sourceItemId: "item_1"
5514
+ targetItemId: "item_2"
5515
+ routing: "orthogonal"
5516
+ lineColor: "#374151"
5517
+
5518
+ // Check to Decision
5519
+ pinepaper_connect
5520
+ sourceItemId: "item_2"
5521
+ targetItemId: "item_3"
5522
+ routing: "orthogonal"
5523
+ lineColor: "#374151"
5524
+
5525
+ // Decision Yes path
5526
+ pinepaper_connect
5527
+ sourceItemId: "item_3"
5528
+ targetItemId: "item_4"
5529
+ routing: "orthogonal"
5530
+ lineColor: "#22c55e"
5531
+ label: "Yes"
5532
+
5533
+ // Decision No path
5534
+ pinepaper_connect
5535
+ sourceItemId: "item_3"
5536
+ targetItemId: "item_5"
5537
+ routing: "orthogonal"
5538
+ lineColor: "#ef4444"
5539
+ label: "No"
5540
+
5541
+ // Process to End
5542
+ pinepaper_connect
5543
+ sourceItemId: "item_4"
5544
+ targetItemId: "item_6"
5545
+ routing: "orthogonal"
5546
+ lineColor: "#374151"
5547
+
5548
+ // Error to End
5549
+ pinepaper_connect
5550
+ sourceItemId: "item_5"
5551
+ targetItemId: "item_6"
5552
+ routing: "orthogonal"
5553
+ lineColor: "#374151"
5554
+ \`\`\`
5555
+
5556
+ ## Step 3: Apply Auto-Layout (Optional)
5557
+
5558
+ \`\`\`
5559
+ pinepaper_auto_layout
5560
+ direction: "TB"
5561
+ spacing: {horizontal: 100, vertical: 80}
5562
+ \`\`\`
5563
+
5564
+ ## Adding Animation
5565
+
5566
+ Make connectors animated to show flow direction:
5567
+
5568
+ \`\`\`
5569
+ pinepaper_connect
5570
+ sourceItemId: "item_1"
5571
+ targetItemId: "item_2"
5572
+ animated: true // Bolt effect shows direction
5573
+ lineColor: "#3b82f6"
5574
+ \`\`\`
5575
+
5576
+ ## Key Tools Used
5577
+
5578
+ | Tool | Purpose |
5579
+ |------|---------|
5580
+ | \`pinepaper_create_diagram_shape\` | Create flowchart symbols |
5581
+ | \`pinepaper_connect\` | Draw smart connectors |
5582
+ | \`pinepaper_auto_layout\` | Automatic arrangement |
5583
+
5584
+ ## Shape Reference
5585
+
5586
+ | Shape | Symbol | Use For |
5587
+ |-------|--------|---------|
5588
+ | \`terminal\` | Rounded rectangle | Start/End |
5589
+ | \`process\` | Rectangle | Actions |
5590
+ | \`decision\` | Diamond | Yes/No branching |
5591
+ | \`data\` | Parallelogram | Input/Output |
5592
+ | \`document\` | Wavy rectangle | Documents |
5593
+ `,
5594
+ 'pinepaper://examples/reveal-animation': `# Reveal Animation Example
5595
+
5596
+ **Intent:** Create a text reveal animation using mask effects.
5597
+
5598
+ ## What You'll Build
5599
+
5600
+ Text that reveals with a smooth wipe animation, perfect for intros and titles.
5601
+
5602
+ ## Method 1: Simple Preset
5603
+
5604
+ \`\`\`
5605
+ // Create text
5606
+ pinepaper_create_item
5607
+ itemType: "text"
5608
+ position: {x: 400, y: 300}
5609
+ properties:
5610
+ content: "Welcome"
5611
+ fontSize: 64
5612
+ fontWeight: "bold"
5613
+ color: "#ffffff"
5614
+ → item_1
5615
+
5616
+ // Apply wipe reveal
5617
+ pinepaper_apply_animated_mask
5618
+ itemId: "item_1"
5619
+ preset: "wipeLeft"
5620
+ options:
5621
+ duration: 0.6
5622
+ easing: "easeOut"
5623
+ \`\`\`
5624
+
5625
+ ## Method 2: Staggered Word Reveal
5626
+
5627
+ \`\`\`
5628
+ // Word 1
5629
+ pinepaper_create_item itemType: "text" position: {x: 200, y: 300}
5630
+ properties: {content: "Create", fontSize: 48, color: "#3b82f6"}
5631
+ → item_1
5632
+
5633
+ // Word 2
5634
+ pinepaper_create_item itemType: "text" position: {x: 370, y: 300}
5635
+ properties: {content: "Beautiful", fontSize: 48, color: "#8b5cf6"}
5636
+ → item_2
5637
+
5638
+ // Word 3
5639
+ pinepaper_create_item itemType: "text" position: {x: 580, y: 300}
5640
+ properties: {content: "Graphics", fontSize: 48, color: "#ec4899"}
5641
+ → item_3
5642
+
5643
+ // Staggered reveals
5644
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeUp"
5645
+ options: {startTime: 0, duration: 0.4, easing: "easeOut"}
5646
+
5647
+ pinepaper_apply_animated_mask itemId: "item_2" preset: "wipeUp"
5648
+ options: {startTime: 0.15, duration: 0.4, easing: "easeOut"}
5649
+
5650
+ pinepaper_apply_animated_mask itemId: "item_3" preset: "wipeUp"
5651
+ options: {startTime: 0.3, duration: 0.4, easing: "easeOut"}
5652
+ \`\`\`
5653
+
5654
+ ## Method 3: Iris Reveal for Images
5655
+
5656
+ \`\`\`
5657
+ // Create a shape or import image
5658
+ pinepaper_create_item itemType: "circle" position: {x: 400, y: 300}
5659
+ properties: {radius: 100, color: "#3b82f6"}
5660
+ → item_1
5661
+
5662
+ // Iris reveal from center
5663
+ pinepaper_apply_animated_mask
5664
+ itemId: "item_1"
5665
+ preset: "iris"
5666
+ options:
5667
+ duration: 0.8
5668
+ easing: "easeOut"
5669
+ \`\`\`
5670
+
5671
+ ## Method 4: Cinematic Letterbox
5672
+
5673
+ \`\`\`
5674
+ // Create main content
5675
+ pinepaper_create_item itemType: "rectangle" position: {x: 400, y: 300}
5676
+ properties: {width: 600, height: 300, color: "#1e40af"}
5677
+ → item_1
5678
+
5679
+ // Cinematic reveal (letterbox bars animate away)
5680
+ pinepaper_apply_animated_mask
5681
+ itemId: "item_1"
5682
+ preset: "cinematic"
5683
+ options:
5684
+ duration: 1.2
5685
+ easing: "easeInOut"
5686
+ \`\`\`
5687
+
5688
+ ## Available Presets
5689
+
5690
+ | Preset | Effect | Best For |
5691
+ |--------|--------|----------|
5692
+ | \`wipeLeft\` | Left to right | Text, titles |
5693
+ | \`wipeRight\` | Right to left | Text |
5694
+ | \`wipeUp\` | Bottom to top | Credits, lists |
5695
+ | \`wipeDown\` | Top to bottom | Headers |
5696
+ | \`iris\` | Circle from center | Images, focus |
5697
+ | \`irisOut\` | Circle shrinks | Transitions out |
5698
+ | \`star\` | Star shape reveal | Fun, playful |
5699
+ | \`heart\` | Heart shape reveal | Love themes |
5700
+ | \`curtainHorizontal\` | Opens from center | Stage, dramatic |
5701
+ | \`curtainVertical\` | Opens vertically | Reveals |
5702
+ | \`cinematic\` | Letterbox effect | Film style |
5703
+ | \`diagonalWipe\` | Angled wipe | Dynamic |
5704
+
5705
+ ## Combining with Other Animations
5706
+
5707
+ \`\`\`
5708
+ // Create text
5709
+ pinepaper_create_item itemType: "text" position: {x: 400, y: 300}
5710
+ properties: {content: "Animated!", fontSize: 48}
5711
+ → item_1
5712
+
5713
+ // Apply mask reveal
5714
+ pinepaper_apply_animated_mask itemId: "item_1" preset: "wipeLeft"
5715
+ options: {duration: 0.5}
5716
+
5717
+ // Add pulse animation after reveal
5718
+ pinepaper_animate_item itemId: "item_1" animationType: "pulse" speed: 0.5
5719
+ \`\`\`
5720
+
5721
+ ## Key Tools
5722
+
5723
+ | Tool | Purpose |
5724
+ |------|---------|
5725
+ | \`pinepaper_apply_animated_mask\` | Apply reveal preset |
5726
+ | \`pinepaper_get_mask_animations\` | List all presets |
5727
+ | \`pinepaper_remove_mask\` | Remove mask effect |
5728
+ `,
5729
+ };
5730
+ // =============================================================================
5731
+ // SERVER CREATION
5732
+ // =============================================================================
5733
+ export async function createServer(options = {}) {
5734
+ // Initialize i18n with specified locale
5735
+ const locale = options.locale || detectLocaleFromEnvironment();
5736
+ const i18n = await initI18n(locale);
5737
+ // Mutable effective settings — may be upgraded by client auto-detection
5738
+ let effectiveVerbosity = options.verbosity || detectVerbosityFromEnvironment();
5739
+ let effectiveToolkit = options.toolkit || detectToolkitFromEnvironment();
5740
+ /** Compute the current filtered tools list (sub-ms, called per tools/list request). */
5741
+ const getEffectiveTools = () => getToolsForToolkit(getToolsForVerbosity(effectiveVerbosity), effectiveToolkit);
5742
+ const server = new Server(SERVER_INFO, {
5743
+ capabilities: {
5744
+ tools: { listChanged: true },
5745
+ resources: {},
5746
+ prompts: {},
5747
+ },
5748
+ });
5749
+ // Client auto-detection: upgrade toolkit/verbosity based on MCP client identity
5750
+ server.oninitialized = () => {
5751
+ const clientVersion = server.getClientVersion();
5752
+ if (!clientVersion?.name)
5753
+ return;
5754
+ const profile = getClientProfile(clientVersion.name);
5755
+ if (!profile)
5756
+ return;
5757
+ let changed = false;
5758
+ // Only upgrade if env vars / CLI flags weren't explicitly set
5759
+ if (!options.toolkit && !isToolkitExplicitlySet() && profile.toolkit !== effectiveToolkit) {
5760
+ console.error(`[auto-select] Client "${clientVersion.name}" → toolkit=${profile.toolkit}`);
5761
+ effectiveToolkit = profile.toolkit;
5762
+ changed = true;
5763
+ }
5764
+ if (!options.verbosity && !isVerbosityExplicitlySet() && profile.verbosity !== effectiveVerbosity) {
5765
+ console.error(`[auto-select] Client "${clientVersion.name}" → verbosity=${profile.verbosity}`);
5766
+ effectiveVerbosity = profile.verbosity;
5767
+ changed = true;
5768
+ }
5769
+ if (changed) {
5770
+ // Notify client that tool list has changed
5771
+ server.sendToolListChanged().catch(() => { });
5772
+ }
5773
+ };
5774
+ // ---------------------------------------------------------------------------
5775
+ // TOOL HANDLERS
3202
5776
  // ---------------------------------------------------------------------------
3203
- // List available tools (with optional localization)
5777
+ // List available tools — dynamic, recomputed each request (sub-ms)
3204
5778
  server.setRequestHandler(ListToolsRequestSchema, async () => {
3205
- // Tool descriptions are kept in English for AI understanding
3206
- // but can be localized if needed for UI display
3207
5779
  return {
3208
- tools: PINEPAPER_TOOLS,
5780
+ tools: getEffectiveTools(),
3209
5781
  };
3210
5782
  });
3211
5783
  // Handle tool calls with i18n support for errors and success messages
@@ -3215,6 +5787,32 @@ export async function createServer(options = {}) {
3215
5787
  const executionMode = options.executionMode ?? getExecutionMode();
3216
5788
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
3217
5789
  const { name, arguments: args } = request.params;
5790
+ // Runtime toolkit/verbosity switching — handled here because it needs
5791
+ // direct access to mutable effectiveToolkit/effectiveVerbosity state
5792
+ if (name === 'pinepaper_set_toolkit') {
5793
+ const { SetToolkitInputSchema } = await import('./types/schemas.js');
5794
+ const { TOOLKIT_PROFILES_LIST } = await import('./tools/toolkits.js');
5795
+ const input = SetToolkitInputSchema.parse(args);
5796
+ let changed = false;
5797
+ if (input.toolkit && input.toolkit !== effectiveToolkit) {
5798
+ effectiveToolkit = input.toolkit;
5799
+ changed = true;
5800
+ }
5801
+ if (input.verbosity && input.verbosity !== effectiveVerbosity) {
5802
+ effectiveVerbosity = input.verbosity;
5803
+ changed = true;
5804
+ }
5805
+ if (changed) {
5806
+ server.sendToolListChanged().catch(() => { });
5807
+ }
5808
+ const tools = getEffectiveTools();
5809
+ return {
5810
+ content: [{
5811
+ type: 'text',
5812
+ text: `Toolkit: ${effectiveToolkit}, Verbosity: ${effectiveVerbosity}, Tools: ${tools.length}${changed ? ' (updated)' : ' (no change)'}`,
5813
+ }],
5814
+ };
5815
+ }
3218
5816
  return handleToolCall(name, args, {
3219
5817
  i18n,
3220
5818
  executeInBrowser,
@@ -3247,6 +5845,16 @@ export async function createServer(options = {}) {
3247
5845
  ],
3248
5846
  };
3249
5847
  });
5848
+ // ---------------------------------------------------------------------------
5849
+ // PROMPT HANDLERS
5850
+ // ---------------------------------------------------------------------------
5851
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
5852
+ return { prompts: PROMPTS };
5853
+ });
5854
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
5855
+ const { name, arguments: args } = request.params;
5856
+ return getPromptMessages(name, args);
5857
+ });
3250
5858
  return server;
3251
5859
  }
3252
5860
  // =============================================================================
@@ -3331,19 +5939,30 @@ function isValidLocale(locale) {
3331
5939
  // =============================================================================
3332
5940
  async function main() {
3333
5941
  const locale = detectLocaleFromEnvironment();
3334
- const server = await createServer({ locale });
5942
+ const verbosity = detectVerbosityFromEnvironment();
5943
+ const toolkit = detectToolkitFromEnvironment();
5944
+ const server = await createServer({ locale, verbosity, toolkit });
3335
5945
  const transport = new StdioServerTransport();
3336
5946
  console.error('PinePaper MCP Server starting...');
3337
5947
  console.error(`Version: ${SERVER_INFO.version}`);
3338
5948
  console.error(`Locale: ${locale}`);
3339
- console.error(`Tools: ${PINEPAPER_TOOLS.length}`);
5949
+ console.error(`Verbosity: ${verbosity}`);
5950
+ console.error(`Toolkit: ${toolkit}`);
5951
+ const toolCount = getToolsForToolkit(getToolsForVerbosity(verbosity), toolkit).length;
5952
+ console.error(`Tools: ${toolCount}/${PINEPAPER_TOOLS.length}`);
3340
5953
  console.error(`Resources: ${RESOURCES.length}`);
3341
5954
  await server.connect(transport);
3342
5955
  console.error('PinePaper MCP Server running on stdio');
3343
5956
  }
3344
- // Run if executed directly
3345
- main().catch((error) => {
3346
- console.error('Fatal error:', error);
3347
- process.exit(1);
3348
- });
5957
+ // Run if executed directly (not when imported by cli.ts or other modules)
5958
+ // Check: Node uses process.argv[1], Bun supports import.meta.main
5959
+ const isDirectExecution = typeof import.meta.main === 'boolean'
5960
+ ? import.meta.main
5961
+ : process.argv[1]?.replace(/\\/g, '/').endsWith('index.js');
5962
+ if (isDirectExecution) {
5963
+ main().catch((error) => {
5964
+ console.error('Fatal error:', error);
5965
+ process.exit(1);
5966
+ });
5967
+ }
3349
5968
  //# sourceMappingURL=index.js.map