Skip to content

Spread attributes in markup, {...e}; release 0.3.1 - #62

Open
ryansolid wants to merge 1 commit into
mainfrom
claude/project-thread-gzv2gj
Open

ryansolid wants to merge 1 commit into
mainfrom
claude/project-thread-gzv2gj

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Adds {...e} among an element's attributes, as JSX has it. Merging this publishes 0.3.1, the same way as #60.

Semantics (07 §4, taken by default)

  • On an HTML element it lowers to Solid's spread. On a component it is a function source of Solid's merge, placed between runs of named props.
  • The last part that has a field wins: an attribute after the spread overrides it, and one before it acts as a default.
  • Each field keeps updating.
  • Checker: on a component, a spread is the "*" argument. Its failures, holds and O-3 stores go wherever the component reads any field, so nothing is forced to the call site. Messages show it as <Card {...…}>.
  • {x} as an attribute is a parse error that names the spread form.

Where

  • Parser: ref/src/parse.ts and compiler/src/parse.rs.
  • Checker: check.ts and check.rs.
  • Interpreter props: runtime.ts, a Proxy only when a spread is present.
  • Oracle: merge and setProp.
  • Compiled and SSR output: compile/emit.ts and emit.rs/oxc.rs. CSS-2 now sees has_spread.
  • TSX projection: types/project.ts and project.rs.

Tests

  • New scenario S-surface-5 passes on the interpreter, oracle, compiled, ssr and types runners, including a rejected UNHANDLED_FAILURE through a spread.
  • crate.ts 363/363. --lower and --project agree on all programs except one --project failure, prelude: compiler/src/prelude.ts is not types/project.ts's PRELUDE, which also fails on main without this change.

Also

  • guide/language.md and the CHANGELOG.
  • The homepage props example now spreads the rest: <span class={tone} {...rest}>.
  • Every package is bumped to 0.3.1.

Generated by Claude Code

- Parse `{...e}` among an element's attributes (ref + crate). On an HTML
  element it is Solid's spread; on a component, a function source of
  Solid's merge between runs of named props: the last part with a field
  wins, and each field keeps updating.
- Checker: a spread on a component is the "*" argument; its failures,
  holds and O-3 stores go wherever any field goes (R-2, R-f-5).
- 07 §4, S-surface-5 (all five runners, crate parity incl. --lower and
  --project), guide/language.md.
- Site: the props example spreads the rest onto the element.
- Bump everything to 0.3.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWNkVdujweQpFRfpvoj

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants