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,7 +2,7 @@
|
||||
|
||||
(defcomp ~market-cart-add-empty (&key cart-id action csrf)
|
||||
(div :id cart-id
|
||||
(form :action action :method "post" :hx-post action :hx-target "#cart-mini" :hx-swap "outerHTML" :class "rounded flex items-center"
|
||||
(form :action action :method "post" :sx-post action :sx-target "#cart-mini" :sx-swap "outerHTML" :class "rounded flex items-center"
|
||||
(input :type "hidden" :name "csrf_token" :value csrf)
|
||||
(input :type "hidden" :name "count" :value "1")
|
||||
(button :type "submit" :class "relative inline-flex items-center justify-center text-sm font-medium text-stone-500 hover:bg-emerald-50"
|
||||
@@ -12,7 +12,7 @@
|
||||
(defcomp ~market-cart-add-quantity (&key cart-id action csrf minus-val plus-val quantity cart-href)
|
||||
(div :id cart-id
|
||||
(div :class "rounded flex items-center gap-2"
|
||||
(form :action action :method "post" :hx-post action :hx-target "#cart-mini" :hx-swap "outerHTML"
|
||||
(form :action action :method "post" :sx-post action :sx-target "#cart-mini" :sx-swap "outerHTML"
|
||||
(input :type "hidden" :name "csrf_token" :value csrf)
|
||||
(input :type "hidden" :name "count" :value minus-val)
|
||||
(button :type "submit" :class "inline-flex items-center justify-center w-8 h-8 text-sm font-medium rounded-full border border-emerald-600 text-emerald-700 hover:bg-emerald-50 text-xl" "-"))
|
||||
@@ -21,13 +21,13 @@
|
||||
(i :class "fa-solid fa-shopping-cart text-2xl" :aria-hidden "true")
|
||||
(span :class "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none"
|
||||
(span :class "flex items-center justify-center bg-black text-white rounded-full w-4 h-4 text-xs font-bold" quantity))))
|
||||
(form :action action :method "post" :hx-post action :hx-target "#cart-mini" :hx-swap "outerHTML"
|
||||
(form :action action :method "post" :sx-post action :sx-target "#cart-mini" :sx-swap "outerHTML"
|
||||
(input :type "hidden" :name "csrf_token" :value csrf)
|
||||
(input :type "hidden" :name "count" :value plus-val)
|
||||
(button :type "submit" :class "inline-flex items-center justify-center w-8 h-8 text-sm font-medium rounded-full border border-emerald-600 text-emerald-700 hover:bg-emerald-50 text-xl" "+")))))
|
||||
|
||||
(defcomp ~market-cart-mini-count (&key href count)
|
||||
(div :id "cart-mini" :hx-swap-oob "outerHTML"
|
||||
(div :id "cart-mini" :sx-swap-oob "outerHTML"
|
||||
(a :href href :class "relative inline-flex items-center justify-center"
|
||||
(span :class "relative inline-flex items-center justify-center"
|
||||
(i :class "fa-solid fa-shopping-cart text-xl" :aria-hidden "true")
|
||||
@@ -36,9 +36,10 @@
|
||||
count))))))
|
||||
|
||||
(defcomp ~market-cart-mini-empty (&key href logo)
|
||||
(div :id "cart-mini" :hx-swap-oob "outerHTML"
|
||||
(div :id "cart-mini" :sx-swap-oob "outerHTML"
|
||||
(a :href href :class "relative inline-flex items-center justify-center"
|
||||
(img :src logo :class "h-8 w-8 rounded-full object-cover border border-stone-300" :alt ""))))
|
||||
|
||||
(defcomp ~market-cart-add-oob (&key id inner-html)
|
||||
(div :id id :hx-swap-oob "outerHTML" (raw! inner-html)))
|
||||
(defcomp ~market-cart-add-oob (&key id content inner)
|
||||
(div :id id :sx-swap-oob "outerHTML"
|
||||
(if content content (when inner inner))))
|
||||
|
||||
Reference in New Issue
Block a user