import { scriptTags, scriptReadsCtx } from "../lib/script.js"; import { TagBadge } from "./TagBadge.jsx"; function FieldTable({ title, fields }) { const entries = Object.entries(fields ?? {}); if (entries.length === 0) return null; return (

{title}

{entries.map(([name, spec]) => { const field = spec && typeof spec === "object" ? spec : { description: String(spec) }; const notes = [ field.required ? "required" : null, field.default !== undefined ? `default ${JSON.stringify(field.default)}` : null, Array.isArray(field.enum) ? `enum ${field.enum.map((x) => (x && typeof x === "object" ? x.value : x)).join(", ")}` : Array.isArray(field.options) ? `enum ${field.options.map((x) => (x && typeof x === "object" ? x.value : x)).join(", ")}` : null, field.description, ] .filter(Boolean) .join(" ยท "); return ( ); })}
Field Type Notes
{name} {field.type ?? ""} {notes}
); } export function ScriptMetaPanel({ meta, metaError, className = "" }) { if (metaError) { return

Meta: {metaError}

; } if (!meta) { return (

No script.meta on the default export

); } const tags = scriptTags(meta); return (
{meta.description ?

{meta.description}

: null} {(tags.length || scriptReadsCtx(meta)) ? (
{tags.map((tag) => ( ))} {scriptReadsCtx(meta) ? ( reads: ctx ) : null}
) : null}
); }