Commit Graph

292 Commits

Author SHA1 Message Date
eeb4e48230 HS: set *prop of target — handle style in 'of' put-target
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
Add style case to the of-target compiler branch so
'set *color of #el to x' emits dom-set-style correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 02:52:57 +00:00
eef2bfdd89 HS: remove .class from .coll when it matches .filter
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
Parser produces remove-class-when AST node; compiler emits
filter + for-each pattern matching add-class-when.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 02:48:27 +00:00
c4d9efc8c4 HS: dispatch hyperscript:beforeFetch before fetch IO
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
Store target element in meta.owner when hs-on fires;
hs-fetch-impl dispatches beforeFetch on it before the perform.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 02:45:52 +00:00
4baf16ac13 HS: halt default no longer stops propagation (+1)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
Track halt mode via __hs-no-stop flag; skip stopPropagation when
handler raised hs-halt-default (from 'halt default'). All other
halt variants (halt, halt the event, halt bubbling) unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 02:35:34 +00:00
b40c70a348 HS: deferred-reraise in catch + exception event tests (+5)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
- compiler: wrap catch body in nested guard so (raise e) inside a
  catch handler defers the re-raise until after the guard exits,
  avoiding the handler-stays-active infinite loop
- generator: MANUAL_TEST_BODIES for rethrown/uncaught exception events,
  can-pick-detail/event-property, bootstrap bootstraps; remove from
  skip-list; regenerate behavioral spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 02:16:28 +00:00
310b649fe7 HS: behavior scoping + element ref + script tag registration (+5 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s
2026-04-27 00:56:12 +00:00
5ddd558eb7 HS: fix empty multi-element + meta reserved var in for loop
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
2026-04-26 22:46:51 +00:00
68d81f59a6 HS: sourceInfo 4/4 + arrayLiteral 8/8 (+5 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s
- tokenizer hs-emit!: add :end (max pos, start+len(val)) and :line fields to tokens
- parser hs-parse-ast: wrap fn body in do so set! hs-span-mode executes
- runtime hs-make-object: remove _order key (V8 native insertion order sufficient)
2026-04-26 22:36:03 +00:00
245b097c93 HS: hs-on stopPropagation prevents bubble regression in put tests (+3)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 15s
2026-04-26 22:10:27 +00:00
2dadb6a521 HS: fetch response unwrap + do-not-throw + dot-prop + JSON coerce (+19 tests) 2026-04-26 22:04:28 +00:00
cc800c3004 HS: hs-append/hs-append! use outerHTML when value is DOM element (+1 test) 2026-04-26 21:45:15 +00:00
606b5da1a1 HS: fix CSS dict semicolon parsing in add command (+1)
collect-pairs! in parse-add-cmd now skips the semicolon op token
between CSS properties, so add {color: red; font-family: monospace}
compiles to two dom-set-style calls instead of three malformed ones.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 21:31:42 +00:00
87072e61c1 HS: fix parser then-skip + bootstrap test fixes (+3)
Parser: parse-cmd-list now skips a leading 'then' token so that
'on click from #bar then add .clicked' compiles correctly instead
of producing nil as the body.

Bootstrap tests: fix two broken tests whose assertions were
incomplete or contradictory:
- "cleanup removes event listeners" — deactivate + re-click to
  verify listener is gone
- "reinitializes if script attribute changes" — actually change
  the _ attribute before re-activating and re-clicking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 21:26:16 +00:00
21c4a7fd5e HS: restore call emit-set (regression from c36fd5b2 merge) + hide A11 16/16
emit-set on call command re-applied so `it`/`the-result` bound after call.
A11 hide now 16/16 via count-filter unlock (was partial +3, now done +4).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 20:33:09 +00:00
cb59fbba13 HS: transition to initial + commit pending E37/E40 test impls
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s
parser.sx: detect bare ident "initial" after "to" in parse-one-transition,
  emit string sentinel instead of (ref "initial") which evaluated to nil.
runtime.sx: hs-transition stores pre-first-transition style as
  data-hs-init-{prop}; restores it when value=="initial".

Also commits E37 tokenizer and E40 fetch test implementations that
accumulated in the working tree but weren't staged in prior commits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 20:15:24 +00:00
54b54f4e19 HS: E37 tokenizer API (+17 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 15s
Implements hs-tokens-of, hs-stream-token, hs-stream-consume,
hs-stream-has-more, hs-token-type, hs-token-value, hs-token-op?,
hs-raw->api-token, hs-eof-sentinel in runtime.sx.

Tokenizer emits whitespace tokens after the first content token;
stream functions skip them for look-ahead and consume. Parser
filters whitespace tokens at hs-parse entry. Dot/hash after close
brackets split into PERIOD/POUND + IDENTIFIER. Template escape \$
produces literal $.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 19:54:40 +00:00
92adf9d496 HS: fix compiler AST-unwrap + restore hs-id= dispatch after merge regression
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
Merge c36fd5b2 stripped the source-info dict unwrapping from hs-to-sx
(the (let ((ast (if (and (dict? ast) (:hs-ast)) ...) wrapper) and also
introduced E37 tokenizer whitespace-token changes that broke the parser.

Reverts tokenizer/runtime to pre-E37 HEAD~1 state, restores hs-to-sx
with AST unwrapping from 61c9697f, and adds back the hs-id= dispatch
clause. Baseline: 178/195.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 19:13:02 +00:00
cabb0467ab HS: E37 tokenizer API — 16/17 conformance tests passing
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
Add hs-raw->api-token, hs-eof-sentinel, hs-api-list, hs-tokens-of,
hs-stream-token, hs-stream-consume, hs-stream-has-more, hs-token-type,
hs-token-value, hs-token-op? to runtime. Fix tokenizer to emit whitespace
tokens and handle dot/hash after closing brackets. Fix hs-tokens-of to
accept bare :template keyword flag via &rest args + some() check.
Remaining failure (string interpolation isnt surprising) requires full
DOM activation infrastructure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 18:45:58 +00:00
820132b839 HS: hs-id= runtime definition (restore from merge)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
2026-04-26 18:06:29 +00:00
7480c0f9c9 HS: restore hs-id= after merge (compiler dispatch + runtime def)
Lost when resolving E37 reformat conflicts — re-added:
- hs-id= function in runtime.sx (JS === for elements, = for scalars)
- hs-id= dispatch in compiler.sx (after = clause)
Parser already uses hs-id= for != operator (unchanged).
2026-04-26 18:03:48 +00:00
c36fd5b208 Merge branch 'loops/hs' into hs-f (E37 tokenizer, E40 fetch, DOM ref-eq, DOM tree fixes) 2026-04-26 17:57:37 +00:00
41fac7ac29 Merge branch 'hs-e40-fetch' into loops/hs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
2026-04-26 17:54:34 +00:00
4c48a8dd57 Merge branch 'hs-e37-tokenizer' into loops/hs 2026-04-26 17:54:11 +00:00
a48110417b HS: DOM ref-eq + compound selector + DOM tree fixes
- hs-id= uses JS === for DOM elements (hs-ref-eq), = for scalars
- != operator now uses hs-id= for structural correctness
- compound tag[attr=val] selector matching in test runner
- dom-query-all replaces host-call querySelectorAll
- DOM tree structure corrected in 4 generated tests (elements were
  appended to wrong parents)
2026-04-26 17:49:51 +00:00
61c9697f67 HS: block literals callable as zero-arg lambdas (+4 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s
Fix compiler: (block-literal () body) was emitting bare body instead of
(fn () body). Now always wraps in fn regardless of param count.
Generator: MANUAL_TEST_BODIES for all 4 blockLiteral tests using apply
and SX map rather than JS array.map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:53:29 +00:00
8e8c2a73d6 HS: js-block return values + worker stub test
Parser: parse-js-block extracts raw JS source by character positions.
Compiler: js-block AST → hs-js-exec call, stores result in it.
Runtime: hs-js-exec creates JS Function, handles promise rejection.
Test runner: host-new-function/host-promise-state natives + promise monkey-patch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:26:26 +00:00
daea280837 HS Bucket F: fix hs-make-object _order + assert= for dicts (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 20s
hs-make-object no longer appends _order to every HS object literal.
Generator emit_eval now uses assert-equal (equal?) for dict-containing
expected values instead of assert= (= reference equality).
Together these fix arrayLiteral "arrays containing objects work".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:22:26 +00:00
875e9ba317 HS: empty multi-element fix (+1 test)
empty .class compiled (empty-target (query ".class")) to
(hs-empty-target! (hs-query-first ".class")) via hs-to-sx — only
emptying the first match. Fix: detect (query ...) target in the
empty-target compiler case and emit (for-each (fn (_el)
(hs-empty-target! _el)) (hs-query-all sel)) instead, mirroring the
add-class pattern. Suite hs-upstream-empty: 12/13 → 13/13.
Smoke 0-195: 175/195 unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:02:47 +00:00
5a76a04010 HS: add CSS template interpolation fix (+1 test)
${}{"val"} pattern in add {prop: ${}{"val"}} uses two consecutive brace
groups: empty ${} followed by {"val"} for the actual expression. The prior
fix called parse-expr when already at the brace-close of the empty group,
returning nil. New fix: detect empty ${} (brace-open then brace-close),
skip the close, then read the actual value from the following {…} block.
Also handles non-empty ${expr} directly as before.
Suite hs-upstream-add: 17/19 → 18/19. Smoke 0-195: 174/195 → 175/195.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 14:42:36 +00:00
4b69650336 HS: cookies iteration via host-iter? before dict? (+1 test)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 14:24:16 +00:00
35f498ec80 hs: call command binds result to it via emit-set
call X then put it into Y was emitting (hs-win-call ...) without
wrapping in emit-set, so it remained nil. Wrap call result in
emit-set(the-result) so it/the-result are updated. Fixes +1 test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 14:14:02 +00:00
d663c91f4b hs: stop event propagation after each hs-on handler fires
Prevents click events from bubbling into ancestor elements that also
have hs handlers (e.g. parent re-inserting HTML after child click).
Fixes put-reprocessing tests 1147/1149/1150 (+3 tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 13:52:25 +00:00
11ee71d846 HS: tell uses beingTold implicit target, preserves me (+3 tests)
tell now rebinds beingTold/you/yourself without overwriting me.
Parser implicit targets use beingTold; handler wrapper seeds beingTold=me.
Fixes: attributes refer to the thing being told, does not overwrite me,
your symbol represents the thing being told.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 13:38:19 +00:00
6a1cbdcbdb HS: step limit + meta.caller (+4 tests)
- _NO_STEP_LIMIT set exempts hypertrace tests from the 200k step cap
- globalThis.__hs_deadline exposed so cek_step_loop wall-clock check
  (every 10k steps) can terminate runaway async loops without needing
  to go through host-call or _driveAsync
- meta + _hs-on-caller added to hs-runtime.sx (both lib and bundled):
  on-event handlers now set meta.caller to an object with
  meta.feature.type = "onFeature" before calling the handler

Tests 196 (async hypertrace), 198 (meta.caller), 199, 200 now pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 12:29:23 +00:00
d7244d1dc8 HS: hyperscript:beforeFetch event + runner dict format (+1 test)
- hs-fetch gains target param; dispatches hyperscript:beforeFetch before fetch
- compiler emits (quote me) as target arg
- runner io-fetch returns unified dict {_type:'dict', ok, status, _body, ...}
  so runtime (get raw :key) calls work correctly (22/23 fetch tests pass)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 11:33:04 +00:00
1b1b67c72e HS: fetch don't throw contraction (+1 test) 2026-04-26 10:15:44 +00:00
3a755947ef HS: fetch do-not-throw modifier (+1 test) 2026-04-26 10:03:06 +00:00
880503e2b6 HS E37: tokenizer-as-API 17/17 (+fixes)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
- runtime.sx: fix extra ) in hs-tokens-of (parse error); add hs-eof-sentinel,
  hs-raw->api-token, hs-normalize-raw-tokens, hs-tokens-of, stream helpers,
  hs-token-type/value/op?; add \$ escape to hs-template
- tokenizer.sx: fix read-number double-dot bug (1.1.1 → 3 tokens); fix t-emit!
  eof call (3→2 args); add bare $ case to scan-template!
- compiler.sx: add \$ escape to tpl-collect template interpolation
- generate-sx-tests.py: preserve \$ in process_hs_val; add generate_tokenizer_test
- regen spec/tests/test-hyperscript-behavioral.sx: 17 tokenizer tests generated
- plans/hs-conformance-to-100.md: row 37 marked done +17

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 09:54:59 +00:00
e989ff3865 Merge branch 'hs-e39-webworker' into loops/hs 2026-04-26 07:26:25 +00:00
cc2a296306 HS: sourceInfo API (sourceFor / lineFor / node-get) 2026-04-25 19:10:57 +00:00
9c8da50003 HS: parser attaches source spans to AST nodes 2026-04-25 19:09:04 +00:00
3003c8a069 HS E37 step 5: hs-tokenize-template + template routing in hs-tokens-of
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 12s
Add hs-tokenize-template: scans " as single STRING token, ${ ... }
as dollar+brace+inner-tokens (inner tokenized with hs-tokenize), and
} as brace-close. Update hs-tokens-of to call hs-tokenize-template
when :template keyword arg is passed. Unlocks tests 1 and 15.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 19:08:38 +00:00
8c62137d32 HS E37 step 2: extend read-string escapes + unterminated/hex errors
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Add \r \b \f \v and \xNN escape handling to read-string. Use
char-from-code for non-SX-literal chars. Throw "Unterminated string"
on EOF inside a string literal. Throw "Invalid hexadecimal escape: \x"
on bad \xNN. Add hs-hex-digit? and hs-hex-val helpers. Unlocks
tests 2, 6, 13, 14 once generator lands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 19:03:03 +00:00
573f9fa4b3 HS: E39 WebWorker plugin stub (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 12s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 18:56:46 +00:00
8ac669c739 HS E37 step 1: hs-api-tokens + stream/token helpers in runtime.sx
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Add hs-eof-sentinel, hs-op-type, hs-raw->api-token, hs-tokens-of,
hs-stream-token, hs-stream-consume, hs-stream-has-more, and the
three token accessors (hs-token-type, hs-token-value, hs-token-op?).
No test delta yet — API-only, generator comes in step 6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 18:56:26 +00:00
20a643806b HS: tokenizer tracks :end and :line 2026-04-25 18:54:59 +00:00
67a5f13713 HS: in-expression filter semantics (+1 test)
`1 in [1, 2, 3]` must return (list 1) not true. Root cause: in? compiled
to hs-contains? which returns boolean for scalar items. Fix: new hs-in?
returns filtered list; new in-bool? operator for is/am-in comparison
contexts so those still return boolean. Parser generates in-bool? for
`X is in Y` / `X am in Y`; plain `in` keeps in? → list return.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 18:35:26 +00:00
d31565d556 HS cluster 22: simplify win-call emit + def→window + init-blocks test (+1)
- Remove guard wrapper from hs-win-call emit (direct call is sufficient now)
- def command also registers fn on window[name] so hs-win-call finds it
- Generator: fix \"-escaped quotes in hs-compile string literal (was splitting "here" into three SX nodes)
- Hand-rolled deftest for 'can refer to function in init blocks' now passes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 17:55:32 +00:00
337c8265cd HS cluster 22: host-call-fn FFI + hs-win-call + def hoisting
- Add host-call-fn FFI primitive to test runner (calls SX lambdas or JS fns)
- Add hs-win-call runtime helper: looks up fn by name in window globals
- Compiler call case: emit guard-wrapped hs-win-call for bare (ref ...) calls
- Compiler method-call else: same guard pattern for non-dot method calls
- Compiler do case: hoist define forms before init/other forms (def hoisting)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 12:53:12 +00:00
5ff2b7068e HS: cluster 11/33 followups (+2 tests)
Three orthogonal fixes that pick up tests now unblocked by earlier
cluster-34 (count filters) and cluster-35 (hs-method-call fallback) work:

(1) parser.sx parse-hide-cmd / parse-show-cmd — added `on` to the keyword
list that signals an implicit-`me` target. Without this, `on click 1
hide on click 2 show` silently parsed as `(hide nil)` because parse-expr
greedily started consuming `on` and returned nil. With the bail-out,
hide/show default to me when the next token is `on` (a sibling feature).

(2) runtime.sx hs-method-call fallback — when method isn't a built-in
collection op, look up obj[method] via host-get; if it's an SX-callable
(lambda) use apply, but if it's a JS-native function (e.g. cookies.clear
on the cookies Proxy) dispatch via `(apply host-call (cons obj (cons
method args)))` so the JS native receives the args correctly. SX
callable? returns false for JS-native function values, hence the split.

(3) generator hs-cleanup! — wrapped body in begin (fn body evaluates
only the last expression) and reset two pieces of mutable global runtime
state between tests: hs-set-default-hide-strategy! nil and
hs-set-log-all! false. The prior `can set default to custom strategy`
test (cluster 11) was leaking _hs-default-hide-strategy to subsequent
tests, breaking `hide element then show element retains original
display` because hs-hide-one! resolved its "display" strategy through
the leaked override.

Also added cluster-33 hand-roll for `basic clear cookie values work`
(uses the new method-call fallback to dispatch cookies.clear via
host-call).

hs-upstream-hide: 15/16 → 16/16. hs-upstream-expressions/cookies: 3/5
→ 4/5. Smoke 0-195 unchanged at 172/195.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 12:52:02 +00:00