blob: 629ba26c18926791157c76776bde9d245e0019f0 [file] [log] [blame]
Pokey Ruleef58e062025-05-07 13:32:58 +01001import { LitElement, css, html } from "lit";
2import { customElement, property } from "lit/decorators.js";
3import { ToolCall } from "../types";
4
Pokey Ruleef58e062025-05-07 13:32:58 +01005@customElement("sketch-tool-card-title")
6export class SketchToolCardTitle extends LitElement {
7 @property() toolCall: ToolCall;
8 @property() open: boolean;
9
10 static styles = css`
11 .summary-text {
12 font-style: italic;
13 }
14 pre {
15 display: inline;
16 font-family: monospace;
17 background: rgb(236, 236, 236);
18 padding: 2px 4px;
19 border-radius: 2px;
20 margin: 0;
21 }
22 `;
23
24 render() {
25 const inputData = JSON.parse(this.toolCall?.input || "{}");
26 return html`
27 <sketch-tool-card .open=${this.open} .toolCall=${this.toolCall}>
28 <span slot="summary" class="summary-text">
29 Title: "${inputData.title}" | Branch: sketch/${inputData.branch_name}
30 </span>
31 <div slot="input">
32 <div>Set title to: <b>${inputData.title}</b></div>
33 <div>Set branch to: <code>sketch/${inputData.branch_name}</code></div>
34 </div>
35 </sketch-tool-card>
36 `;
37 }
38}
39
40declare global {
41 interface HTMLElementTagNameMap {
42 "sketch-tool-card-title": SketchToolCardTitle;
43 }
44}