diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a08a1..db2ddee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,28 @@ # Changelog -## Unreleased +## 0.3.0 + +`@reactivescript/compiler`, `@reactivescript/runtime`, `@reactivescript/language-server` and the editor extension, +together. + +**Breaking** + +- `UNGUARDED_SNAPSHOT` (R-8) is stricter: an `errored` region or `disabled` covers a failure only when it reads the + value. A region whose content reads `x` only under `pending? x` never shows its fallback, so it no longer counts + (#58). **New** - Solid libraries (MO-10): declare a primitive once in a `.d.rx` (`export pure fn createToggle(v: boolean): [ref boolean, (v: boolean) => void]`) and use it like .rx: it is called once, `ref` arguments go in as accessors, readers are read without a call, and setters are io. A package's `.d.rx` sits beside the file its import resolves to. - `guide/libraries.md`. + `guide/libraries.md` (#57). +- The guide (shipped in `@reactivescript/compiler`) places data by its lifetime: what a visit, a write or the screen + needs, with a module only for data whose writes outlive their page (#58, #59). + +**Fixed** + +- `refresh` of a keyed equation re-asks it. It used to re-ask nothing in compiled code (#58). ## 0.2.0 diff --git a/compiler/Cargo.lock b/compiler/Cargo.lock index d462515..a90b32d 100644 --- a/compiler/Cargo.lock +++ b/compiler/Cargo.lock @@ -988,7 +988,7 @@ dependencies = [ [[package]] name = "reactivescript" -version = "0.2.0" +version = "0.3.0" dependencies = [ "indexmap", "napi", diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index ce695c0..cd8e5eb 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reactivescript" -version = "0.2.0" +version = "0.3.0" edition = "2021" description = "ReactiveScript's compiler (spec/11): parse, check, resolve, and lower through Solid's solidjs-compiler" license = "MIT" diff --git a/compiler/npm/darwin-arm64/package.json b/compiler/npm/darwin-arm64/package.json index 209c93f..fa5849f 100644 --- a/compiler/npm/darwin-arm64/package.json +++ b/compiler/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-darwin-arm64", - "version": "0.2.0", + "version": "0.3.0", "cpu": [ "arm64" ], diff --git a/compiler/npm/darwin-x64/package.json b/compiler/npm/darwin-x64/package.json index dc363f0..9413979 100644 --- a/compiler/npm/darwin-x64/package.json +++ b/compiler/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-darwin-x64", - "version": "0.2.0", + "version": "0.3.0", "cpu": [ "x64" ], diff --git a/compiler/npm/linux-arm64-gnu/package.json b/compiler/npm/linux-arm64-gnu/package.json index 0e622b2..484f678 100644 --- a/compiler/npm/linux-arm64-gnu/package.json +++ b/compiler/npm/linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-linux-arm64-gnu", - "version": "0.2.0", + "version": "0.3.0", "cpu": [ "arm64" ], diff --git a/compiler/npm/linux-x64-gnu/package.json b/compiler/npm/linux-x64-gnu/package.json index 3dc129d..0f40104 100644 --- a/compiler/npm/linux-x64-gnu/package.json +++ b/compiler/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-linux-x64-gnu", - "version": "0.2.0", + "version": "0.3.0", "cpu": [ "x64" ], diff --git a/compiler/npm/wasm32-wasi/package.json b/compiler/npm/wasm32-wasi/package.json index 1218265..55017fd 100644 --- a/compiler/npm/wasm32-wasi/package.json +++ b/compiler/npm/wasm32-wasi/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-wasm32-wasi", - "version": "0.2.0", + "version": "0.3.0", "main": "compiler.wasi.cjs", "browser": "compiler.wasi-browser.js", "files": [ diff --git a/compiler/npm/win32-x64-msvc/package.json b/compiler/npm/win32-x64-msvc/package.json index 5236eab..7c7f2b9 100644 --- a/compiler/npm/win32-x64-msvc/package.json +++ b/compiler/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@reactivescript/compiler-win32-x64-msvc", - "version": "0.2.0", + "version": "0.3.0", "cpu": [ "x64" ], diff --git a/compiler/package-lock.json b/compiler/package-lock.json index bd91af5..ecceeb3 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -1,12 +1,12 @@ { "name": "@reactivescript/compiler", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@reactivescript/compiler", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "devDependencies": { "@emnapi/core": "^1.11.3", diff --git a/compiler/package.json b/compiler/package.json index 262e369..508db4f 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -1,7 +1,7 @@ { "name": "@reactivescript/compiler", "description": "ReactiveScript's compiler, in process through Node-API, and its front end for @solidjs/vite-plugin", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "repository": { "type": "git", diff --git a/runtime/package-lock.json b/runtime/package-lock.json index 7f8159b..07dc6a9 100644 --- a/runtime/package-lock.json +++ b/runtime/package-lock.json @@ -1,12 +1,12 @@ { "name": "@reactivescript/runtime", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@reactivescript/runtime", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "devDependencies": { "@solidjs/signals": "2.0.0-rc.21", diff --git a/runtime/package.json b/runtime/package.json index e5431bb..673f4cb 100644 --- a/runtime/package.json +++ b/runtime/package.json @@ -1,7 +1,7 @@ { "name": "@reactivescript/runtime", "description": "ReactiveScript's runtime (spec/11 CP-4a): createApp and the __rt helpers compiled .rx calls, over Solid, for the browser and the server", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "repository": { "type": "git", diff --git a/site/index.html b/site/index.html index 66a9abb..73dea7a 100644 --- a/site/index.html +++ b/site/index.html @@ -88,7 +88,7 @@
Experimental · 0.2. Files are .rx and compile to plain Solid 2.0. Releases follow Solid 2.0's release candidates, so expect breaking changes until Solid 2.0 is final.
Experimental · 0.3. Files are .rx and compile to plain Solid 2.0. Releases follow Solid 2.0's release candidates, so expect breaking changes until Solid 2.0 is final.
In Solid you already write UIs as derivations over signals. Most of what goes wrong is a shape mistake: writing to something that should be derived, writing during a computation, reading async data with no loading or error boundary above it. ReactiveScript makes those things the checker refuses, the way Rust refuses a borrow.
@@ -102,6 +102,19 @@Write to the equation instead, double := 4, and the checker refuses it, in your editor and in CI:
counter.rx:5:3 - error WRITE_TO_NON_SOURCE: double is an equation: only sources are written (W-1)
+ In Solid, destructuring props reads them once and the component stops updating. In .rx, destructure them right in the parameter list: every name follows its prop, defaults and rest included.
+inbox.rxcomponent Badge({ label, tone = "info", ...rest }: { label: string; tone?: string; count: number }) {
+ <span class={tone}>{label}: {rest.count}</span>
+}
+
+export default component Inbox() {
+ source user := { name: "Ada", unread: 3 }
+
+ <Badge label={user.name} count={user.unread} /> // Badge updates when user changes
+ <button onClick={() => { user := { ...user, unread: 0 } }}>Mark read</button>
+}
+
awaitPut an await in an equation. The checker tracks that the value can be pending and can fail, and asks you to say what to show in both cases.
profile.rximport pure { fetchUser } from "./api"
@@ -186,6 +199,7 @@ Every word is a Solid primitive
y = x * 2createMemo, createProjection
user = await fetchUser(id)an async createMemo
guess likes := likes + 1createOptimistic
+ component C({ label, ...rest })props.label, omit(props, "label")
action send() { … }action
effect (x) { … }createEffect(compute, apply)
loading / errored<Loading> / <Errored>
@@ -197,6 +211,19 @@ Every word is a Solid primitive
The spec is the product
Every behaviour is a numbered rule or an executable scenario, checked against Solid itself.
+ Use any Solid library
+ A Solid library is plain JavaScript, and .rx can use any of them: solid-primitives, a design system's hooks, your own create* helpers. Declare what you use once, in a .d.rx beside it, and the checker holds every use to that declaration. A ref is an accessor: you pass and read plain values, and the compiler adds the calls.
+media.d.rx// beside ./media.js, which re-exports it from @solid-primitives/media
+export pure fn createMediaQuery(query: string): ref boolean
+nav.rximport { createMediaQuery } from "./media.js"
+
+export default component Nav() {
+ wide = createMediaQuery("(min-width: 768px)") // runs once; read it like any equation
+
+ <nav>{if wide { <Links /> } else { <Menu /> }}</nav>
+}
+ A package can ship its own .d.rx beside its build, and then there's nothing to declare. See Using Solid libraries.
+
Install
In a Solid app (Vite). Install the compiler and the runtime beside Solid 2.0. Solid's Vite plugin (3.0.0-next.57 or later) finds the compiler and compiles .rx on its own, so vite.config.js stays as it is.
npm i solid-js@next @solidjs/web@next @solidjs/signals@next @reactivescript/runtime
@@ -215,6 +242,7 @@ Learn more
- The language on one page : the whole working language
- Talking to a server : async, guesses and what waits
+ - Solid libraries : declare a library once in a
.d.rx
- Diagnostics : every error code, why, and the fix
- The spec : the language as numbered rules
- Examples : real apps in
.rx
diff --git a/tooling/rx-language-server/package-lock.json b/tooling/rx-language-server/package-lock.json
index 9b5b379..2abe140 100644
--- a/tooling/rx-language-server/package-lock.json
+++ b/tooling/rx-language-server/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@reactivescript/language-server",
- "version": "0.2.0",
+ "version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@reactivescript/language-server",
- "version": "0.2.0",
+ "version": "0.3.0",
"license": "MIT",
"dependencies": {
"@volar/language-core": "2.4.30",
diff --git a/tooling/rx-language-server/package.json b/tooling/rx-language-server/package.json
index b0518a4..2b35163 100644
--- a/tooling/rx-language-server/package.json
+++ b/tooling/rx-language-server/package.json
@@ -1,6 +1,6 @@
{
"name": "@reactivescript/language-server",
- "version": "0.2.0",
+ "version": "0.3.0",
"description": "The .rx language server (spec/11 CP-8): Volar over the crate's TSX projection, TypeScript's answers mapped back onto .rx, the crate's own diagnostics; rx-tsc type-checks .rx from the command line.",
"license": "MIT",
"repository": {
diff --git a/tooling/vscode-rx/README.md b/tooling/vscode-rx/README.md
index 294bd6d..9446f3a 100644
--- a/tooling/vscode-rx/README.md
+++ b/tooling/vscode-rx/README.md
@@ -27,7 +27,7 @@ artifact of a run of the repository's `editor` workflow, or build one (below),
then run **Extensions: Install from VSIX…** in the command palette, or
```sh
-code --install-extension reactivescript-0.2.0.vsix
+code --install-extension reactivescript-0.3.0.vsix
```
The project needs a `tsconfig.json` with Solid's JSX (`"jsx": "preserve"`,
diff --git a/tooling/vscode-rx/package-lock.json b/tooling/vscode-rx/package-lock.json
index fa17e15..08c5218 100644
--- a/tooling/vscode-rx/package-lock.json
+++ b/tooling/vscode-rx/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "reactivescript",
- "version": "0.2.0",
+ "version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "reactivescript",
- "version": "0.2.0",
+ "version": "0.3.0",
"license": "MIT",
"dependencies": {
"highlight.js": "^11.11.1",
diff --git a/tooling/vscode-rx/package.json b/tooling/vscode-rx/package.json
index de5466c..2d11377 100644
--- a/tooling/vscode-rx/package.json
+++ b/tooling/vscode-rx/package.json
@@ -2,7 +2,7 @@
"name": "reactivescript",
"displayName": "ReactiveScript",
"description": "ReactiveScript (.rx, .d.rx): highlighting, and TypeScript's types, hover, go to definition, completion and errors through the .rx language server, with the compiler's own diagnostics; ```rx blocks highlighted in Markdown.",
- "version": "0.2.0",
+ "version": "0.3.0",
"publisher": "solidjs",
"license": "MIT",
"icon": "icon.png",