{ "id": "305z337lo8wfhm7", "name": "Email Form", "js": "import slugify from \"slugify\";\n\nfunction handleEmailSubmit(e) {\n e.preventDefault();\n const form = e.target;\n const data = new FormData(form);\n\n let body = \"\";\n for (const [key, value] of data.entries()) {\n body += `${key}: ${value}\\n`;\n }\n\n const subject_field = data.get(\"subject\") || \"New message from your website\";\n const mailto = `mailto:${email_address}?subject=${encodeURIComponent(\n subject_field,\n )}&body=${encodeURIComponent(body)}`;\n\n window.location.href = mailto;\n}\n\nfunction slugify_name(text) {\n return slugify(text, {\n replacement: \"_\", // replace spaces with underscores\n lower: false, // convert to lowercase\n strict: true, // remove special chars\n });\n}\n\n// Auto-grow textarea fields on input\nfunction autogrow(node) {\n function resize() {\n node.style.height = \"auto\";\n node.style.height = node.scrollHeight + \"px\";\n }\n\n // Grow once on mount and whenever input changes\n resize();\n node.addEventListener(\"input\", resize);\n\n return {\n destroy() {\n node.removeEventListener(\"input\", resize);\n },\n };\n}\n", "css": "@import url(https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css);\n\n.container {\n padding-block: 2rem;\n}", "html": "