blob: b697d92e74bd557a2e51355b66f9f419128686b7 [file] [log] [blame]
Autoformatterdded2d62025-04-28 00:27:21 +00001import { html, css, LitElement } from "lit";
2import { customElement } from "lit/decorators.js";
3import "../../sketch-timeline-message.ts";
Sean McCullough8d93e362025-04-27 23:32:18 +00004// Using simple objects matching the AgentMessage interface
5
Autoformatterdded2d62025-04-28 00:27:21 +00006@customElement("mermaid-test-component")
Sean McCullough8d93e362025-04-27 23:32:18 +00007export 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 = {
Autoformatterdded2d62025-04-28 00:27:21 +000024 id: "test-1",
25 type: "agent",
Sean McCullough8d93e362025-04-27 23:32:18 +000026 content: `# Mermaid Flowchart Example
27
28This is a test of a flowchart diagram in Mermaid syntax:
29
30\`\`\`mermaid
31graph 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
39The above should render as a Mermaid diagram.`,
40 timestamp: new Date().toISOString(),
41 };
42
43 const sequenceDiagramMessage = {
Autoformatterdded2d62025-04-28 00:27:21 +000044 id: "test-2",
45 type: "agent",
Sean McCullough8d93e362025-04-27 23:32:18 +000046 content: `# Mermaid Sequence Diagram Example
47
48Here's a sequence diagram showing a typical HTTP request:
49
50\`\`\`mermaid
51sequenceDiagram
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
62Complex diagrams should render properly.`,
63 timestamp: new Date().toISOString(),
64 };
65
66 const classDiagramMessage = {
Autoformatterdded2d62025-04-28 00:27:21 +000067 id: "test-3",
68 type: "agent",
Sean McCullough8d93e362025-04-27 23:32:18 +000069 content: `# Mermaid Class Diagram Example
70
71A simple class diagram in Mermaid:
72
73\`\`\`mermaid
74classDiagram
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
89This represents a basic inheritance diagram.`,
90 timestamp: new Date().toISOString(),
91 };
92
93 const normalMarkdownMessage = {
Autoformatterdded2d62025-04-28 00:27:21 +000094 id: "test-4",
95 type: "agent",
Sean McCullough8d93e362025-04-27 23:32:18 +000096 content: `# Regular Markdown
97
98This is regular markdown with:
99
100- A bullet list
101- **Bold text**
102- *Italic text*
103
104\`\`\`javascript
105// Regular code block
106const x = 10;
107console.log('This is not Mermaid');
108\`\`\`
109
110Regular 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>
Autoformatterdded2d62025-04-28 00:27:21 +0000117 <sketch-timeline-message
118 .message=${flowchartMessage}
119 ></sketch-timeline-message>
Sean McCullough8d93e362025-04-27 23:32:18 +0000120 </div>
Autoformatterdded2d62025-04-28 00:27:21 +0000121
Sean McCullough8d93e362025-04-27 23:32:18 +0000122 <div class="test-section">
123 <h2>Sequence Diagram Test</h2>
Autoformatterdded2d62025-04-28 00:27:21 +0000124 <sketch-timeline-message
125 .message=${sequenceDiagramMessage}
126 ></sketch-timeline-message>
Sean McCullough8d93e362025-04-27 23:32:18 +0000127 </div>
128
129 <div class="test-section">
130 <h2>Class Diagram Test</h2>
Autoformatterdded2d62025-04-28 00:27:21 +0000131 <sketch-timeline-message
132 .message=${classDiagramMessage}
133 ></sketch-timeline-message>
Sean McCullough8d93e362025-04-27 23:32:18 +0000134 </div>
135
136 <div class="test-section">
137 <h2>Normal Markdown Test</h2>
Autoformatterdded2d62025-04-28 00:27:21 +0000138 <sketch-timeline-message
139 .message=${normalMarkdownMessage}
140 ></sketch-timeline-message>
Sean McCullough8d93e362025-04-27 23:32:18 +0000141 </div>
142 `;
143 }
144}