more plans
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 12m0s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 12m0s
This commit is contained in:
@@ -6904,7 +6904,9 @@ return (isSxTruthy((_batchDepth == 0)) ? (function() {
|
||||
_renderDOM: renderDOM,
|
||||
};
|
||||
|
||||
global.Sx = Sx;
|
||||
// OLD hand-written Sx object — NOT exported. The ref-generated Sx (line 5336) is authoritative.
|
||||
// Reassign local Sx to the ref version so SxEngine (below) uses spec-generated eval/render.
|
||||
Sx = global.Sx;
|
||||
|
||||
// --- SxEngine — native fetch/swap/history engine ---
|
||||
|
||||
|
||||
@@ -400,6 +400,10 @@ def components_for_page(page_sx: str, service: str | None = None) -> tuple[str,
|
||||
parts.append(f"(defisland ~{val.name} {params_sx} {body_sx})")
|
||||
elif isinstance(val, Component):
|
||||
if f"~{val.name}" in needed or key in needed:
|
||||
# Skip server-affinity components — they're expanded server-side
|
||||
# and the client doesn't have the define values they depend on.
|
||||
if val.render_target == "server":
|
||||
continue
|
||||
param_strs = ["&key"] + list(val.params)
|
||||
if val.has_children:
|
||||
param_strs.extend(["&rest", "children"])
|
||||
|
||||
62
shared/sx/templates/shell.sx
Normal file
62
shared/sx/templates/shell.sx
Normal file
@@ -0,0 +1,62 @@
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; Page shell — the outermost HTML document structure
|
||||
;;
|
||||
;; Replaces the Python HTML string template. All page data is computed in
|
||||
;; Python and passed as keyword arguments. The component just arranges
|
||||
;; the precomputed values into HTML structure.
|
||||
;;
|
||||
;; raw! is used for:
|
||||
;; - <!doctype html> (not an element)
|
||||
;; - Script/style content (must not be HTML-escaped)
|
||||
;; - Pre-rendered meta HTML from callers
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
||||
(defcomp ~sx-page-shell (&key title meta-html csrf
|
||||
sx-css sx-css-classes
|
||||
component-hash component-defs
|
||||
pages-sx page-sx
|
||||
asset-url sx-js-hash body-js-hash)
|
||||
(<>
|
||||
(raw! "<!doctype html>")
|
||||
(html :lang "en"
|
||||
(head
|
||||
(meta :charset "utf-8")
|
||||
(meta :name "viewport" :content "width=device-width, initial-scale=1")
|
||||
(meta :name "robots" :content "index,follow")
|
||||
(meta :name "theme-color" :content "#ffffff")
|
||||
(title title)
|
||||
(when meta-html (raw! meta-html))
|
||||
(style (raw! "@media (min-width: 768px) { .js-mobile-sentinel { display:none !important; } }"))
|
||||
(meta :name "csrf-token" :content csrf)
|
||||
(style :id "sx-css" (raw! (or sx-css "")))
|
||||
(meta :name "sx-css-classes" :content (or sx-css-classes ""))
|
||||
;; CDN scripts
|
||||
(script :src "https://unpkg.com/prismjs/prism.js")
|
||||
(script :src "https://unpkg.com/prismjs/components/prism-javascript.min.js")
|
||||
(script :src "https://unpkg.com/prismjs/components/prism-python.min.js")
|
||||
(script :src "https://unpkg.com/prismjs/components/prism-bash.min.js")
|
||||
(script :src "https://cdn.jsdelivr.net/npm/sweetalert2@11")
|
||||
;; Inline JS
|
||||
(script (raw! "if(matchMedia('(hover:hover) and (pointer:fine)').matches){document.documentElement.classList.add('hover-capable')}"))
|
||||
(script (raw! "document.addEventListener('click',function(e){var t=e.target.closest('[data-close-details]');if(!t)return;var d=t.closest('details');if(d)d.removeAttribute('open')})"))
|
||||
;; Inline CSS
|
||||
(style (raw! "details[data-toggle-group=\"mobile-panels\"]>summary{list-style:none}
|
||||
details[data-toggle-group=\"mobile-panels\"]>summary::-webkit-details-marker{display:none}
|
||||
@media(min-width:768px){.nav-group:focus-within .submenu,.nav-group:hover .submenu{display:block}}
|
||||
img{max-width:100%;height:auto}
|
||||
.clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
||||
.clamp-3{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
|
||||
.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}
|
||||
details.group{overflow:hidden}details.group>summary{list-style:none}details.group>summary::-webkit-details-marker{display:none}
|
||||
.sx-indicator{display:none}.sx-request .sx-indicator{display:inline-flex}
|
||||
.sx-error .sx-indicator{display:none}.sx-loading .sx-indicator{display:inline-flex}
|
||||
.js-wrap.open .js-pop{display:block}.js-wrap.open .js-backdrop{display:block}")))
|
||||
(body :class "bg-stone-50 text-stone-900"
|
||||
(script :type "text/sx" :data-components true :data-hash component-hash
|
||||
(raw! (or component-defs "")))
|
||||
(script :type "text/sx-pages"
|
||||
(raw! (or pages-sx "")))
|
||||
(script :type "text/sx" :data-mount "body"
|
||||
(raw! (or page-sx "")))
|
||||
(script :src (str asset-url "/scripts/sx-browser.js?v=" sx-js-hash))
|
||||
(script :src (str asset-url "/scripts/body.js?v=" body-js-hash))))))
|
||||
Reference in New Issue
Block a user