| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <title>sketch-timeline-message demo</title> |
| 4 | <link rel="stylesheet" href="demo.css" /> |
| 5 | <script |
| 6 | src="/dist/web-components/sketch-timeline-message.js" |
| 7 | type="module" |
| 8 | ></script> |
| 9 | |
| 10 | <script> |
| 11 | const messages = [ |
| 12 | { |
| 13 | type: "agent", |
| 14 | content: "an agent message", |
| 15 | }, |
| 16 | { |
| 17 | type: "user", |
| 18 | content: "a user message", |
| 19 | }, |
| 20 | { |
| 21 | type: "tool", |
| 22 | content: "a tool use message", |
| 23 | }, |
| 24 | { |
| 25 | type: "commit", |
| 26 | end_of_turn: false, |
| 27 | content: "", |
| 28 | commits: [ |
| 29 | { |
| 30 | hash: "ece101c103ec231da87f4df05c1b5e6a24e13add", |
| 31 | subject: "Add README.md for web components directory", |
| 32 | body: "This adds documentation for the web components used in the Loop UI,\nincluding a description of each component, usage examples, and\ndevelopment guidelines.\n\nCo-Authored-By: sketch\nadd README.md for loop/webui/src/web-components", |
| 33 | pushed_branch: |
| 34 | "sketch/create-readmemd-for-web-components-directory", |
| 35 | }, |
| 36 | ], |
| 37 | timestamp: "2025-04-14T16:39:33.639533919Z", |
| 38 | conversation_id: "", |
| 39 | idx: 17, |
| 40 | }, |
| 41 | { |
| 42 | type: "agent", |
| 43 | content: "an end-of-turn agent message", |
| 44 | end_of_turn: true, |
| 45 | }, |
| 46 | ]; |
| 47 | document.addEventListener("DOMContentLoaded", () => { |
| 48 | messages.forEach((msg, idx) => { |
| 49 | const jsonEl = document.createElement("pre"); |
| 50 | jsonEl.innerText = `.message property: ${JSON.stringify(msg)}`; |
| 51 | document.body.append(jsonEl); |
| 52 | const messageEl = document.createElement("sketch-timeline-message"); |
| 53 | messageEl.message = msg; |
| 54 | document.body.appendChild(messageEl); |
| 55 | }); |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 56 | window.addEventListener("show-commit-diff", (evt) => { |
| 57 | console.log("show-commit-diff", evt); |
| 58 | }); |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 59 | }); |
| 60 | </script> |
| 61 | </head> |
| 62 | <body> |
| 63 | <h1>sketch-timeline-message demo</h1> |
| 64 | </body> |
| 65 | </html> |