@signal-tree/react 15.0.0-rc.12 → 15.0.0-rc.14

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/README.md CHANGED
@@ -1,21 +1,36 @@
1
- # @signal-tree/react
1
+ # `@signal-tree/react`
2
2
 
3
3
  React observation for SignalTree. It connects React's external-store lifecycle
4
4
  to canonical SignalTree reads without copying state into React.
5
5
 
6
+ ## Semantic Guidance
7
+
8
+ The canonical v15 model and composition guidance ships with this package as
9
+ [llms.txt](llms.txt). It explains the React facade rule, `link()`
10
+ relationships, persistence composition, and causal explanations as projections
11
+ rather than retained kernel facts.
12
+
6
13
  ## Install
7
14
 
8
15
  ```bash
9
- npm install @signal-tree/react @signal-tree/kernel
16
+ npm install @signal-tree/react
17
+ ```
18
+
19
+ React 18 or 19 is required as a peer dependency. `@signal-tree/react` installs
20
+ the framework-neutral kernel as its dependency, so React applications should
21
+ construct and enhance trees through this package:
22
+
23
+ ```tsx
24
+ import { entityMap, signalTree, useSignalTree } from '@signal-tree/react';
25
+
26
+ const tree = signalTree({ orders: entityMap<{ id: string; status: string }>() });
10
27
  ```
11
28
 
12
- React 18 or 19 is required as a peer dependency.
29
+ Framework-neutral libraries may import from `@signal-tree/kernel` directly.
13
30
 
14
31
  ## Observe A Projection
15
32
 
16
33
  ```tsx
17
- import { useSignalTree } from '@signal-tree/react';
18
-
19
34
  function OrderStatus({ tree, orderId }) {
20
35
  const status = useSignalTree(tree, ($) => $.orders.byIdOrFail(orderId).status());
21
36
 
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
+ export * from '@signal-tree/kernel';
1
2
  export { useSignalTree } from './use-signal-tree.js';
package/llms.txt ADDED
@@ -0,0 +1,177 @@
1
+ # SignalTree
2
+
3
+ SignalTree is framework-neutral reactive application state with causal
4
+ semantics. The public v15 construction model is
5
+ `signalTree(initialState, { derived, enhancers })`; state is read through
6
+ `tree.$`.
7
+
8
+ ## What SignalTree is — and is not
9
+
10
+ ```text
11
+ IS: framework-independent consequential application state, stable subject
12
+ identity, authored versus external authority, coherent operation
13
+ boundaries, causal/restoration semantics, and link-based relationships
14
+
15
+ IS NOT: primarily an undo library, event log, query library, sync engine, or
16
+ persistence framework
17
+ ```
18
+
19
+ Undo/redo, event replay, query composition, live synchronization, and
20
+ persistence are all things applications correctly BUILD on top of SignalTree's
21
+ causal model — see "Composition patterns" below — but none of them is what
22
+ SignalTree is FOR. Describe SignalTree by its primary job (consequential state
23
+ with a causal model an application can trust), not by one thing that model
24
+ happens to make easy.
25
+
26
+ v15 ships four packages under the hyphenated `@signal-tree/*` scope (the pre-15
27
+ `@signaltree/*` scope, no hyphen, stopped at 14.1.1):
28
+
29
+ - `@signal-tree/kernel` — framework-neutral tree, `entityMap()`, causal turns,
30
+ links, and the `restoration()` / `transactions()` / `batching()` / `devTools()`
31
+ enhancers. Also `@signal-tree/kernel/adapter`, the realization SDK.
32
+ - `@signal-tree/angular` — the complete Angular application facade. **Angular
33
+ code imports `signalTree` and all other SignalTree APIs from here**. Terminal
34
+ state leaves are native `WritableSignal<T>` values and derived leaves are
35
+ native `Signal<T>` values. Adds `defineStore()` and `toWritableSignal()` for
36
+ adapting callable object branches or designating form ingress.
37
+ - `@signal-tree/react` — the complete React application facade. **React code
38
+ imports `signalTree`, markers, enhancers, and `useSignalTree(owner, selector)`
39
+ from here**; React observes the canonical kernel tree without copying it.
40
+ - `@signal-tree/vue` — the complete Vue application facade. **Vue code imports
41
+ `signalTree` and all other SignalTree APIs from here**. Terminal state leaves
42
+ are native `Ref<T>` values and derived leaves are `ComputedRef<T>` values.
43
+
44
+ Use `@signal-tree/kernel` directly only for framework-neutral TypeScript,
45
+ including reusable domain libraries. Framework facades forward the neutral
46
+ kernel surface by canonical identity; they do not duplicate semantic authority.
47
+
48
+ ## Accessor grammar and terminal values
49
+
50
+ The neutral kernel exposes callable locations:
51
+
52
+ ```typescript
53
+ location(); // read
54
+ location(nextValue); // replace the complete value
55
+ location((current) => nextValue); // derive the next complete value
56
+ ```
57
+
58
+ The root (`tree.$`) and object branches keep this callable whole-value grammar
59
+ in every facade. Terminal values use the framework's native carrier:
60
+
61
+ ```typescript
62
+ angularTree.$.count();
63
+ angularTree.$.count.set(5);
64
+ angularTree.$.count.update((count) => count + 1);
65
+
66
+ vueTree.$.count.value;
67
+ vueTree.$.count.value = 5;
68
+ ```
69
+
70
+ React has no persistent signal primitive, so `@signal-tree/react` keeps neutral
71
+ locations and observes selected state through `useSignalTree(owner, selector)`.
72
+ EntityMap query and field leaves follow the same carrier rule; EntityMap command
73
+ methods such as `setAll()` and `updateOne()` do not change.
74
+
75
+ Plain objects normally become traversable branches. `leaf(value)` explicitly
76
+ ends topology so an object remains one atomic location. Callable values always
77
+ use `leaf()` because a bare function argument is the updater syntax:
78
+
79
+ ```typescript
80
+ const tree = signalTree({
81
+ range: leaf({ start: 0, end: 10 }),
82
+ callback: leaf((value: number) => console.log(value)),
83
+ });
84
+
85
+ angularTree.$.range.set({ start: 5, end: 15 });
86
+ angularTree.$.callback.set((value) => persist(value));
87
+ ```
88
+
89
+ The wrapper is consumed at construction or invocation and never enters state,
90
+ snapshots, persistence, restoration, links, or causal payloads.
91
+
92
+ There is no v15 forms, persistence, validation, events, or realtime package;
93
+ those are application-owned. `.with()`, positional `derived`, and the
94
+ `stored`/`asyncSource`/`asyncQuery`/`form`/`status` markers were all removed.
95
+
96
+ ## Migration Rule
97
+
98
+ Never design SignalTree around a legacy application's intermediate state.
99
+
100
+ 1. Determine the canonical greenfield v15 architecture.
101
+ 2. Implement and validate that architecture independently.
102
+ 3. Migrate applications toward that target.
103
+ 4. Prefer deleting obsolete concepts over adapting them.
104
+ 5. Never add compatibility APIs merely to reduce migration work.
105
+ 6. A migration may falsify the target architecture, but legacy usage does not
106
+ define it.
107
+
108
+ Do not create intermediate APIs intended to be removed later. Do not add
109
+ compatibility layers because a migration is large. Do not preserve old
110
+ ownership because moving it is inconvenient. Do not design framework adapters
111
+ from legacy application idioms. Do not optimize for minimal migration diff.
112
+ Optimize for the architecture applications should use five years from now.
113
+
114
+ `@signal-tree/kernel/adapter` is the SDK for realization ownership, not a
115
+ compatibility layer. New exports must be framework-neutral semantic facts owned
116
+ by the kernel and required by correct realizations.
117
+
118
+ ## Framework Realization Rule
119
+
120
+ Framework packages may realize SignalTree truth for their runtime. They must
121
+ not create another state authority.
122
+
123
+ Never use process-global mutable framework installation merely to make a legacy
124
+ integration work if construction-bound ownership can express the long-term
125
+ architecture. A migration cannot determine realization ownership.
126
+
127
+ ## Framework Ownership Ratchet
128
+
129
+ `@signal-tree/kernel` owns framework-independent SignalTree semantics.
130
+ `@signal-tree/kernel/adapter` owns only neutral ports for semantic questions
131
+ the kernel owns. Framework packages own their implementations, lifecycle,
132
+ diagnostics, schedulers, rendering behavior, primitive identity rules, and
133
+ quirks. Neutral naming does not establish neutral ownership.
134
+
135
+ Every new realization contract must state its SignalTree semantic job, provide
136
+ a neutral implementation, be implementable by a tiny framework-free fake, and
137
+ name the kernel authority deciding when and why it runs. Reject contracts that
138
+ exist only for one framework. If Angular, React, and Vue disappeared, the
139
+ contract must remain meaningful to SignalTree or another reactive runtime.
140
+
141
+ ## Composition patterns
142
+
143
+ Several capabilities that look like missing features are compositions of
144
+ primitives that already ship — see `docs/guides/composition-recipes.md` for
145
+ the full recipes with executable-spec citations. Do not propose a new marker
146
+ or kernel API for any of these before reading it:
147
+
148
+ - a standard enhancer policy, a reusable entity-CRUD Ops base, a selection
149
+ read-model
150
+ - optimistic writes with server reconciliation (`transactions()`'s
151
+ pending/confirm/rollback lifecycle)
152
+ - staged/draft editing (an application-owned draft, one authored commit — no
153
+ `beginStage()` session API)
154
+ - one-shot loading (`external()`, no `link()` needed for a single fetch) versus
155
+ a persistent relationship with an external authority (`link()`'s three
156
+ composable directions: PULL/PUSH-IN/PUSH-OUT)
157
+ - accepted external truth is distinct from authored application work, so an
158
+ external write is not automatically a retained causal-history turn
159
+ - a human-readable explanation projected from the causal record (the
160
+ explanation is a PROJECTION of causal truth — the kernel does not store
161
+ prose, actor names, or timestamps merely to make one convenient)
162
+
163
+ `docs/guides/persistence-guide.md` is the `link()`-as-storage specialization
164
+ of the same model.
165
+
166
+ ## Canonical Sources
167
+
168
+ - `AGENTS.md` — contributor and consumer rules
169
+ - `RELEASE-1.0.md` — v15 release invariants and current release state
170
+ - `README.md` — public package overview
171
+ - `packages/kernel/README.md` — kernel API and examples
172
+ - `packages/angular/README.md` — Angular realization
173
+ - `packages/react/README.md` — React observation
174
+ - `docs/guides/composition-recipes.md` — patterns built from existing primitives, no new API
175
+ - `docs/guides/persistence-guide.md` — the `link()`-as-storage recipe
176
+ - `docs/guides/migration-v14-v15.md` — `@signaltree/*` → `@signal-tree/*` migration (rename, consolidation, removed APIs)
177
+ - `docs/migration/post-rc1-workstream.md` — greenfield-first post-RC program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signal-tree/react",
3
- "version": "15.0.0-rc.12",
3
+ "version": "15.0.0-rc.14",
4
4
  "description": "React observation for SignalTree.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -21,10 +21,11 @@
21
21
  "src/**/*.d.ts",
22
22
  "README.md",
23
23
  "LICENSE",
24
- "NOTICE"
24
+ "NOTICE",
25
+ "llms.txt"
25
26
  ],
26
27
  "dependencies": {
27
- "@signal-tree/kernel": "15.0.0-rc.12"
28
+ "@signal-tree/kernel": "15.0.0-rc.14"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "react": "^18.0.0 || ^19.0.0",
package/src/index.d.ts CHANGED
@@ -1 +1,11 @@
1
+ /**
2
+ * `@signal-tree/react` - React observation plus the complete SignalTree
3
+ * application surface.
4
+ *
5
+ * React observes framework-neutral SignalTree truth through
6
+ * `useSyncExternalStore`; it does not replace the kernel's tree carrier. React
7
+ * applications therefore construct, synchronize, and enhance trees through
8
+ * this package, then observe them with `useSignalTree`.
9
+ */
10
+ export * from '@signal-tree/kernel';
1
11
  export { useSignalTree } from './use-signal-tree.js';