refac: built-in tools ui component support

This commit is contained in:
Timothy Jaeryang Baek
2025-09-19 01:38:44 -05:00
parent 7528f24b61
commit 60db9ec8ef
3 changed files with 46 additions and 2 deletions

View File

@@ -107,6 +107,7 @@
<div class="my-2" id={`${collapsibleId}-tool-calls-${attributes?.id}-embed-${idx}`}>
<FullHeightIframe
src={embed}
{args}
allowScripts={true}
allowForms={true}
allowSameOrigin={true}

View File

@@ -6,6 +6,8 @@
export let title = 'Embedded Content';
export let initialHeight: number | null = null; // initial height in px, null = auto
export let args = null;
export let allowScripts = true;
export let allowForms = false;
@@ -63,6 +65,11 @@
const onLoad = async () => {
requestAnimationFrame(resizeSameOrigin);
// if arguments are provided, inject them into the iframe window
if (args && iframe?.contentWindow) {
(iframe.contentWindow as any).args = args;
}
// If we're injecting Alpine into srcdoc iframe and sameOrigin allowed
if (iframeDoc && allowSameOrigin && iframe?.contentWindow) {
const alpineDirectives = [