diff --git a/web/package.json b/web/package.json index 9dafcb32..fb98509c 100644 --- a/web/package.json +++ b/web/package.json @@ -36,6 +36,8 @@ "dependencies": { "@lottiefiles/svelte-lottie-player": "^0.3.1", "@tailwindcss/typography": "^0.5.13", + "highlight.js": "^11.10.0", + "isomorphic-dompurify": "^2.14.0", "showdown": "^2.1.0", "tailwind-scrollbar": "^3.1.0" } diff --git a/web/src/lib/actions/clickOutside.ts b/web/src/lib/actions/clickOutside.ts new file mode 100644 index 00000000..6aa14693 --- /dev/null +++ b/web/src/lib/actions/clickOutside.ts @@ -0,0 +1,18 @@ +export function clickOutside(element: HTMLElement, callbackFunction: () => void) { + function onClick(event: MouseEvent) { + if (!element.contains(event.target as Node)) { + callbackFunction(); + } + } + + document.body.addEventListener("click", onClick); + + return { + update(newCallbackFunction: () => void) { + callbackFunction = newCallbackFunction; + }, + destroy() { + document.body.removeEventListener("click", onClick); + }, + }; +} diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte new file mode 100644 index 00000000..f9ad7a5a --- /dev/null +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -0,0 +1,82 @@ + + +{#if showModal} +