Merge branch 'worktree-api-urls' into macros
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
(td :class "px-3 py-2"
|
||||
(span :class "inline-block px-2 py-0.5 rounded text-xs font-bold bg-rose-500 text-white" "3"))
|
||||
(td :class "px-3 py-2 font-semibold text-stone-700" "Bridge")
|
||||
(td :class "px-3 py-2 text-stone-600" "Cross-references: which spec functions and platform primitives this function depends on. Platform deps marked with " (code "\u2B21") "."))
|
||||
(td :class "px-3 py-2 text-stone-600" "Cross-references: which spec functions and platform primitives this function depends on. Platform deps marked with " (code "⬡") "."))
|
||||
(tr :class "border-b border-stone-100"
|
||||
(td :class "px-3 py-2"
|
||||
(span :class "inline-block px-2 py-0.5 rounded text-xs font-bold bg-amber-500 text-white" "4"))
|
||||
@@ -178,7 +178,7 @@
|
||||
(span :class "inline-block px-2 py-0.5 rounded text-xs font-bold bg-sky-600 text-white uppercase" "Inc 2")
|
||||
(span :class "font-semibold text-stone-800" "Bridge + Runtime (Ring 3-4)"))
|
||||
(ul :class "list-disc pl-5 text-sm text-stone-600 space-y-1"
|
||||
(li "Cross-reference index: function\u2192slug mapping across all spec files")
|
||||
(li "Cross-reference index: function→slug mapping across all spec files")
|
||||
(li "Platform dependency detection (ref not in index = platform primitive)")
|
||||
(li "Test file parsing: " (code "defsuite") "/" (code "deftest") " structure extraction")
|
||||
(li "Test-to-function matching")
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
(tr :class "border-b border-stone-100"
|
||||
(td :class "py-2 px-3 font-semibold" "Verify")
|
||||
(td :class "py-2 px-3" "Environment images")
|
||||
(td :class "py-2 px-3" "Spec CID \u2192 image CID \u2192 endpoint provenance"))))))
|
||||
(td :class "py-2 px-3" "Spec CID → image CID → endpoint provenance"))))))
|
||||
|
||||
(~docs/section :title "Embedded Claude Code" :id "claude-code"
|
||||
(p "Claude Code sessions run inside the browser as reactive islands. "
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
(p :class "text-stone-600"
|
||||
"The deep result. The SX evaluator executes " (code "z3.sx") ", which reads SX spec files and emits formal logic. Then the SX evaluator executes " (code "prove.sx") ", which parses that logic and proves properties about it. The specification, the translator, and the prover are all written in the same language, operating on the same data structures.")
|
||||
(p :class "text-stone-600"
|
||||
"The pipeline: " (code "SX spec") " \u2192 " (code "SX translator") " \u2192 " (code "formal logic") " \u2192 " (code "SX prover") " \u2192 " (code "proof") ". At every step, SX is both the subject and the tool. The system is verifying its own foundations using its own machinery.")
|
||||
"The pipeline: " (code "SX spec") " → " (code "SX translator") " → " (code "formal logic") " → " (code "SX prover") " → " (code "proof") ". At every step, SX is both the subject and the tool. The system is verifying its own foundations using its own machinery.")
|
||||
(div :class "rounded border border-amber-200 bg-amber-50 p-4 mt-3"
|
||||
(p :class "text-sm text-amber-800 font-semibold mb-2" "The strange loop")
|
||||
(p :class "text-sm text-amber-700"
|
||||
@@ -226,7 +226,7 @@
|
||||
(tr :class "text-stone-700 border-t border-stone-200"
|
||||
(td :class "py-2 pr-4 font-mono text-xs" "3")
|
||||
(td :class "py-2 pr-4 font-mono text-xs" "properties")
|
||||
(td :class "py-2 pr-4 font-mono text-xs" "prove.sx \u2192 z3-expr")
|
||||
(td :class "py-2 pr-4 font-mono text-xs" "prove.sx → z3-expr")
|
||||
(td :class "py-2" "SMT-LIB for Z3 (unbounded)"))
|
||||
(tr :class "text-stone-400 border-t border-stone-200"
|
||||
(td :class "py-2 pr-4 font-mono text-xs" "4")
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
(p "Named stores solve all three. A store is a named collection of signals that lives at " (em "page") " scope, not island scope."))
|
||||
|
||||
(~docs/section :title "def-store / use-store" :id "api"
|
||||
(~docs/code :code (highlight ";; Create a named store — called once at page level\n;; The init function creates signals and computeds\n(def-store \"cart\" (fn ()\n (let ((items (signal (list))))\n (dict\n :items items\n :count (computed (fn () (length (deref items))))\n :total (computed (fn () (reduce + 0\n (map (fn (i) (get i \"price\")) (deref items)))))))))\n\n;; Use the store from any island — returns the signal dict\n(defisland ~reactive-islands/named-stores/cart-badge ()\n (let ((store (use-store \"cart\")))\n (span :class \"badge bg-violet-100 text-violet-800 px-2 py-1 rounded-full\"\n (deref (get store \"count\")))))\n\n(defisland ~reactive-islands/named-stores/cart-drawer ()\n (let ((store (use-store \"cart\")))\n (div :class \"p-4\"\n (h2 \"Cart\")\n (ul (map (fn (item)\n (li :class \"flex justify-between py-1\"\n (span (get item \"name\"))\n (span :class \"text-stone-500\" \"\\u00A3\" (get item \"price\"))))\n (deref (get store \"items\"))))\n (div :class \"border-t pt-2 font-semibold\"\n \"Total: \\u00A3\" (deref (get store \"total\"))))))" "lisp"))
|
||||
(~docs/code :code (highlight ";; Create a named store — called once at page level\n;; The init function creates signals and computeds\n(def-store \"cart\" (fn ()\n (let ((items (signal (list))))\n (dict\n :items items\n :count (computed (fn () (length (deref items))))\n :total (computed (fn () (reduce + 0\n (map (fn (i) (get i \"price\")) (deref items)))))))))\n\n;; Use the store from any island — returns the signal dict\n(defisland ~reactive-islands/named-stores/cart-badge ()\n (let ((store (use-store \"cart\")))\n (span :class \"badge bg-violet-100 text-violet-800 px-2 py-1 rounded-full\"\n (deref (get store \"count\")))))\n\n(defisland ~reactive-islands/named-stores/cart-drawer ()\n (let ((store (use-store \"cart\")))\n (div :class \"p-4\"\n (h2 \"Cart\")\n (ul (map (fn (item)\n (li :class \"flex justify-between py-1\"\n (span (get item \"name\"))\n (span :class \"text-stone-500\" \"\£\" (get item \"price\"))))\n (deref (get store \"items\"))))\n (div :class \"border-t pt-2 font-semibold\"\n \"Total: \£\" (deref (get store \"total\"))))))" "lisp"))
|
||||
|
||||
(p (code "def-store") " is " (strong "idempotent") " — calling it again with the same name returns the existing store. This means multiple components can call " (code "def-store") " defensively without double-creating."))
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
(~docs/table
|
||||
:headers (list "Primitive" "Direction" "Boundary" "When")
|
||||
:rows (list
|
||||
(list "spread" "child \u2192 parent" "element boundary" "render time")
|
||||
(list "collect!" "child \u2192 ancestor" "render tree" "render time")
|
||||
(list "reactive-spread" "child \u2192 parent" "element boundary" "signal change")))
|
||||
(list "spread" "child → parent" "element boundary" "render time")
|
||||
(list "collect!" "child → ancestor" "render tree" "render time")
|
||||
(list "reactive-spread" "child → parent" "element boundary" "signal change")))
|
||||
|
||||
(~docs/subsection :title "Server rendering (HTML adapter)"
|
||||
(p "On the server, " (code "~cssx/tw") " returns a spread. The HTML renderer "
|
||||
@@ -105,9 +105,9 @@
|
||||
"tokens, " (code "reactive-spread") " makes it live.")
|
||||
(p "But " (code "~cssx/tw") " is just one instance. The same primitives enable:")
|
||||
(ul :class "list-disc pl-5 space-y-1 text-stone-600"
|
||||
(li (code "~aria") " \u2014 reactive accessibility attributes driven by UI state")
|
||||
(li (code "~data-attrs") " \u2014 signal-driven data attributes for coordination")
|
||||
(li (code "~conditional-attrs") " \u2014 presence/absence of attributes based on state")
|
||||
(li (code "~aria") " — reactive accessibility attributes driven by UI state")
|
||||
(li (code "~data-attrs") " — signal-driven data attributes for coordination")
|
||||
(li (code "~conditional-attrs") " — presence/absence of attributes based on state")
|
||||
(li "Any component that needs to inject attributes onto its parent")))
|
||||
|
||||
;; =====================================================================
|
||||
@@ -120,7 +120,7 @@
|
||||
(~docs/code :code (highlight ";; Define once\n(define heading-style (~cssx/tw :tokens \"text-violet-700 text-2xl font-bold\"))\n(define nav-link (~cssx/tw :tokens \"text-stone-500 text-sm\"))\n(define card-base (~cssx/tw :tokens \"bg-stone-50 rounded-lg p-4\"))\n\n;; Use everywhere\n(div card-base\n (h1 heading-style \"Title\")\n (a nav-link :href \"/\" \"Home\"))" "lisp"))
|
||||
(p "These are semantic names wrapping utility tokens. Change the definition, "
|
||||
"every use updates. No build step, no CSS-in-JS runtime. Just " (code "define") ".")
|
||||
(p "Namespacing prevents clashes \u2014 " (code "~app/heading") " vs "
|
||||
(p "Namespacing prevents clashes — " (code "~app/heading") " vs "
|
||||
(code "~admin/heading") " are different components in different namespaces."))
|
||||
|
||||
;; =====================================================================
|
||||
@@ -131,15 +131,15 @@
|
||||
(p "React can't do this. In React, attributes live in the parent's JSX. "
|
||||
"A child component cannot inject attrs onto its parent element. You'd need "
|
||||
"to lift state up, pass callbacks, use context, or reach for " (code "forwardRef")
|
||||
" \u2014 all of which couple the child to the parent's rendering logic.")
|
||||
" — all of which couple the child to the parent's rendering logic.")
|
||||
(p "CSS-in-JS libraries (styled-components, Emotion) create " (em "wrapper elements")
|
||||
". They don't inject attrs onto an existing element from a child position. "
|
||||
"And they need a build step, a runtime, a theme provider.")
|
||||
(p "SX does it with three orthogonal primitives that already existed for other reasons:")
|
||||
(ul :class "list-disc pl-5 space-y-1 text-stone-600"
|
||||
(li (strong "spread") " \u2014 child-to-parent attr injection (existed for component composition)")
|
||||
(li (strong "collect!") " \u2014 render-time accumulation (existed for CSS rule batching)")
|
||||
(li (strong "reactive-spread") " \u2014 just the obvious combination of spread + effect"))
|
||||
(li (strong "spread") " — child-to-parent attr injection (existed for component composition)")
|
||||
(li (strong "collect!") " — render-time accumulation (existed for CSS rule batching)")
|
||||
(li (strong "reactive-spread") " — just the obvious combination of spread + effect"))
|
||||
(p "No new concepts. No new runtime. No new API surface."))
|
||||
|
||||
;; =====================================================================
|
||||
@@ -150,15 +150,15 @@
|
||||
(p "Spread and collect are both instances of the same pattern: "
|
||||
(strong "child communicates upward through the render tree") ". "
|
||||
"The general form is " (code "provide") "/" (code "context") "/" (code "emit!")
|
||||
" \u2014 render-time dynamic scope.")
|
||||
" — render-time dynamic scope.")
|
||||
|
||||
(~docs/subsection :title "The unification"
|
||||
(~docs/table
|
||||
:headers (list "Current" "General form" "Direction")
|
||||
:rows (list
|
||||
(list "collect! / collected" "emit! / emitted" "upward (child \u2192 scope)")
|
||||
(list "make-spread" "emit! into implicit parent-attrs provider" "upward (child \u2192 parent)")
|
||||
(list "(nothing yet)" "context" "downward (scope \u2192 child)")))
|
||||
(list "collect! / collected" "emit! / emitted" "upward (child → scope)")
|
||||
(list "make-spread" "emit! into implicit parent-attrs provider" "upward (child → parent)")
|
||||
(list "(nothing yet)" "context" "downward (scope → child)")))
|
||||
(p (code "provide") " creates a named scope with a value (downward) and an accumulator (upward). "
|
||||
(code "context") " reads the value. " (code "emit!") " appends to the accumulator. "
|
||||
(code "emitted") " retrieves accumulated values.")
|
||||
@@ -170,8 +170,8 @@
|
||||
(li (code "collect!") " = " (code "emit!") " with deduplication")
|
||||
(li (code "spread") " = " (code "emit!") " into implicit parent-attrs provider")
|
||||
(li (code "collected") " = " (code "emitted"))
|
||||
(li (code "context") " = downward data flow (new capability \u2014 no current equivalent)"))
|
||||
(p "The reactive-spread we just built would naturally follow \u2014 the effect tracks "
|
||||
(li (code "context") " = downward data flow (new capability — no current equivalent)"))
|
||||
(p "The reactive-spread we just built would naturally follow — the effect tracks "
|
||||
"signal deps in the " (code "emit!") " call, the provider accumulates, the element applies.")
|
||||
(p :class "text-stone-500 italic"
|
||||
"This is the planned next step. The current primitives (spread, collect, reactive-spread) "
|
||||
|
||||
Reference in New Issue
Block a user