Send all responses as sexp wire format with client-side rendering
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m35s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m35s
- Server sends sexp source text, client (sexp.js) renders everything - SexpExpr marker class for nested sexp composition in serialize() - sexp_page() HTML shell with data-mount="body" for full page loads - sexp_response() returns text/sexp for OOB/partial responses - ~app-body layout component replaces ~app-layout (no raw!) - ~rich-text is the only component using raw! (for CMS HTML content) - Fragment endpoints return text/sexp, auto-wrapped in SexpExpr - All _*_html() helpers converted to _*_sexp() returning sexp source - Head auto-hoist: sexp.js moves meta/title/link/script[ld+json] from rendered body to document.head automatically - Unknown components render warning box instead of crashing page - Component kwargs preserve AST for lazy rendering (fixes <> in kwargs) - Fix unterminated paren in events/sexp/tickets.sexpr Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
(defcomp ~cart-badge (&key icon text)
|
||||
(span :class "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-stone-100"
|
||||
(i :class icon :aria-hidden "true") (raw! text)))
|
||||
(i :class icon :aria-hidden "true") text))
|
||||
|
||||
(defcomp ~cart-badges-wrap (&key badges-html)
|
||||
(defcomp ~cart-badges-wrap (&key badges)
|
||||
(div :class "mt-1 flex flex-wrap gap-2 text-xs text-stone-600"
|
||||
(raw! badges-html)))
|
||||
badges))
|
||||
|
||||
(defcomp ~cart-group-card-img (&key src alt)
|
||||
(img :src src :alt alt :class "h-16 w-16 rounded-xl object-cover border border-stone-200 flex-shrink-0"))
|
||||
@@ -16,29 +16,29 @@
|
||||
(i :class "fa fa-store text-stone-400 text-xl" :aria-hidden "true")))
|
||||
|
||||
(defcomp ~cart-mp-subtitle (&key title)
|
||||
(p :class "text-xs text-stone-500 truncate" (raw! title)))
|
||||
(p :class "text-xs text-stone-500 truncate" title))
|
||||
|
||||
(defcomp ~cart-group-card (&key href img-html display-title subtitle-html badges-html total)
|
||||
(defcomp ~cart-group-card (&key href img display-title subtitle badges total)
|
||||
(a :href href :class "block rounded-2xl border border-stone-200 bg-white shadow-sm hover:shadow-md hover:border-stone-300 transition p-4 sm:p-5"
|
||||
(div :class "flex items-start gap-4"
|
||||
(raw! img-html)
|
||||
img
|
||||
(div :class "flex-1 min-w-0"
|
||||
(h3 :class "text-base sm:text-lg font-semibold text-stone-900 truncate" (raw! display-title))
|
||||
(raw! subtitle-html) (raw! badges-html))
|
||||
(h3 :class "text-base sm:text-lg font-semibold text-stone-900 truncate" display-title)
|
||||
subtitle badges)
|
||||
(div :class "text-right flex-shrink-0"
|
||||
(div :class "text-lg font-bold text-stone-900" (raw! total))
|
||||
(div :class "text-lg font-bold text-stone-900" total)
|
||||
(div :class "mt-1 text-xs text-emerald-700 font-medium" "View cart \u2192")))))
|
||||
|
||||
(defcomp ~cart-orphan-card (&key badges-html total)
|
||||
(defcomp ~cart-orphan-card (&key badges total)
|
||||
(div :class "rounded-2xl border border-dashed border-amber-300 bg-amber-50/60 p-4 sm:p-5"
|
||||
(div :class "flex items-start gap-4"
|
||||
(div :class "h-16 w-16 rounded-xl bg-amber-100 flex items-center justify-center flex-shrink-0"
|
||||
(i :class "fa fa-shopping-cart text-amber-500 text-xl" :aria-hidden "true"))
|
||||
(div :class "flex-1 min-w-0"
|
||||
(h3 :class "text-base sm:text-lg font-semibold text-stone-900" "Other items")
|
||||
(raw! badges-html))
|
||||
badges)
|
||||
(div :class "text-right flex-shrink-0"
|
||||
(div :class "text-lg font-bold text-stone-900" (raw! total))))))
|
||||
(div :class "text-lg font-bold text-stone-900" total)))))
|
||||
|
||||
(defcomp ~cart-empty ()
|
||||
(div :class "max-w-full px-3 py-3 space-y-3"
|
||||
@@ -47,6 +47,6 @@
|
||||
(i :class "fa fa-shopping-cart text-stone-500 text-sm sm:text-base" :aria-hidden "true"))
|
||||
(p :class "text-base sm:text-lg font-medium text-stone-800" "Your cart is empty"))))
|
||||
|
||||
(defcomp ~cart-overview-panel (&key cards-html)
|
||||
(defcomp ~cart-overview-panel (&key cards)
|
||||
(div :class "max-w-full px-3 py-3 space-y-3"
|
||||
(div :class "space-y-4" (raw! cards-html))))
|
||||
(div :class "space-y-4" cards)))
|
||||
|
||||
Reference in New Issue
Block a user