genus

The core: g.fetch + the envelope, formatting, toasts

g.fetch + the envelope — the three-outcome check (live)

  • EVERY response is the envelope; g.fetch never throws. The check is always the same three outcomes: !res.successg.error (system), res.error.codeg.warning (business refusal, codes ≥ 1000), else use res.data.
  • Server field validation arrives in res.data.fields — former/validator place it; only handle it yourself outside forms.
  • Files in the payload make the request multipart automatically; pagination rides the options.

g.format — dates and numbers, one way (live)

Call Result
  • EVERY date/number the user sees goes through g.format — never hand-formatted strings; PG timestamps and Date objects both work.
  • The formats are install-level config — pages just call date/datetime/time/number.

The rest of the core

  • Toastsg.success/error/warning/info: rules + live demo at UI elements.
  • Dialogsg.confirm/alert/prompt: dialog.
  • Shortcuts — declarative page keys (g.shortcuts, ? overlay); the lister row keys ride it (data list).
  • g.esc — escape EVERYTHING you interpolate into HTML strings (the lister render callbacks show it).
  • g.shake — the attention shake for a refused element; pair with g.warning.
  • Client errors — window errors report to /frm/log/client automatically; you write nothing.
  • Full API: templates/app/docs/libs/genus.md; the harness: /tests/api.