| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 1 | import { html, css, LitElement } from "lit"; |
| 2 | import { customElement } from "lit/decorators.js"; |
| 3 | import "../../sketch-timeline-message.ts"; |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 4 | // Using simple objects matching the AgentMessage interface |
| 5 | |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 6 | @customElement("mermaid-test-component") |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 7 | export class MermaidTestComponent extends LitElement { |
| 8 | static styles = css` |
| 9 | :host { |
| 10 | display: block; |
| 11 | } |
| 12 | .test-section { |
| 13 | margin-bottom: 30px; |
| 14 | } |
| 15 | h2 { |
| 16 | margin-top: 0; |
| 17 | color: #444; |
| 18 | } |
| 19 | `; |
| 20 | |
| 21 | render() { |
| 22 | // Create a sample message with Mermaid diagrams |
| 23 | const flowchartMessage = { |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 24 | id: "test-1", |
| 25 | type: "agent", |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 26 | content: `# Mermaid Flowchart Example |
| 27 | |
| 28 | This is a test of a flowchart diagram in Mermaid syntax: |
| 29 | |
| 30 | \`\`\`mermaid |
| 31 | graph TD |
| 32 | A[Start] --> B{Is it working?} |
| 33 | B -->|Yes| C[Great!] |
| 34 | B -->|No| D[Try again] |
| 35 | C --> E[Continue] |
| 36 | D --> B |
| 37 | \`\`\` |
| 38 | |
| 39 | The above should render as a Mermaid diagram.`, |
| 40 | timestamp: new Date().toISOString(), |
| 41 | }; |
| 42 | |
| 43 | const sequenceDiagramMessage = { |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 44 | id: "test-2", |
| 45 | type: "agent", |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 46 | content: `# Mermaid Sequence Diagram Example |
| 47 | |
| 48 | Here's a sequence diagram showing a typical HTTP request: |
| 49 | |
| 50 | \`\`\`mermaid |
| 51 | sequenceDiagram |
| 52 | participant Browser |
| 53 | participant Server |
| 54 | Browser->>Server: GET /index.html |
| 55 | Server-->>Browser: HTML Response |
| 56 | Browser->>Server: GET /style.css |
| 57 | Server-->>Browser: CSS Response |
| 58 | Browser->>Server: GET /script.js |
| 59 | Server-->>Browser: JS Response |
| 60 | \`\`\` |
| 61 | |
| 62 | Complex diagrams should render properly.`, |
| 63 | timestamp: new Date().toISOString(), |
| 64 | }; |
| 65 | |
| 66 | const classDiagramMessage = { |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 67 | id: "test-3", |
| 68 | type: "agent", |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 69 | content: `# Mermaid Class Diagram Example |
| 70 | |
| 71 | A simple class diagram in Mermaid: |
| 72 | |
| 73 | \`\`\`mermaid |
| 74 | classDiagram |
| 75 | class Animal { |
| 76 | +string name |
| 77 | +makeSound() void |
| 78 | } |
| 79 | class Dog { |
| 80 | +bark() void |
| 81 | } |
| 82 | class Cat { |
| 83 | +meow() void |
| 84 | } |
| 85 | Animal <|-- Dog |
| 86 | Animal <|-- Cat |
| 87 | \`\`\` |
| 88 | |
| 89 | This represents a basic inheritance diagram.`, |
| 90 | timestamp: new Date().toISOString(), |
| 91 | }; |
| 92 | |
| 93 | const normalMarkdownMessage = { |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 94 | id: "test-4", |
| 95 | type: "agent", |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 96 | content: `# Regular Markdown |
| 97 | |
| 98 | This is regular markdown with: |
| 99 | |
| 100 | - A bullet list |
| 101 | - **Bold text** |
| 102 | - *Italic text* |
| 103 | |
| 104 | \`\`\`javascript |
| 105 | // Regular code block |
| 106 | const x = 10; |
| 107 | console.log('This is not Mermaid'); |
| 108 | \`\`\` |
| 109 | |
| 110 | Regular markdown should continue to work properly.`, |
| 111 | timestamp: new Date().toISOString(), |
| 112 | }; |
| 113 | |
| 114 | return html` |
| 115 | <div class="test-section"> |
| 116 | <h2>Flowchart Diagram Test</h2> |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 117 | <sketch-timeline-message |
| 118 | .message=${flowchartMessage} |
| 119 | ></sketch-timeline-message> |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 120 | </div> |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 121 | |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 122 | <div class="test-section"> |
| 123 | <h2>Sequence Diagram Test</h2> |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 124 | <sketch-timeline-message |
| 125 | .message=${sequenceDiagramMessage} |
| 126 | ></sketch-timeline-message> |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 127 | </div> |
| 128 | |
| 129 | <div class="test-section"> |
| 130 | <h2>Class Diagram Test</h2> |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 131 | <sketch-timeline-message |
| 132 | .message=${classDiagramMessage} |
| 133 | ></sketch-timeline-message> |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 134 | </div> |
| 135 | |
| 136 | <div class="test-section"> |
| 137 | <h2>Normal Markdown Test</h2> |
| Autoformatter | dded2d6 | 2025-04-28 00:27:21 +0000 | [diff] [blame] | 138 | <sketch-timeline-message |
| 139 | .message=${normalMarkdownMessage} |
| 140 | ></sketch-timeline-message> |
| Sean McCullough | 8d93e36 | 2025-04-27 23:32:18 +0000 | [diff] [blame] | 141 | </div> |
| 142 | `; |
| 143 | } |
| 144 | } |