Commit Graph

69 Commits

Author SHA1 Message Date
922e7a7892 HS: halt command modes, mock event methods
Parser:
- halt default/bubbling: match ident type (not just keyword)
- halt the event's: consume possessive marker

Runtime:
- hs-halt! dispatches: default→preventDefault, bubbling→stopPropagation,
  event→both

Mock DOM:
- Add event method dispatch: preventDefault, stopPropagation,
  stopImmediatePropagation set correct flags on event dict

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 05:44:08 +00:00
c8aab54d52 HS: append command, list stringify as comma-separated
Compiler:
- append to symbol → (set! target (hs-append target value))
- append to DOM → (hs-append! value target)

Runtime:
- hs-append: pure function for string concat and list append
- hs-append!: DOM insertAdjacentHTML for element targets

Mock DOM:
- dom_stringify handles List by joining elements with commas
  (matching JS Array.toString() behavior)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 19:40:27 +00:00
c25ab23709 HS: fix hs-for-each to handle dicts and nil collections
hs-for-each now converts dicts to key lists and nil to empty list
before iterating, fixing regression where for-in loops over object
properties stopped working after the for-each → hs-for-each switch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 18:05:59 +00:00
f200418d91 HS: break/continue/until — loop control flow via guard/raise
Parser:
- Add break, continue, exit/halt as parsed commands
- Handle bottom-tested repeat: repeat <body> until <cond>
- Handle bottom-tested repeat: repeat <body> while <cond>

Compiler:
- break → (raise "hs-break"), continue → (raise "hs-continue")
- repeat-until/repeat-while → hs-repeat-until/hs-repeat-while
- for loops use hs-for-each (break/continue aware) instead of for-each

Runtime:
- hs-repeat-times, hs-repeat-forever, hs-repeat-while: wrap body in
  guard to catch hs-break (exit loop) and hs-continue (next iteration)
- Add hs-repeat-until: bottom-tested do-until loop with guard
- Add hs-for-each: break/continue aware iteration over lists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 17:58:58 +00:00
79b3fa3f26 HS parser: add 'your' as alias for 'my' in property access
In hyperscript, 'your' refers to the element in a 'tell' scope,
functioning identically to 'my' for property access. Fixes
"Expected into/before/after/at" parse errors in tell commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-19 00:46:30 +00:00
d0b3b86823 HS: implicit variable declaration, console mock, increment/decrement fix
Integration:
- hs-collect-vars: scan compiled SX for set! targets, collect symbols
- hs-handler: pre-declare collected variables in closure let-bindings
  so increment/decrement work on first use (variable persists across
  event handler calls via closure scope)

Compiler:
- Fix emit-inc/emit-dec: use expr (variable) not tgt-override (element)
- Simplify to plain (set! x (+ x amount)) since vars are pre-declared

Mock DOM:
- Add mock console object to host-global
- Add console handler (no-op) to host-call dispatch
- Override console-log/debug/error as no-op primitives to avoid
  str hitting circular refs in mock DOM elements

Fixes 4 log timeouts, 2+ increment/decrement failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 22:07:38 +00:00
7516d1e1f9 HS transition parser: handle *prop of target, possessive 's, inner targets
Parser:
- After parsing transition property, check for "of <expr>" inner target
- Handle possessive 's token before property name in parse-one-transition
- Inner target overrides outer target when present

Fixes 6 transition parse errors: *width of #foo, #foo's width,
query ref with of/possessive syntax.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 21:44:42 +00:00
00bf13a230 HS toggle style: parse between/cycle, runtime, mock style dict
Parser:
- Reorder toggle style parsing: target before between clause
- Handle "indexed" keyword, "indexed by" syntax
- Use parse-atom (not parse-expr) for between values to avoid
  consuming "and" as boolean operator
- Support 3-4 value cycles via toggle-style-cycle

Compiler:
- Add toggle-style-cycle dispatch → hs-toggle-style-cycle!

Runtime:
- Add hs-toggle-style-between! (2-value toggle)
- Add hs-toggle-style-cycle! (N-value round-robin)

Mock DOM:
- Parse CSS strings from setAttribute "style" into style sub-dict
  so dom-get-style/dom-set-style work correctly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 21:35:00 +00:00
5a0740d3ce HS parser/compiler/mock: fix put positions, add CSS properties
Parser:
- Skip optional "the" in "at the start/end of" put targets
- Handle "style" token type in parse-add-cmd for *prop:value syntax

Compiler:
- Add set-style dispatch → dom-set-style for CSS property additions

Mock DOM:
- Position-aware insertAdjacentHTML: afterbegin prepends, beforeend appends
- Sync textContent after insertAdjacentHTML mutations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 20:55:58 +00:00
be84246961 HS parser/compiler/mock: fix 31 test failures across 7 issues
Parser:
- Relax (number? v) to v in parse-one-transition so (expr)unit works
- Add (match-kw "then") before parse-cmd-list in parse-for-cmd
- Handle "indexed by" syntax alongside "index" in for loops
- Add "indexed" to hs-keywords to prevent unit-suffix consumption

Compiler:
- Use map-indexed instead of for-each for indexed for-loops

Test generator:
- Preserve \" escapes in process_hs_val via placeholder/restore

Mock DOM:
- Coerce insertAdjacentHTML values via dom_stringify (match browser)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 20:46:01 +00:00
3ba819d9ae HS parser/compiler/runtime: fix 8 parse errors, add/remove arrays, return guard
Parser:
- `add VALUE to :var` → (add-value) for array append
- `remove VALUE from :var` → (remove-value) for array removal
- `toggle .foo for 10ms` → (toggle-class-for) with duration
- `append VALUE` without `to` → implicit target (it)
- `set {obj} on target` → (set-on) for object property spread
- `repeat in` body: remove spurious nil (body at index 3→2)
- Keywords followed by `(` parsed as function calls (fixes `increment()`)

Compiler:
- Handle add-value, remove-value, toggle-class-for, set-on AST nodes
- Local variables (`set :var`) use `define` instead of `set!`

Runtime:
- hs-add-to!: append value to list
- hs-remove-from!: filter value from list
- hs-set-on!: spread dict properties onto target
- `as String` for lists: comma-join (JS Array.toString compat)

Tests:
- eval-hs/eval-hs-with-me: guard for hs-return exceptions
  (return compiles to raise, needs handler to extract value)

Parse errors: 20→12 (8 fixed). Remaining: 6 embedded HTML quotes
(tokenizer), 6 transition template values `(expr)px`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 11:06:46 +00:00
673be85743 HS fetch: 4→11/23 — POST options, Number format, route mock
Parser: fetch command consumes {method:"POST"}, with {opts}, and
handles as-format both before and after options.
Mock: Number format case-insensitive, /test route has number field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 23:22:56 +00:00
f85004c8a2 HS: targeted IO let/it chaining — fetch tests 0→4/23
Compiler: do-blocks containing IO commands (hs-fetch, hs-wait, perform)
are compiled as (let ((it cmd1)) (let ((it cmd2)) ...)) to chain the
it variable through IO suspensions. Non-IO do-blocks stay as plain
(do cmd1 cmd2). This enables fetch X then put it into me pattern.

Parser: then-separator handled via __then__ markers (stripped in output).
fetch URL /path parsing. Default format "text".

Runtime: hs-fetch simplified to single perform (io-fetch url format).

Test runner: mock fetch routes with format-specific responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 23:13:49 +00:00
db8e680caf Revert do→let/it chaining (caused 80-test regression)
The let/it wrapping changed semantics of ALL multi-command sequences,
breaking independent side-effect chains like (do (add-class) (add-class)).
Need a targeted approach — chain it only for then-separated commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 23:01:23 +00:00
ac193e8839 HS: do→let/it chaining, single-IO fetch, fetch URL parser, IO mock
Compiler: do-blocks now compile to (let ((it cmd1)) (let ((it cmd2)) ...))
instead of (do cmd1 cmd2 ...). This chains the `it` variable through
command sequences, enabling `fetch X then put it into me` pattern.
Each command's result is bound to `it` for the next command.

Runtime: hs-fetch simplified to single perform (io-fetch url format)
instead of two-stage io-fetch + io-parse-text/json.

Parser: fetch URL /path handled by reading /+ident tokens.
Default fetch format changed to "text" (was "json").

Test runner: mock fetch routes with format-specific responses.
io-fetch handler returns content directly based on format param.

Fetch tests still need IO suspension to chain through let continuations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 22:54:31 +00:00
b9c9216409 HS: fetch URL parser fix + IO mock responses
Parser: handle /path URLs in fetch command by reading /+ident tokens.
Test runner: mock fetch routes (/test→yay, /test-json→{"foo":1}),
  io-parse-text, io-parse-json, io-parse-html handlers in _driveAsync.

Fetch tests still fail (0/23) because the do-block halts after
hs-fetch's perform suspension — the CEK machine doesn't continue
to the next command (put it into me) after IO resume. This needs
the IO suspension model to properly chain do-block continuations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 14:02:32 +00:00
76f7e3b68a HS: return/guard, repeat while/until, if-then fix, script extraction
Parser: if-then consumes 'then' keyword before parsing then-body.
Compiler: return→raise, def→guard, repeat while/until dispatch.
Runtime: hs-repeat-while, hs-repeat-until.
Test gen: script block extraction for def functions.
repeat suite: 10→13/30.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 21:33:55 +00:00
97818c6de1 HS compiler: return via raise/guard, def param fix
- return compiles to (raise (list "hs-return" value)) instead of
  silently discarding the return keyword
- def wraps function body in guard that catches hs-return exceptions,
  enabling early exit from repeat-forever loops via return
- def params correctly extract name from (ref name) AST nodes

Note: IO suspension kernel changes reduced baseline from 519→487.
The HS parser/compiler/runtime fixes are all intact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 17:55:20 +00:00
2285ea3e49 HS: return via raise/guard, def param fix, script block extraction
- Compiler: return compiles to (raise (list "hs-return" value))
- Compiler: def wraps body in guard to catch hs-return exceptions
- Compiler: def params extract name from (ref name) nodes
- Test generator: extract <script type="text/hyperscript"> blocks
  and compile def functions as setup before tests
- Test generator: add eval-hs-with-me for {me: N} opts

The return mechanism enables repeat-forever with early exit via return.
Direct SX guard/raise works (returns correct value), but the compiled
HS repeat-forever thunk body needs further debugging for full coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 17:26:43 +00:00
98fbd5cf40 HS parser: possessive 's style property access (517→519/831)
parse-poss-tail now handles style token type after 's operator.
#div2's *color, #foo's *width etc. now correctly produce
(style prop owner) AST which compiles to dom-set/get-style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 16:07:52 +00:00
4981e9a32f HS runtime: add Set/Map coercions to hs-coerce
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 15:28:29 +00:00
fc76a42403 HS: take attr semantics fix, +6 tests (509→515/831)
- Parser: take @attr=value with replacement restored (was reverted)
- Runtime: take @attr bare doesn't remove from scope (hyperscript keeps
  source attr, only sets on target). Only take @attr=val with replacement
  modifies scope elements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 14:11:18 +00:00
8819d7cbd1 HS fixes: multi-property transition, take attr with-val, empty form, css-value parsing
- Parser: multi-property transition (width from 0px to 100px height from...)
  with collect-transitions loop. CSS value parsing uses parse-atom + manual
  number+unit concat to avoid greedy string-postfix chaining.
- Compiler: take! passes attr-val and with-val (restored from revert)
- Runtime: hs-empty-target! handles FORM by iterating child inputs,
  hs-starts-with-ic/hs-ends-with-ic for case-insensitive comparison

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 13:44:59 +00:00
684a46297d HS behavioral tests: 478→509/831 (57%→61%), parser/compiler/runtime fixes
Parser: am-a/am-not-a type checks, transition element/selector targeting,
take @attr=value with replacement, toggle my/the possessive, <selector/>
syntax in parse-atom, the-of for style/attr/class/selector, when-clause
filtering for add, starts/ends-with ignoring case.

Compiler: take attr passthrough, toggle-style nil→me default, scoped
querySelectorAll for add/remove/toggle-class, has-class? entry, matches?
extracts selector from (query sel), add-class-when with for-each filter,
starts/ends-with-ic entries, hs-add replaces + for polymorphic add.

Runtime: hs-take! proper attr values, hs-type-check Element/Node via
host-typeof, hs-toggle-style! opacity 0↔1, hs-coerce +8 coercions
(Keys/Values/Entries/Reversed/Unique/Flat/JSON/Object), hs-query-all
bypasses broken dom-query-all (WASM auto-converts arrays), hs-matches?
handles DOM el.matches(selector), hs-add list+string+number polymorphic,
hs-starts/ends-with-ic for case-insensitive comparison.

DOM mock: mkStyle() with setProperty/getPropertyValue, fndAll.item().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 12:53:43 +00:00
4aa49e42e8 htmx demos working: activation, fetch, swap, OOB filtering, test runner page
- htmx-boot-subtree! wired into process-elements for auto-activation
- Fixed cond compilation bug in hx-verb-info (Clojure-style flat cond)
- Platform io-fetch upgraded: method/body/headers support, full response dict
- Replaced perform IO ops with browser primitives (set-timeout, browser-confirm, etc)
- SX→HTML rendering in hx-do-swap with OOB section filtering
- hx-collect-params: collects input name/value for all methods
- Handler naming: ex-{slug} convention, removed perform IO dependencies
- Test runner page at (test.(applications.(htmx))) with iframe-based runner
- Header "test" link on every page linking to test URL
- Page file restructure: 285 files moved to URL-matching paths (a/b/c/index.sx)
- page-functions.sx: ~100 component name references updated
- _test added to skip_dirs, test- file prefix convention for test files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:56:15 +00:00
4f02f82f4e HS parser: fix number+comparison keyword collision, eval-hs uses hs-compile
Parser: skip unit suffix when next ident is a comparison keyword
(starts, ends, contains, matches, is, does, in, precedes, follows).
Fixes "123 starts with '12'" returning "123starts" instead of true.

eval-hs: use hs-compile directly instead of hs-to-sx-from-source with
"return " prefix, which was causing the parser to consume the comparison
as a string suffix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:29:01 +00:00
745e78ab05 HS parser: 'does not start/end with' negation support
Parser now handles 'does not start with' and 'does not end with'
comparison operators, compiling to (not (starts-with? ...)) and
(not (ends-with? ...)) respectively.

Test runner: host-set!/host-get stringify innerHTML/textContent.

437/831 (52.6%) — parser fix doesn't change count yet (comparison tests
use 'is a' type checks which need separate fix).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 20:19:33 +00:00
e5e3e90ee7 HS compiler: emit-set handles @attr of target expressions
Adds attribute reference case to the 'of' branch in emit-set:
(set @bar of #div2 to "foo") now compiles to (dom-set-attr target "bar" "foo")
instead of falling through to the broken (set! (host-get ...)) catchall.

417/831 (50.2%), +2 from attr-of fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 19:47:30 +00:00
b1666a5fe2 HS tests: VM step limit fix, callFn error propagation, compiler emit-set fixes
- sx_vm.ml: VM timeout now compares vm_insn_count > step_limit instead of
  unconditionally throwing after 65536 instructions when limit > 0
- sx_browser.ml: Expose setStepLimit/resetStepCount APIs on SxKernel;
  callFn now returns {__sx_error, message} on Eval_error instead of null
- compiler.sx: emit-set handles array-index targets (host-set! instead of
  nth) and 'of' property chains (dom-set-prop with chain navigation)
- hs-run-fast.js: New Node.js test runner with step-limit timeouts,
  SX-level guard for error detection, insertAdjacentHTML mock,
  range selection (HS_START/HS_END), wall-clock timeout in driveAsync
- hs-debug-test.js: Single-test debugger with DOM state inspection
- hs-verify.js: Assertion verification (proves pass/fail detection works)

Test results: 415/831 (50%), up from 408/831 (49%) baseline.
Fixes: set my style["color"], set X of Y, put at end of (insertAdjacentHTML).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 19:27:03 +00:00
d42717d4b9 HS: route hide through hs-hide! runtime (dialog/details support)
Mirrors hs-show! pattern — dialog calls close(), details sets open=false.
No test count change (custom strategy tests need behavior system).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:29:54 +00:00
75f1c04559 HS: show command handles dialogs/details — dialog 10/10 complete, 435→437
- show compiler: emit hs-show! runtime call instead of direct dom-set-style
- hs-show! runtime: dialog → showModal(), details → open=true, else display/opacity/visibility
- dialog category fully passing (was 1/10)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:19:08 +00:00
fb93aaaa8c HS: open/close commands for dialog/details — 428→435
- Parser: open/close commands with optional target (defaults to me)
- Compiler: open-element → hs-open!, close-element → hs-close!
- Runtime: hs-open! calls showModal() for dialogs, sets open=true for details
- Runtime: hs-close! calls close() for dialogs, sets open=false for details
- dialog: 1/10 → 8/10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:10:17 +00:00
d938682469 HS runtime: fix Boolean coercion to use hs-falsy? — 426→427
as Boolean now uses hs-falsy? for JS-compatible truthiness (0, "", nil, false → false)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:24:39 +00:00
4cac08d56f HS: contains/matches ignoring case support — 425→426
- Parser: contains/matches with ignoring case modifier
- Compiler: contains-ignore-case? → hs-contains-ignore-case?
- Compiler: matches-ignore-case? → hs-matches-ignore-case?
- Runtime: downcase-based case-insensitive contains/matches

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 09:45:57 +00:00
c05d8788c7 HS parser: is/is-not ignoring case, eq-ignore-case runtime — 423→425
- Parse `is X ignoring case` → (eq-ignore-case left right)
- Parse `is not X ignoring case` → (not (eq-ignore-case left right))
- Compiler: eq-ignore-case → hs-eq-ignore-case
- Runtime: hs-eq-ignore-case using downcase/str

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 09:38:12 +00:00
eaf3c88a36 HS runtime: empty/swap/compound events, host-set! fix — 403→423 (51%)
- Fix host-set → host-set! in emit-inc/emit-dec (increment/decrement properties)
- Implement empty/clear command: parser dispatch, compiler, polymorphic runtime
- Implement swap command: parser dispatch, compiler (let+do temp swap pattern)
- Add parse-compound-event-name: joins dot/colon tokens (example.event, htmx:load)
- Add hs-compile to source parser (was only in WASM deploy copy)
- Add clear/swap to tokenizer keywords and cmd-kw? list
- Generator: fix run() with extra args, String.raw support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 09:17:43 +00:00
e71e74941e Hyperscript: remove/tell/transition commands, test generator ref() fix
Parser: remove me/[@attr]/{css}, tell body scoping (skip then),
transition from/to syntax + my/style prefixes.
Compiler: remove-element, remove-attr, remove-css, transition-from.
Runtime: hs-transition-from for from/to CSS transitions.
Generator changes (already committed) fix ref() unnamed-first mapping,
assertion dedup for pre/post pairs, on-event then insertion.

Conformance: 374→395 (+21 tests, 48%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:03:56 +00:00
699dd5ad69 Step 17b: bytecode-compiled text-layout, WASM library import fix
- text-layout.sx added to WASM bytecode pipeline (9K compiled)
- Fix multi-list map calls (map-indexed + nth instead of map fn list1 list2)
- pretext-layout-lines and pretext-position-line moved to library exports
- Browser load-sxbc: handle VmSuspended for import, copy library exports
  to global_env after module load (define-library export fix)
- compile-modules.js: text-layout in SOURCE_MAP, FILES, and entry deps
- Island uses library functions (break-lines, pretext-layout-lines)
  instead of inlining — runs on bytecode VM when exports resolve

Known issue: define-library exports don't propagate to browser global env
yet. The load-sxbc import suspension handler resumes correctly but
bind_import_set doesn't fire. Needs deeper investigation into how the
WASM kernel's define-library registers exports vs how other libraries
(adapter-html, tw) make their exports available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 16:37:04 +00:00
f60d22e86e Hyperscript: focus command, diagnostic test output, blur keyword
Parser/compiler/runtime for focus command. Tokenizer: focus, blur,
precedes, follows, ignoring, case keywords. Test spec: per-test
failure output for diagnosis.

374/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:38:05 +00:00
7d798be14f Hyperscript: precedes/follows comparisons, tokenizer keywords
Parser: precedes/follows comparison operators in parse-cmp.
Tokenizer: precedes, follows, ignoring, case keywords.
Runtime: precedes?, follows? string comparison functions.

372/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:20:13 +00:00
ae32254dfb Hyperscript: hide/show strategy (opacity/visibility), add/remove query-all
Parser: hide/show handle `with opacity/visibility/display` strategy
and properly detect target vs command boundaries. Compiler: emit
correct CSS property per strategy, add-class/remove-class use
for-each+query-all for class selectors. Runtime: hs-query-all uses
dom-body, hs-each helper for collection iteration.

Generator: inline run().toEqual() pattern for eval-only tests.

372/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:07:06 +00:00
854ed9c027 Hyperscript conformance: 372→373 — hide/show strategy, generator toEqual
Parser: hide/show handle `with opacity/visibility/display` strategy,
target detection for then-less chaining (add/remove/set/put as boundary).
Generator: inline run().toEqual([...]) pattern for eval-only tests.
Compiler: hide/show emit correct CSS property per strategy.

373/831 (45%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:42:28 +00:00
6e27442d57 Step 17: streaming render — hyperscript enhancements, WASM builds, live server tests
Streaming chunked transfer with shell-first suspense and resolve scripts.
Hyperscript parser/compiler/runtime expanded for conformance. WASM static
assets added to OCaml host. Playwright streaming and page-level test suites.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 08:41:38 +00:00
6e38a2e1e1 Parser: between, starts with, ends with — 297/831 (36%)
- is between X and Y / is not between X and Y: uses parse-atom for
  bounds to avoid consuming 'and' as logical operator
- starts with / ends with: comparison operators mapping to
  starts-with? / ends-with? primitives
- comparisonOperator: 12→17/40

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 22:52:28 +00:00
5fe97d8481 Multi-class add/remove, async IO in test runner — 280/831 (34%)
- Parser: add .foo .bar collects multiple class refs into multi-add-class AST
- Compiler: multi-add-class/multi-remove-class emit (do (dom-add-class...) ...)
- Test runner: drives IO suspension chains (wait/fetch/settle) via _driveAsync
  so async HS tests (wait 100ms, settle, fetch) can complete
- Assertion failed: 51→49

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 22:24:16 +00:00
08cd82ed65 Parser: catch/finally in on handlers, cmd terminators — 279/831 (34%)
- parse-cmd: catch/finally/end/else/otherwise are now terminators that
  stop parse-cmd-list (return nil from parse-cmd)
- parse-on-feat: optional catch var handler / finally handler clauses
  after the command body, before 'end'
- emit-on: scan-on passes catch-info/finally-info through recursion,
  wraps compiled body in (guard (var (true catch-body)) body) when
  catch clause is present
- Runtime: hs-put! handles "start" (afterbegin) and "end" (beforeend)
- Removed duplicate conformance-dev.sx (all 110 tests already in behavioral)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:51:43 +00:00
e85de7d5cc Parser: put at start/end of, take for — 309/941 (33%)
- put parser: added 'at start of' and 'at end of' positional syntax
- take parser: added 'for' as alternative to 'from' for target clause
- runtime: hs-put! handles "start" (afterbegin) and "end" (beforeend)
- eval-hs: smart wrapping for commands vs expressions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 16:19:46 +00:00
42a7747d02 Fix HS put-into and query: compiler emits hs-query-first, runtime uses real DOM
Two bugs found by automated test suite:
1. compiler.sx: query → hs-query-first (was dom-query, a deleted stub)
2. compiler.sx: emit-set with query target → dom-set-inner-html (was set!)
3. runtime.sx: hs-query-first uses real document.querySelector
4. runtime.sx: delete hs-dom-query stub (returned empty list)

All 8/8 HS elements pass: toggle, bounce+wait, count, add-class,
toggle-between, set-innerHTML-eval, put-into-target, repeat-3-times.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 06:50:57 +00:00
de9ab4ca07 Hyperscript examples working: toggle, bounce, count clicks
- sx_browser.ml: restore VmSuspended handler in api_call_fn with
  make_js_callFn_suspension for IO suspension chains (wait, fetch)
- runtime.sx: delete host-get stub that shadowed platform native —
  hs-toggle-class! now uses real FFI host-get for classList access

All three live demo examples work:
  Toggle Color — classList.toggle on click
  Bounce — add .animate-bounce, wait 1s suspend, remove
  Count Clicks — increment @data-count, put into innerHTML

4/4 bytecode regression tests pass (was 0/4 without VmSuspended).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 21:04:45 +00:00
c6df054957 Fix HS browser activation: host-get function sentinel, runtime symbol shadow, lazy dep chain
Three bugs fixed:
1. host-get in sx-platform.js: return true for function-valued properties
   so dom-get-attr/dom-set-attr guards pass (functions can't cross WASM boundary)
2. hs-runtime.sx: renamed host-get→hs-host-get and dom-query→hs-dom-query to
   stop shadowing platform natives when loaded as .sx source
3. compile-modules.js: HS dependency chain (integration→runtime→compiler→parser→tokenizer)
   so lazy loading pulls in all deps. Non-library modules load as .sx source
   for CEK env visibility.

Result: 8/8 elements activate, hs-on attaches listeners. Click handler needs
IO suspension support (VmSuspended in sx_browser.ml) to fire — next step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 20:50:10 +00:00