co-mono/packages/web-ui/src/tools/artifacts/ArtifactPill.ts
Mario Zechner e533aebacd Fix Lit dependency duplication and update mini-lit to 0.2.0
- Move lit from dependencies to peerDependencies in web-ui to prevent multiple Lit instances being loaded
- Update mini-lit from 0.1.8/0.1.10 to 0.2.0 in root package.json and web-ui/package.json
- Install @tailwindcss/vite in web-ui/example
- Run biome formatting fixes across codebase

This resolves HMR custom element re-registration errors caused by duplicate Lit registries.
2025-11-12 16:03:43 +01:00

26 lines
889 B
TypeScript

import { icon } from "@mariozechner/mini-lit";
import { html, type TemplateResult } from "lit";
import { FileCode2 } from "lucide";
import type { ArtifactsPanel } from "./artifacts.js";
export function ArtifactPill(filename: string, artifactsPanel?: ArtifactsPanel): TemplateResult {
const handleClick = (e: Event) => {
if (!artifactsPanel) return;
e.preventDefault();
e.stopPropagation();
// openArtifact will show the artifact and call onOpen() to open the panel if needed
artifactsPanel.openArtifact(filename);
};
return html`
<span
class="inline-flex items-center gap-1 px-2 py-0.5 text-xs bg-muted/50 border border-border rounded ${
artifactsPanel ? "cursor-pointer hover:bg-muted transition-colors" : ""
}"
@click=${artifactsPanel ? handleClick : null}
>
${icon(FileCode2, "sm")}
<span class="text-foreground">${filename}</span>
</span>
`;
}