Commit Graph

641 Commits

Author SHA1 Message Date
c55f0956bc Bootstrap stores + event bridge, add island hydration to boot.sx
- signals.sx: fix has? → has-key?, add def-store/use-store/clear-stores
  (L3 named stores), emit-event/on-event/bridge-event (event bridge)
- boot.sx: add sx-hydrate-islands, hydrate-island, dispose-island
  for client-side island hydration from SSR output
- bootstrap_js.py: add RENAMES, platform fns (domListen, eventDetail,
  domGetData, jsonParse), public API exports for all new functions
- bootstrap_py.py: add RENAMES, server-side no-op stubs for DOM events
- Regenerate sx-ref.js (with boot adapter) and sx_ref.py
- Update reactive-islands status: hydration, stores, bridge all spec'd

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 11:13:18 +00:00
5b70cd5cfc Spec event bridge and named stores, move plan to reactive islands section
- signals.sx: add def-store/use-store/clear-stores (L3 named stores)
  and emit-event/on-event/bridge-event (lake→island DOM events)
- reactive-islands.sx: add event bridge, named stores, and plan pages
- Remove ~plan-reactive-islands-content from plans.sx
- Update nav-data.sx and docs.sx routing accordingly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:59:58 +00:00
0da5dc41e1 Add Reactive Islands as top-level section in sx-docs
- New nav entry in ~sx-main-nav (layouts.sx)
- Nav items: Overview, Demo, Plan link (nav-data.sx)
- Overview page: architecture quadrant, four levels, signal primitives,
  island lifecycle, implementation status table with done/todo
- Demo page: annotated code examples for signal+computed+effect, batch,
  cleanup, computed chains, defisland, test suite
- defpage routes: /reactive-islands/ and /reactive-islands/<slug>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:37:39 +00:00
57ff7705c7 Merge branch 'worktree-react' into macros 2026-03-08 10:22:08 +00:00
c344b0d7b0 Regenerate sx_ref.py with deps + signals spec modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:22:04 +00:00
baa9d66a59 Auto-include deps and signals spec modules with HTML adapter
The Python bootstrapper now auto-includes deps (component analysis)
and signals (reactive islands) when the HTML adapter is present,
matching production requirements where sx_ref.py must export
compute_all_deps, transitive_deps, page_render_plan, etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:21:52 +00:00
cf2e386cda Merge branch 'worktree-react' into macros
# Conflicts:
#	shared/sx/tests/run.py
2026-03-08 10:17:40 +00:00
fe289287ec Transpile signals.sx to JS and Python via bootstrappers
Both bootstrappers now handle the full signal runtime:
- &rest lambda params → JS arguments.slice / Python *args
- Signal/Island/TrackingContext platform functions in both hosts
- RENAMES for all signal, island, tracking, and reactive DOM identifiers
- signals auto-included with DOM adapter (JS) and HTML adapter (Python)
- Signal API exports on Sx object (signal, deref, reset, swap, computed, effect, batch)
- New DOM primitives: createComment, domRemove, domChildNodes, domRemoveChildrenAfter, domSetData
- jsonSerialize/isEmptyDict for island state serialization
- Demo HTML page exercising all signal primitives

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:17:16 +00:00
26320abd64 Add signal test suite (17/17) and Island type to evaluator
test-signals.sx: 17 tests covering signal basics (create, deref, reset!,
swap!), computed (derive, update, chain), effects (run, re-run, dispose,
cleanup), batch (deferred deduped notifications), and defisland (create,
call, children).

types.py: Island dataclass mirroring Component but for reactive boundaries.
evaluator.py: sf_defisland special form, Island in call dispatch.
run.py: Signal platform primitives (make-signal, tracking context, etc)
  and native effect/computed/batch implementations that bridge Lambda
  calls across the Python↔SX boundary.
signals.sx: Updated batch to deduplicate subscribers across signals.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 09:44:18 +00:00
a97f4c0e39 Add reactive islands spec: signals.sx + defisland across all adapters
New spec file signals.sx defines the signal runtime: signal, computed,
effect, deref, reset!, swap!, batch, dispose, and island scope tracking.

eval.sx: defisland special form + island? type predicate in eval-call.
boundary.sx: signal primitive declarations (Tier 3).
render.sx: defisland in definition-form?.
adapter-dom.sx: render-dom-island with reactive context, reactive-text,
  reactive-attr, reactive-fragment, reactive-list helpers.
adapter-html.sx: render-html-island for SSR with data-sx-island/state.
adapter-sx.sx: island? handling in wire format serialization.
special-forms.sx: defisland declaration with docs and example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 09:34:47 +00:00
391a0c675b Merge branch 'worktree-zero-tooling-essay' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 17m16s
2026-03-08 02:04:47 +00:00
145028ccc0 Declare Phase 7c+7d page helpers in boundary.sx and register orchestration tests in app runner
Adds optimistic-demo-data, action:add-demo-item, offline-demo-data
to boundary spec. Adds orchestration test spec to in-app test runner
with mocked platform functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:04:42 +00:00
c7c824c488 Merge branch 'worktree-zero-tooling-essay' into macros 2026-03-08 01:53:32 +00:00
7f665d874c Add orchestration test suite: 17 tests for Phase 7c+7d
Tests cover page data cache, optimistic cache update/revert/confirm,
offline connectivity tracking, offline queue mutation, and offline-aware
routing. Registered in test runner with mocked platform functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:53:27 +00:00
599964c39c Merge branch 'worktree-react' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 13m13s
2026-03-08 01:45:12 +00:00
b2aaa3786d Add Reactive Islands plan to sx-docs
Design plan for client-side state via signals and islands — a second
sliding bar (reactivity) orthogonal to the existing isomorphism bar.
Covers signal primitives, defisland, shared state, reactive DOM
rendering, SSR hydration, and spec architecture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:44:58 +00:00
2d38a76f0b Merge worktree-zero-tooling-essay into macros
Resolves conflicts by keeping both:
- HEAD: cache invalidation, service worker, sw-post-message
- Worktree: optimistic mutations, offline queue, action endpoint
Plans.sx unified with combined 7c/7d documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:33:49 +00:00
5f20a16aa0 Phase 7c + 7d: optimistic data updates and offline mutation queue
7c — Optimistic Data Updates:
- orchestration.sx: optimistic-cache-update/revert/confirm + submit-mutation
- pages.py: mount_action_endpoint at /sx/action/<name> for client mutations
- optimistic-demo.sx: live demo with todo list, pending/confirmed/reverted states
- helpers.py: demo data + add-demo-item action handler

7d — Offline Data Layer:
- orchestration.sx: connectivity tracking, offline-queue-mutation, offline-sync,
  offline-aware-mutation (routes online→submit, offline→queue)
- offline-demo.sx: live demo with notes, connectivity indicator, sync timeline
- helpers.py: offline demo data

Also updates plans.sx: marks Phase 7 fully complete (all 6 sub-phases 7a-7f).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:30:12 +00:00
dba5bf05fa Merge branch 'worktree-zero-tooling-essay' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 7m17s
2026-03-08 01:14:13 +00:00
4c1853bc7b Rename essay titles and add broken keyboard anecdote
- "Zero-Tooling" → "Tools for Fools"
- "Separation of Concerns" → "Separate your Own Concerns"
- Bold "...and yet." after Carson Gross reference
- Add broken keyboard origin story
- Fix language list (never Lisp)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:14:10 +00:00
3cbdfd8f7f Merge branch 'worktree-zero-tooling-essay' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 9m58s
2026-03-08 00:50:16 +00:00
7f1dad6bfd Add zero-tooling web development essay
New essay arguing SX eliminates the entire conventional web toolchain
(bundlers, transpilers, package managers, CSS tools, dev servers, linters,
type checkers, framework CLIs) and that agentic AI replaces the code editor
itself. Links Carson Gross's "Yes, and..." essay with a Zen Buddhism framing
of the write→read→describe progression.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:50:09 +00:00
0ce3f95d6c Phase 7c+7d: cache invalidation + offline data layer
7c: Client data cache management via element attributes
(sx-cache-invalidate) and response headers (SX-Cache-Invalidate,
SX-Cache-Update). Programmatic API: invalidate-page-cache,
invalidate-all-page-cache, update-page-cache.

7d: Service Worker (sx-sw.js) with IndexedDB for offline-capable
data caching. Network-first for /sx/data/ and /sx/io/, stale-while-
revalidate for /static/. Cache invalidation propagates from
in-memory cache to SW via postMessage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:45:33 +00:00
9a707dbe56 Merge branch 'worktree-cssx-components' into macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 14m0s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:25:22 +00:00
069d7e7090 Consolidate CSSX docs: add delivery page, remove old CSS docs and plan
Moved on-demand CSS delivery protocol from docs/css into /cssx/delivery,
framed as one strategy among several. Removed the CSSX Components plan
(now redundant with the top-level /cssx/ section).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:24:24 +00:00
09947262a5 Add CSSX as top-level docs section with patterns, async, and live examples
New top-level section in sx-docs: /cssx/ with 6 pages:
- Overview: the idea, what changed, advantages
- Patterns: class mapping, data-driven, style functions, responsive, emitting CSS
- Async CSS: components that fetch/cache CSS before rendering via ~suspense
- Live Styles: SSE/WS examples for real-time style updates (noted as future)
- Comparisons: vs styled-components, CSS Modules, Tailwind, Vanilla Extract
- Philosophy: proof by deletion, the right abstraction level

Also:
- Remove CSSX from specs nav (spec file deleted)
- Fix renderer spec prose (no longer mentions StyleValue)
- Update On-Demand CSS essay summary
- Mark CSSX Components plan as done

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:15:39 +00:00
ec52e2116e Fix affinity demo: pass page-plans to content component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:13:48 +00:00
657b631700 Phase 7f: universal page descriptor + render plan visibility
defpage is already portable: server executes via execute_page(),
client via try-client-route. Add render plan logging to client
routing so console shows boundary decisions on navigation:
"sx:route plan pagename — N server, M client"

Mark Phase 7 (Full Isomorphism) as complete:
- 7a: affinity annotations + render-target
- 7b: page render plans (boundary optimizer)
- 7e: cross-host isomorphic testing (61 tests)
- 7f: universal page descriptor + visibility

7c (optimistic updates) and 7d (offline data) remain as future work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:10:45 +00:00
32ca059ed7 Phase 7e: isomorphic testing — cross-host Python/JS comparison
61 tests evaluate the same SX expressions on both Python (sx_ref.py)
and JS (sx-browser.js via Node.js), comparing output:
- 37 eval tests (arithmetic, strings, collections, logic, HO forms)
- 24 render tests (elements, attrs, void elements, components, escaping)

All pass — both hosts produce identical results from the same spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:08:25 +00:00
2da80c69ed Phase 7b: page render plans — per-page boundary optimizer
Add page-render-plan to deps.sx: given page source + env + IO names,
computes a dict mapping each needed component to "server" or "client",
with server/client lists and IO dep collection. 5 new spec tests.

Integration:
- PageDef.render_plan field caches the plan at registration
- compute_page_render_plans() called from auto_mount_pages()
- Client page registry includes :render-plan per page
- Affinity demo page shows per-page render plans

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:02:53 +00:00
a8bfff9e0b Remove CSSX style dictionary infrastructure — styling is just components
The entire parallel CSS system (StyleValue type, style dictionary,
keyword atom resolver, content-addressed class generation, runtime
CSS injection, localStorage caching) was built but never adopted —
the codebase already uses :class strings with defcomp components
for all styling. Remove ~3,000 lines of unused infrastructure.

Deleted:
- cssx.sx spec module (317 lines)
- style_dict.py (782 lines) and style_resolver.py (254 lines)
- StyleValue type, defkeyframes special form, build-keyframes platform fn
- Style dict JSON delivery (<script type="text/sx-styles">), cookies, localStorage
- css/merge-styles primitives, inject-style-value, fnv1a-hash platform interface

Simplified:
- defstyle now binds any value (string, function) — no StyleValue type needed
- render-attrs no longer special-cases :style StyleValue → class conversion
- Boot sequence skips style dict init step

Preserved:
- tw.css parsing + CSS class delivery (SX-Css headers, <style id="sx-css">)
- All component infrastructure (defcomp, caching, bundling, deps)
- defstyle as a binding form for reusable class strings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 00:00:23 +00:00
a70ff2b153 Phase 7a: affinity annotations + fix parser escape sequences
Add :affinity :client/:server/:auto annotations to defcomp, with
render-target function combining affinity + IO analysis. Includes
spec (eval.sx, deps.sx), tests, Python evaluator, and demo page.

Fix critical bug: Python SX parser _ESCAPE_MAP was missing \r and \0,
causing bootstrapped JS parser to treat 'r' as whitespace — breaking
all client-side SX parsing. Also add \0 to JS string emitter and
fix serializer round-tripping for \r and \0.

Reserved word escaping: bootstrappers now auto-append _ to identifiers
colliding with JS/Python reserved words (e.g. default → default_,
final → final_), so the spec never needs to avoid host language keywords.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 23:53:33 +00:00
81d8e55fb0 Fix sx-browser.js cache bust: use correct path for hash computation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m4s
_script_hash used relative Path("static") which resolved to /app/static/
inside the container, but the file is at /app/shared/static/. Use
Path(__file__).parent.parent to resolve from shared/ correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:38:49 +00:00
179631130c Fix parser escape ordering and prim_get for non-dict objects
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m37s
Parser: chained .replace() calls processed \n before \\, causing \\n
to become a real newline. Replaced with character-by-character
_unescape_string. Fixes 2 parser spec test failures.

Primitives: prim_get only handled dict and list. Objects with .get()
methods (like PageDef) returned None. Added hasattr fallback.
Fixes 9 defpage spec test failures.

All 259 spec tests now pass (was 244/259).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:17:38 +00:00
5a4a0c0e1c Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 22:15:26 +00:00
621c0bbf42 CSSX plan: add CSS technology comparisons, fix strategy-agnostic claim
Add comparisons with styled-components, CSS Modules, Tailwind, Vanilla
Extract, and Design Tokens. Add example of components emitting <style>
blocks directly. Fix "CSS-agnostic" to "strategy-agnostic" — components
can generate CSS, not just reference existing classes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:15:24 +00:00
5a68046bd8 Restore stashed WIP: live streaming plan, forms, CI pipeline, streaming demo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:07:59 +00:00
df1aa4e1d1 Merge branch 'worktree-iso-phase-4' into macros
# Conflicts:
#	sx/sx/nav-data.sx
#	sx/sx/plans.sx
#	sx/sxc/pages/docs.sx
2026-03-07 22:07:09 +00:00
41c3b9f3b8 Add CSSX Components plan: styling via defcomp instead of opaque style dict
Replace the existing CSSX plan with a component-based approach where styling
is handled by regular defcomp components that apply classes, respond to data,
and compose naturally — eliminating opaque hash-based class names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:05:39 +00:00
f5e47678d5 Fix streaming page: SX NIL namespace broke CSS matching on DOM elements
domCreateElement treated SX NIL (a truthy JS object) as a real namespace,
calling createElementNS("nil", tag) instead of createElement(tag). All
elements created by resolveSuspense ended up in the "nil" XML namespace
where CSS class selectors don't match.

Also fix ~suspense fallback: empty &rest list is truthy in SX, so
fallback content never rendered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 20:24:29 +00:00
6596fac758 Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 19:37:18 +00:00
299de98ea8 Fix resolveSuspense: iterate parsed exprs instead of passing array
parse() returns a list of expressions. resolveSuspense was passing the
entire array to renderToDom, which interpreted [(<> ...)] as a call
expression ((<> ...)) — causing "Not callable: {}". Now iterates
each expression individually, matching the public render() API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:37:15 +00:00
e7a511d40a Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 19:34:40 +00:00
aeac3c0b13 Debug: log head and args on evalCall "Not callable" error
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:34:36 +00:00
25edc7d64a Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 19:23:32 +00:00
5cca22ae6d Revert make-raw-html wrapping from eval.sx spec
The make-raw-html wrapper in eval-list was host-specific: it fixed
server-side HTML escaping but broke the client DOM adapter (render-expr
returns DOM nodes, not strings). The raw-html wrapping belongs in the
host (async_eval_ref.py line 94-101), not the spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:23:27 +00:00
260475a4da Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 19:20:57 +00:00
2c9d7c95a2 resolve-suspense: process new SX scripts before resolving
Streaming resolve scripts arrive after boot, so any extra component
defs sent as <script type="text/sx"> tags weren't being loaded.
Fix in the spec (boot.sx): call (process-sx-scripts nil) at the
start of resolve-suspense so late-arriving component defs are
available in componentEnv before rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:20:54 +00:00
fd03eeb0fe Merge branch 'worktree-iso-phase-4' into macros 2026-03-07 19:08:35 +00:00
47448a6d37 Stream extra component defs with resolve scripts
Resolved SX content may reference components not in the initial shell
scan (e.g. ~cart-mini from IO-generated headers). Diff the needed
components against what the shell already sent and prepend any extra
defcomps as a <script type="text/sx"> block before the resolve script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:08:32 +00:00