Add (param :as type) annotations to defcomp params across all services and templates

Annotates ~500 defcomp params across 62 files: market (5), blog (7), cart (5),
events (3), federation (4), account (3), orders (2), shared templates (11),
sx docs (14), plus remaining spec fn params (z3, test-framework, adapter-dom,
adapter-async, engine, eval). Total annotations in codebase: 1043.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 21:01:02 +00:00
parent 98c1023b81
commit 477ce766ff
62 changed files with 537 additions and 502 deletions

View File

@@ -1,18 +1,18 @@
;; SX docs utility components
(defcomp ~doc-placeholder (&key id)
(defcomp ~doc-placeholder (&key (id :as string))
(div :id id
(div :class "bg-stone-100 rounded p-4 mt-3"
(p :class "text-stone-400 italic text-sm"
"Trigger the demo to see the actual content."))))
(defcomp ~doc-oob-code (&key target-id text)
(defcomp ~doc-oob-code (&key (target-id :as string) (text :as string))
(div :id target-id :sx-swap-oob "innerHTML"
(div :class "not-prose bg-stone-100 rounded p-4 mt-3"
(pre :class "text-sm whitespace-pre-wrap break-words"
(code text)))))
(defcomp ~doc-attr-table (&key title rows)
(defcomp ~doc-attr-table (&key (title :as string) rows)
(div :class "space-y-3"
(h3 :class "text-xl font-semibold text-stone-700" title)
(div :class "overflow-x-auto rounded border border-stone-200"
@@ -23,7 +23,7 @@
(th :class "px-3 py-2 font-medium text-stone-600 text-center w-20" "In sx?")))
(tbody rows)))))
(defcomp ~doc-headers-table (&key title rows)
(defcomp ~doc-headers-table (&key (title :as string) rows)
(div :class "space-y-3"
(h3 :class "text-xl font-semibold text-stone-700" title)
(div :class "overflow-x-auto rounded border border-stone-200"
@@ -34,7 +34,7 @@
(th :class "px-3 py-2 font-medium text-stone-600" "Description")))
(tbody rows)))))
(defcomp ~doc-headers-row (&key name value description href)
(defcomp ~doc-headers-row (&key (name :as string) (value :as string) (description :as string) (href :as string?))
(tr :class "border-b border-stone-100"
(td :class "px-3 py-2 font-mono text-sm whitespace-nowrap"
(if href
@@ -46,7 +46,7 @@
(td :class "px-3 py-2 font-mono text-sm text-stone-500" value)
(td :class "px-3 py-2 text-stone-700 text-sm" description)))
(defcomp ~doc-two-col-row (&key name description href)
(defcomp ~doc-two-col-row (&key (name :as string) (description :as string) (href :as string?))
(tr :class "border-b border-stone-100"
(td :class "px-3 py-2 font-mono text-sm whitespace-nowrap"
(if href
@@ -57,7 +57,7 @@
(span :class "text-violet-700" name)))
(td :class "px-3 py-2 text-stone-700 text-sm" description)))
(defcomp ~doc-two-col-table (&key title intro col1 col2 rows)
(defcomp ~doc-two-col-table (&key (title :as string?) (intro :as string?) (col1 :as string?) (col2 :as string?) rows)
(div :class "space-y-3"
(when title (h3 :class "text-xl font-semibold text-stone-700" title))
(when intro (p :class "text-stone-600 mb-6" intro))
@@ -82,7 +82,7 @@
;; Build attr table from a list of {name, desc, exists, href} dicts.
;; Replaces _attr_table_sx() in utils.py.
(defcomp ~doc-attr-table-from-data (&key title attrs)
(defcomp ~doc-attr-table-from-data (&key (title :as string) (attrs :as list))
(~doc-attr-table :title title
:rows (<> (map (fn (a)
(~doc-attr-row
@@ -94,7 +94,7 @@
;; Build headers table from a list of {name, value, desc} dicts.
;; Replaces _headers_table_sx() in utils.py.
(defcomp ~doc-headers-table-from-data (&key title headers)
(defcomp ~doc-headers-table-from-data (&key (title :as string) (headers :as list))
(~doc-headers-table :title title
:rows (<> (map (fn (h)
(~doc-headers-row
@@ -106,7 +106,7 @@
;; Build two-col table from a list of {name, desc} dicts.
;; Replaces the _reference_events_sx / _reference_js_api_sx builders.
(defcomp ~doc-two-col-table-from-data (&key title intro col1 col2 items)
(defcomp ~doc-two-col-table-from-data (&key (title :as string?) (intro :as string?) (col1 :as string?) (col2 :as string?) (items :as list))
(~doc-two-col-table :title title :intro intro :col1 col1 :col2 col2
:rows (<> (map (fn (item)
(~doc-two-col-row
@@ -117,7 +117,7 @@
;; Build all primitives category tables from a {category: [prim, ...]} dict.
;; Replaces _primitives_section_sx() in utils.py.
(defcomp ~doc-primitives-tables (&key primitives)
(defcomp ~doc-primitives-tables (&key (primitives :as dict))
(<> (map (fn (cat)
(~doc-primitives-table
:category cat
@@ -125,14 +125,14 @@
(keys primitives))))
;; Build all special form category sections from a {category: [form, ...]} dict.
(defcomp ~doc-special-forms-tables (&key forms)
(defcomp ~doc-special-forms-tables (&key (forms :as dict))
(<> (map (fn (cat)
(~doc-special-forms-category
:category cat
:forms (get forms cat)))
(keys forms))))
(defcomp ~doc-special-forms-category (&key category forms)
(defcomp ~doc-special-forms-category (&key (category :as string) (forms :as list))
(div :class "space-y-4"
(h3 :class "text-xl font-semibold text-stone-800 border-b border-stone-200 pb-2" category)
(div :class "space-y-4"
@@ -145,7 +145,7 @@
:example (get f "example")))
forms))))
(defcomp ~doc-special-form-card (&key name syntax doc tail-position example)
(defcomp ~doc-special-form-card (&key (name :as string) (syntax :as string) (doc :as string) (tail-position :as string) (example :as string))
(div :class "not-prose border border-stone-200 rounded-lg p-4 space-y-3"
(div :class "flex items-baseline gap-3"
(code :class "text-lg font-bold text-violet-700" name)