@tilia/react 6.0.0-beta.20260820T171602 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms.txt ADDED
@@ -0,0 +1,75 @@
1
+ # @tilia/react
2
+
3
+ > View adapter for tilia: React components observe reactive objects by
4
+ > reading them during render. Five entries, no store, no selectors.
5
+
6
+ ## Exact API contracts
7
+
8
+ These files are authoritative. If prose differs, follow the contracts.
9
+
10
+ Repository:
11
+
12
+ - TypeScript: `./src/index.d.ts`
13
+ - ReScript: `./src/TiliaReact.resi`
14
+
15
+ Installed npm package:
16
+
17
+ - TypeScript: `./dist/index.d.ts`
18
+ - ReScript: `./src/TiliaReact.resi`
19
+
20
+ Published documentation:
21
+
22
+ - Overview: <https://tiliajs.dev/react>
23
+ - API: <https://tiliajs.dev/react/api>
24
+ - TypeScript contract: <https://github.com/tiliajs/tilia/blob/main/react/src/index.d.ts>
25
+ - ReScript contract: <https://github.com/tiliajs/tilia/blob/main/react/src/TiliaReact.resi>
26
+
27
+ ## Key facts
28
+
29
+ - `leaf(fn)` wraps a component and tracks the reads of its render exactly. It
30
+ is the preferred integration: the observation closes at the end of the render
31
+ function.
32
+ - `useTilia()` tracks the reads of the current render from the call site. It is
33
+ the retrofit for existing components; its boundary is coarser than `leaf`'s
34
+ because a hook cannot see the end of the render.
35
+ - `useComputed(fn)` evaluates `fn` under tracking and re-renders only when the
36
+ returned value changes, not when its dependencies do. Use it for a
37
+ conclusion (`selected`, `due`) instead of the values behind it.
38
+ - `make(tilia)` returns a `TiliaReact`/`tilia_react` record — `useTilia`,
39
+ `useComputed`, `leaf` — bound to one core context. The package-level exports
40
+ are the default-context version.
41
+ - Dependencies are the reads themselves: no dependency arrays, no selectors, no
42
+ `memo` wrapper. Read the feature from a React context and the fields where
43
+ they are used, so the tracking stays fine-grained.
44
+ - React Native needs nothing extra: the adapter observes tilia objects and is
45
+ indifferent to what renders them.
46
+
47
+ ## Minimal TypeScript
48
+
49
+ ```typescript
50
+ import { leaf, useComputed } from "@tilia/react";
51
+
52
+ const CardView = leaf(({ card }: { card: Card }) => {
53
+ const current = useComputed(() => app.deck.queue[0]?.id === card.id);
54
+ return <div className={current ? "current" : ""}>{card.front}</div>;
55
+ });
56
+ ```
57
+
58
+ ## Minimal ReScript
59
+
60
+ ```rescript
61
+ open TiliaReact
62
+
63
+ @react.component
64
+ let make = leaf((~card) => {
65
+ let current = useComputed(() =>
66
+ app.deck.queue[0]->Option.map(c => c.id)->Option.getOr("") === card.id
67
+ )
68
+ <div className={current ? "current" : ""}> {card.front->React.string} </div>
69
+ })
70
+ ```
71
+
72
+ ## Docs
73
+
74
+ - [README](README.md): the API surface in both languages, with examples
75
+ - [tilia machine guide](../tilia/llms.txt): the reactive core this observes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tilia/react",
3
- "version": "6.0.0-beta.20260820T171602",
3
+ "version": "6.0.1",
4
4
  "homepage": "https://tiliajs.dev/react",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -30,6 +30,6 @@
30
30
  "react": "*"
31
31
  },
32
32
  "dependencies": {
33
- "tilia": "6.0.0-beta.20260820T171602"
33
+ "tilia": "^6.0"
34
34
  }
35
35
  }
package/rescript.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "tilia"
22
22
  ],
23
23
  "dev-dependencies": [
24
- "vitest-bdd"
24
+ "@epure/vitest"
25
25
  ],
26
26
  "jsx": {
27
27
  "version": 4