Repository navigation
v0.10.0
Every component gets a typed templ wrapper in the new module github.com/zweiundeins/starbase/templ, generated from its manifest, with script imports pinned to the release: a list, the autoloader, or exactly the components a page rendered. sb-toast takes a link or an action per toast and stops counting down while the page is hidden.
Added
Components
sb-toast: a toast can carry a link or an action:hreforactionwith alabelin the page's words (without a label, neither is shown). The link is an<a href>that closes the toast on a plain click and keeps it on a click that opens it elsewhere; the action is a<button>that emitssb-toast-actionwith{id, action}and closes the toast. Both sit in the tab order before the close button, are described by the toast's message and announced with it, and keyboard focus moves on to the next toast when they close theirs. Countdowns stop while the page is hidden (a background tab) and resume when it is shown, so a toast never expires unseen. The templ wrappers'sb.ToastMessagehasHref,ActionandLabel.
Site and server
- templ wrappers: the module
github.com/zweiundeins/starbase/templ(packagesb, intempl/, depending on templ and the standard library only) has a typed templ component for every component, generated from its manifest bygo tool task templ-wrappers:@sb.Toggle(sb.ToggleProps{Label: "Notifications", Checked: true}).- Types:
- Props are fields with doc comments from the manifest. Booleans work by presence, and flags that are on by default are
sb.Flag. oneOfvalues are constants named after their type (sb.ToggleSizeLg,sb.ToastVariantOK).- Whole numbers are
int, othersfloat64. Numbers whose default isn't 0, values that are the server's word, and server data such assb-virtual-scroll'soffsetare pointers (sb.Int(0),sb.Num(0),sb.Str("")). - Lists in a string attribute are
[]string. JSON props are Go types (sb.DropdownItem,sb.Option,sb.Column,sb.RangeValue, …), wherenilkeeps the component's default and an empty slice writes[].
- Props are fields with doc comments from the manifest. Booleans work by presence, and flags that are on by default are
- Content and attributes: content goes in as templ children, and events and Datastar attributes in
Attrs(sb.Mergejoins several sets).sb.TabSlotandsb.TabSlugnamesb-tabs' panel slots. - Loading:
sb.Importsloads Datastar and the components, pinned with their integrity hashes, from a list or through the autoloader.@sb.Tracked(sb.ImportsProps{}) { … }around<body>loads exactly the components rendered inside it, with the CSP nonce.ScriptsOnlyleaves out the import map and Datastar.sb.Collect,sb.Pin,sb.DatastarBuild,sb.Snapshot,sb.Versionandsb.Releaseserve a page that loads the files itself.
- Docs: every component page has a templ tab under Installation.
- Checks: CI fails when the wrappers are stale, and tests the module on its own. Browser tests render every component through its wrapper, with every field set, on Starbase's Datastar build and on the official release, and load a tracked page under a nonce CSP.
- Versioning: the module is tagged
templ/vX.Y.Zwith each release.
- Types: