0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Submit any HTML form through VBService('email') using a named template. Progressive enhancement on top of native form action.
Overview
Add data-vb-email-form="template-name" to any <form> to intercept its submit and POST { to, template, data } to /go/email via VBService('email'). The template name maps to a renderer registered in your backend (see the /go/email template registry).
Progressive enhancement. Without JS the form falls back to its native actionattribute, so the same markup works as a server-side form post. With JS the submission goes through /go/email — one indirection layer between the form and whichever provider (Sendgrid, Postmark, SES, …) sits behind the endpoint.
Template name. Must match a renderer registered server-side. VB names four built-ins: contact-form, page-watch-update, goodurl-digest, newsletter-welcome.
data-vb-email-to
typically
Recipient email. If omitted, the script looks for a form field named to or email; failing that the backend determines the recipient (e.g. a configured contact-form inbox).
data-vb-email-loading-label
no
Replaces the submit button label while the request is in flight (e.g. "Sending…").
data-vb-email-success
no
Message shown inside [data-vb-email-status] on 2xx. Default: “Sent. Thank you.”
data-vb-email-error
no
Message shown inside [data-vb-email-status] on failure. Default: “Sorry, the message could not be sent. Try again.”
data-vb-email-no-reset
no
Skip the automatic form.reset() on success.
Status output
Place an element with data-vb-email-status anywhere inside the form. The script writes the success or error message into it and toggles data-state="success" or data-state="error", so you can style each state with CSS:
An <output aria-live="polite"> is the natural element — screen readers announce the status without stealing focus.
Events
Event
Detail
When
vb-email-form:submitting
{ template }
Just before the request goes out
vb-email-form:success
{ id }
2xx response (id is whatever the backend returns)
vb-email-form:error
{ error, status?, body? }
Network failure or non-2xx response
All three bubble and cross shadow boundaries so a parent app can listen at the document level.
Backend
The Pages Function at functions/go/email.js (and the Cloudflare reference at admin/reference-implementations/cloudflare/) accepts the contract as-is and dispatches to a configured transport (Resend by default, fallback to record-only when secrets are absent). Wire any other provider by following the reference implementations as templates.