@violetflux/kerros 0.2.0 → 0.2.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/README.de.md CHANGED
@@ -12,11 +12,11 @@
12
12
  <a href="https://github.com/violetflux/kerros/blob/main/README.es.md">Español</a>
13
13
  </p>
14
14
 
15
- Kerros lässt React-State dort, wo er natürlich hingehört: in Hooks und unter Providern. Die Bibliothek ergänzt gezielte Selector-Abonnements, ohne Reducer, Actions, Proxies oder globale Singletons vorzuschreiben.
15
+ Kerros lässt React-State dort, wo er natürlich hingehört: in Hooks und unter Providern. Automatisches Property-Tracking verhindert standardmäßig unnötige Renders; explizite Selektoren bleiben für abgeleitete Werte und Hotspots verfügbar.
16
16
 
17
17
  - Ein Store ist ein normaler React Hook
18
- - Selektoren geben ein Objekt mit den benötigten Werten zurück
19
- - Oberste Felder werden flach mit `Object.is` verglichen
18
+ - `useStore()` verfolgt gelesene Properties automatisch
19
+ - Explizite Selektoren sind eine fortgeschrittene Optimierung
20
20
  - Jeder Provider besitzt eine isolierte Store-Instanz
21
21
  - Stores lassen sich über einseitige Abhängigkeiten komponieren
22
22
  - Unterstützt React 17, 18 und 19
@@ -46,14 +46,11 @@ Im Store Hook können weiterhin `useState`, `useReducer`, Context, SDK Hooks und
46
46
 
47
47
  Definiere den Initializer als benannten Hook auf Modulebene, zum Beispiel `useCounterModel`. Anonyme Initializer funktionieren weiterhin zur Laufzeit, werden vom React Compiler im `infer`-Modus aber nicht automatisch als Hooks kompiliert.
48
48
 
49
- ## Provider einbinden und Werte auswählen
49
+ ## Provider einbinden und Werte lesen
50
50
 
51
51
  ```tsx
52
52
  function Counter() {
53
- const { count, setCount } = useCounter(s => ({
54
- count: s.count,
55
- setCount: s.setCount,
56
- }))
53
+ const { count, setCount } = useCounter()
57
54
  return <button onClick={() => setCount(count + 1)}>{count}</button>
58
55
  }
59
56
 
@@ -62,7 +59,7 @@ function App() {
62
59
  }
63
60
  ```
64
61
 
65
- Der Selektor darf inline stehen. Änderungen an nicht ausgewählten Feldern rendern `Counter` nicht neu.
62
+ Kerros verfolgt die beim Rendern gelesenen Properties. Änderungen an ungelesenen Feldern rendern `Counter` nicht neu; ein Deep-Vergleich des gesamten Stores findet nicht statt.
66
63
 
67
64
  ## Installation
68
65
 
@@ -89,7 +86,7 @@ function createStore<TStore, TProps = Record<never, never>>(
89
86
  const [useStream, StreamProvider] = bindStore<Stream>('Stream')
90
87
  ```
91
88
 
92
- Der zurückgegebene Store Hook verlangt einen Selektor, der ein Objekt liefert. Außerhalb des passenden Providers wird ein verständlicher Fehler ausgelöst. Strict Mode und Server Rendering werden unterstützt.
89
+ Der zurückgegebene Store Hook verwendet ohne Argument automatisches Tracking. Explizite Objekt-Selektoren sind für abgeleitete Werte und gemessene Hotspots verfügbar. Außerhalb des passenden Providers wird ein verständlicher Fehler ausgelöst.
93
90
 
94
91
  `bindStore` ist eine fortgeschrittene Integration ausschließlich für einen bestehenden Headless External Store. Für normalen Hook-Zustand bleibt `createStore` die richtige Wahl. Der Context enthält nur die ursprüngliche Store-Instanz; Verbraucher verwenden `getSnapshot` und `subscribe` direkt.
95
92
 
package/README.es.md CHANGED
@@ -12,11 +12,11 @@
12
12
  Español
13
13
  </p>
14
14
 
15
- Kerros mantiene el estado de React donde pertenece de forma natural: dentro de Hooks y bajo Providers. Añade suscripciones precisas mediante selectores sin imponer reducers, actions, proxies ni un singleton global.
15
+ Kerros mantiene el estado de React donde pertenece: dentro de Hooks y bajo Providers. El seguimiento automático de propiedades evita renderizados innecesarios por defecto; los selectores explícitos siguen disponibles para valores derivados y puntos críticos.
16
16
 
17
17
  - Un Store es un Hook de React normal
18
- - Los selectores devuelven un objeto con los valores necesarios
19
- - Los campos superiores se comparan superficialmente con `Object.is`
18
+ - `useStore()` sigue automáticamente las propiedades leídas
19
+ - Los selectores explícitos son una optimización avanzada
20
20
  - Cada Provider posee una instancia de Store aislada
21
21
  - Los Stores se componen mediante dependencias unidireccionales
22
22
  - Compatible con React 17, 18 y 19
@@ -46,14 +46,11 @@ El Hook del Store puede seguir usando `useState`, `useReducer`, Context, Hooks d
46
46
 
47
47
  Define el initializer como un Hook con nombre en el nivel superior, por ejemplo `useCounterModel`. Los initializers anónimos siguen funcionando en runtime, pero React Compiler no los compila automáticamente como Hooks en modo `infer`.
48
48
 
49
- ## Montar el Provider y seleccionar valores
49
+ ## Montar el Provider y leer valores
50
50
 
51
51
  ```tsx
52
52
  function Counter() {
53
- const { count, setCount } = useCounter(s => ({
54
- count: s.count,
55
- setCount: s.setCount,
56
- }))
53
+ const { count, setCount } = useCounter()
57
54
  return <button onClick={() => setCount(count + 1)}>{count}</button>
58
55
  }
59
56
 
@@ -62,7 +59,7 @@ function App() {
62
59
  }
63
60
  ```
64
61
 
65
- El selector puede escribirse en línea. Cambiar un campo no seleccionado no vuelve a renderizar `Counter`.
62
+ Kerros sigue las propiedades leídas durante el renderizado. Cambiar un campo no leído no vuelve a renderizar `Counter`, sin comparar profundamente todo el Store.
66
63
 
67
64
  ## Instalación
68
65
 
@@ -89,7 +86,7 @@ function createStore<TStore, TProps = Record<never, never>>(
89
86
  const [useStream, StreamProvider] = bindStore<Stream>('Stream')
90
87
  ```
91
88
 
92
- El Hook devuelto requiere un selector que retorne un objeto. Usarlo fuera de su Provider correspondiente produce un error claro. Admite Strict Mode y renderizado en servidor.
89
+ Sin argumentos, el Hook devuelto usa seguimiento automático. Los selectores de objeto explícitos quedan para valores derivados y puntos críticos medidos. Usarlo fuera de su Provider produce un error claro.
93
90
 
94
91
  `bindStore` es una integración avanzada solo para un Headless External Store existente. Para el estado normal de Hooks, usa `createStore`. El Context solo contiene la instancia original; los consumidores utilizan directamente `getSnapshot` y `subscribe`.
95
92
 
package/README.fr.md CHANGED
@@ -12,11 +12,11 @@
12
12
  <a href="https://github.com/violetflux/kerros/blob/main/README.es.md">Español</a>
13
13
  </p>
14
14
 
15
- Kerros conserve l'état React là où il se trouve naturellement : dans les Hooks et sous les Providers. Il ajoute des abonnements précis par sélecteur sans imposer reducers, actions, proxies ou singleton global.
15
+ Kerros conserve l'état React là où il se trouve naturellement : dans les Hooks et sous les Providers. Le suivi automatique des propriétés évite par défaut les rendus inutiles ; les sélecteurs explicites restent disponibles pour les valeurs dérivées et les points chauds.
16
16
 
17
17
  - Un Store est un Hook React ordinaire
18
- - Les sélecteurs renvoient un objet contenant les valeurs nécessaires
19
- - Les champs de premier niveau sont comparés avec `Object.is`
18
+ - `useStore()` suit automatiquement les propriétés lues
19
+ - Les sélecteurs explicites sont une optimisation avancée
20
20
  - Chaque Provider possède une instance de Store isolée
21
21
  - Les Stores se composent grâce à des dépendances unidirectionnelles
22
22
  - Compatible avec React 17, 18 et 19
@@ -46,14 +46,11 @@ Le Hook du Store peut continuer à utiliser `useState`, `useReducer`, Context, d
46
46
 
47
47
  Définissez l'initializer comme un Hook nommé au niveau du module, par exemple `useCounterModel`. Les initializers anonymes fonctionnent toujours à l'exécution, mais React Compiler ne les compile pas automatiquement comme Hooks en mode `infer`.
48
48
 
49
- ## Monter le Provider et sélectionner les valeurs
49
+ ## Monter le Provider et lire les valeurs
50
50
 
51
51
  ```tsx
52
52
  function Counter() {
53
- const { count, setCount } = useCounter(s => ({
54
- count: s.count,
55
- setCount: s.setCount,
56
- }))
53
+ const { count, setCount } = useCounter()
57
54
  return <button onClick={() => setCount(count + 1)}>{count}</button>
58
55
  }
59
56
 
@@ -62,7 +59,7 @@ function App() {
62
59
  }
63
60
  ```
64
61
 
65
- Le sélecteur peut rester en ligne. La modification d'un champ non sélectionné ne provoque pas un nouveau rendu de `Counter`.
62
+ Kerros suit les propriétés lues pendant le rendu. La modification d'un champ non lu ne provoque pas un nouveau rendu de `Counter`, sans comparaison profonde du Store complet.
66
63
 
67
64
  ## Installation
68
65
 
@@ -89,7 +86,7 @@ function createStore<TStore, TProps = Record<never, never>>(
89
86
  const [useStream, StreamProvider] = bindStore<Stream>('Stream')
90
87
  ```
91
88
 
92
- Le Hook retourné exige un sélecteur qui renvoie un objet. Son utilisation hors du Provider correspondant lève une erreur claire. Strict Mode et le rendu serveur sont pris en charge.
89
+ Sans argument, le Hook retourné active le suivi automatique. Les sélecteurs d'objet explicites servent aux valeurs dérivées et aux points chauds mesurés. Son utilisation hors du Provider lève une erreur claire.
93
90
 
94
91
  `bindStore` est une intégration avancée réservée à un Headless External Store existant. Pour un état Hook ordinaire, utilisez `createStore`. Le Context ne contient que l'instance d'origine ; les consommateurs utilisent directement `getSnapshot` et `subscribe`.
95
92
 
package/README.ja.md CHANGED
@@ -12,11 +12,11 @@
12
12
  <a href="https://github.com/violetflux/kerros/blob/main/README.es.md">Español</a>
13
13
  </p>
14
14
 
15
- Kerros は React の状態を Hook の中、Provider の下という自然な場所に保ちます。reducer、action、proxy、グローバル singleton を導入せず、selector による限定的な購読を追加します。
15
+ Kerros は React の状態を Hook の中、Provider の下という自然な場所に保ちます。デフォルトの自動プロパティ追跡が不要な再レンダーを防ぎ、明示的 selector は派生値や計測済みホットスポットで利用できます。
16
16
 
17
17
  - Store は通常の React Hook
18
- - selector は必要な値だけをオブジェクトで返す
19
- - 選択したトップレベルフィールドを `Object.is` で浅く比較
18
+ - `useStore()` は読み取ったプロパティを自動追跡
19
+ - 明示的 selector は高度な最適化として利用
20
20
  - Provider ごとに独立した Store インスタンス
21
21
  - 一方向の依存関係で Store を合成可能
22
22
  - React 17、18、19 をサポート
@@ -46,14 +46,11 @@ Store Hook 内では `useState`、`useReducer`、Context、SDK Hook、カスタ
46
46
 
47
47
  initializer は `useCounterModel` のようなモジュール直下の名前付き Hook として定義してください。匿名 initializer も実行時には動作しますが、React Compiler の `infer` モードでは Hook として自動コンパイルされません。
48
48
 
49
- ## Provider を配置して値を選択する
49
+ ## Provider を配置して値を読み取る
50
50
 
51
51
  ```tsx
52
52
  function Counter() {
53
- const { count, setCount } = useCounter(s => ({
54
- count: s.count,
55
- setCount: s.setCount,
56
- }))
53
+ const { count, setCount } = useCounter()
57
54
 
58
55
  return <button onClick={() => setCount(count + 1)}>{count}</button>
59
56
  }
@@ -63,7 +60,7 @@ function App() {
63
60
  }
64
61
  ```
65
62
 
66
- selector はインラインで記述できます。選択していないフィールドの変更では `Counter` は再レンダーされません。
63
+ Kerros はレンダー中に読み取ったプロパティを追跡します。未読フィールドの変更では `Counter` は再レンダーされず、Store 全体の深い比較も行いません。
67
64
 
68
65
  ## インストール
69
66
 
@@ -90,7 +87,7 @@ function createStore<TStore, TProps = Record<never, never>>(
90
87
  const [useStream, StreamProvider] = bindStore<Stream>('Stream')
91
88
  ```
92
89
 
93
- 返される Store Hook にはオブジェクトを返す selector が必須です。対応する Provider の外で呼び出すと明確なエラーを送出します。Strict Mode とサーバーレンダリングをサポートします。
90
+ 返される Store Hook は引数なしで自動追跡を使います。明示的なオブジェクト selector は派生値や計測済みホットスポット向けです。対応する Provider の外では明確なエラーを送出します。
94
91
 
95
92
  高度な連携として、既存の Headless External Store にだけ `bindStore` を使います。通常の Hook 状態には `createStore` を使ってください。Context は元の Store インスタンスだけを保持し、コンシューマーは `getSnapshot` と `subscribe` を直接利用します。
96
93
 
package/README.ko.md CHANGED
@@ -12,11 +12,11 @@
12
12
  <a href="https://github.com/violetflux/kerros/blob/main/README.es.md">Español</a>
13
13
  </p>
14
14
 
15
- Kerros는 React 상태를 Hook 안과 Provider 아래라는 자연스러운 위치에 둡니다. reducer, action, proxy, 전역 singleton을 도입하지 않고 selector 기반의 정밀 구독을 제공합니다.
15
+ Kerros는 React 상태를 Hook 안과 Provider 아래라는 자연스러운 위치에 둡니다. 기본 자동 속성 추적이 불필요한 렌더링을 막고, 명시적 selector 파생 값과 측정된 핫스팟에 사용할 수 있습니다.
16
16
 
17
17
  - Store는 평범한 React Hook
18
- - selector는 필요한 값만 객체로 반환
19
- - 선택 객체의 최상위 필드를 `Object.is`로 얕게 비교
18
+ - `useStore()`는 읽은 속성을 자동으로 추적
19
+ - 명시적 selector는 고급 최적화에 사용
20
20
  - Provider마다 격리된 Store 인스턴스
21
21
  - 단방향 의존성을 통한 Store 조합
22
22
  - React 17, 18, 19 지원
@@ -46,14 +46,11 @@ Store Hook 안에서 `useState`, `useReducer`, Context, SDK Hook, 사용자 Hook
46
46
 
47
47
  initializer는 `useCounterModel`처럼 모듈 최상위의 이름 있는 Hook으로 정의하세요. 익명 initializer도 런타임에서는 동작하지만 React Compiler의 `infer` 모드에서는 Hook으로 자동 컴파일되지 않습니다.
48
48
 
49
- ## Provider를 마운트하고 필요한 선택하기
49
+ ## Provider를 마운트하고 값 읽기
50
50
 
51
51
  ```tsx
52
52
  function Counter() {
53
- const { count, setCount } = useCounter(s => ({
54
- count: s.count,
55
- setCount: s.setCount,
56
- }))
53
+ const { count, setCount } = useCounter()
57
54
 
58
55
  return <button onClick={() => setCount(count + 1)}>{count}</button>
59
56
  }
@@ -63,7 +60,7 @@ function App() {
63
60
  }
64
61
  ```
65
62
 
66
- selector인라인으로 작성할 있습니다. 선택하지 않은 필드가 바뀌어도 `Counter`는 다시 렌더링되지 않습니다.
63
+ Kerros렌더링 읽은 속성을 추적합니다. 읽지 않은 필드가 바뀌어도 `Counter`는 다시 렌더링되지 않으며 전체 Store를 깊게 비교하지 않습니다.
67
64
 
68
65
  ## 설치
69
66
 
@@ -90,7 +87,7 @@ function createStore<TStore, TProps = Record<never, never>>(
90
87
  const [useStream, StreamProvider] = bindStore<Stream>('Stream')
91
88
  ```
92
89
 
93
- 반환된 Store Hook에는 객체를 반환하는 selector 필요합니다. 대응하는 Provider 밖에서 호출하면 명확한 오류가 발생합니다. Strict Mode와 서버 렌더링을 지원합니다.
90
+ 반환된 Store Hook 인자 없이 자동 추적을 사용합니다. 명시적 객체 selector 파생 값과 측정된 핫스팟을 위한 고급 경로입니다. Provider 밖에서 호출하면 명확한 오류가 발생합니다.
94
91
 
95
92
  고급 통합이 필요한 기존 Headless External Store에만 `bindStore`를 사용하세요. 일반 Hook 상태에는 `createStore`를 사용합니다. Context는 원래 Store 인스턴스만 보관하고 소비자는 `getSnapshot`과 `subscribe`를 직접 사용합니다.
96
93
 
package/README.md CHANGED
@@ -136,7 +136,7 @@ Kerros focuses on a smaller and more direct problem. It does not invent a new da
136
136
 
137
137
  Passing `value` and `onChange` through layer after layer damages component boundaries. Moving everything into one global Store does not automatically make an application scalable or maintainable either.
138
138
 
139
- Sharing frequently changing state through React Context directly also causes repeated work: every Context value change rerenders all consumers. Kerros keeps Provider scoping and multiple instances, but Context carries only a stable container. Components subscribe through selectors and rerender only when their selected result changes.
139
+ Sharing frequently changing state through React Context directly also causes repeated work: every Context value change rerenders all consumers. Kerros keeps Provider scoping and multiple instances, but Context carries only a stable container. Automatic tracking observes render-time reads, so unrelated Store updates do not rerender a component.
140
140
 
141
141
  Kerros stays simple, lightweight, and reliable. Write local state as an ordinary Hook, share it only when necessary, use a Provider to set its scope, and let automatic tracking observe what each component reads.
142
142
 
package/README.zh-CN.md CHANGED
@@ -128,7 +128,7 @@ Kerros 想解决的问题更小,也更直接。它不发明新的数据结构
128
128
 
129
129
  层层传递 `value`、`onChange` 会逐渐破坏组件边界;粗暴地把数据全部塞进一个全局 Store,也不会自动让应用获得更好的扩展性和可维护性。
130
130
 
131
- 直接用 React Context 共享变化频繁的状态也会带来重复渲染:Context value 每次变化,所有消费者都会更新。Kerros 保留 Provider 的作用域和多实例能力,但 Context 只传递稳定容器;组件通过 selector 订阅数据,只有选择结果变化时才重渲染。
131
+ 直接用 React Context 共享变化频繁的状态也会带来重复渲染:Context value 每次变化,所有消费者都会更新。Kerros 保留 Provider 的作用域和多实例能力,但 Context 只传递稳定容器;自动追踪根据渲染期间的读取建立订阅,无关 Store 更新不会触发组件重渲染。
132
132
 
133
133
  Kerros 简单、轻量、可靠。先把状态写成普通 Hook,需要共享时再交给 `createStore`;Provider 决定状态共享到哪里,自动追踪决定每个组件订阅什么。
134
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@violetflux/kerros",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Hook-native state sharing for React with automatic access tracking and focused selectors.",
5
5
  "keywords": [
6
6
  "react",
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: kerros
3
- description: Implement, refactor, review, or test shared React state with @violetflux/kerros. Use for createStore, bindStore, Provider scoping, selector subscriptions, existing headless external Stores, cross-Store composition, migrating from Hox or frequently changing React Context, preventing Context-wide rerenders, and React 17–19 compatibility.
3
+ description: Use when implementing, refactoring, reviewing, or testing shared React state with @violetflux/kerros, including createStore, bindStore, automatic property tracking, Provider scoping, explicit selectors, external Stores, cross-Store composition, Hox or Context migrations, and React 17–19 compatibility.
4
4
  ---
5
5
 
6
6
  # Kerros
7
7
 
8
- Build shared state from ordinary React Hooks. Keep Provider scope and multiple instances while selectors prevent unrelated consumers from rerendering.
8
+ Build shared state from ordinary React Hooks. Keep Provider scope and multiple instances while automatic property tracking prevents unrelated consumers from rerendering by default.
9
9
 
10
10
  ## Workflow
11
11
 
@@ -13,7 +13,7 @@ Build shared state from ordinary React Hooks. Keep Provider scope and multiple i
13
13
  2. Keep state local when only one component needs it. Create a Kerros Store only when several components need the same Hook state.
14
14
  3. Group state by domain and identify one authoritative owner for every mutable value.
15
15
  4. Use `createStore` by default. Use the advanced `bindStore` API only when an authoritative headless external Store already exists.
16
- 5. Mount the Provider at the narrowest shared ancestor and migrate consumers to focused selectors.
16
+ 5. Mount the Provider at the narrowest shared ancestor and let consumers immediately destructure the fields they read.
17
17
  6. Order composed Providers from dependency to dependent and reject circular Store dependencies.
18
18
  7. Run the project's typecheck, tests, lint, and the narrowest useful render test.
19
19
 
@@ -60,20 +60,24 @@ function App() {
60
60
  }
61
61
  ```
62
62
 
63
- Select an object containing only the fields the component reads. Keep the selector inline and use `s` as its parameter:
63
+ Call the Store Hook without a selector and immediately destructure the fields used by the component:
64
64
 
65
65
  ```tsx
66
66
  function Counter() {
67
- const { count, increment } = useCounter(s => ({
68
- count: s.count,
69
- increment: s.increment,
70
- }))
67
+ const { count, increment } = useCounter()
71
68
 
72
69
  return <button onClick={increment}>{count}</button>
73
70
  }
74
71
  ```
75
72
 
76
- Kerros shallowly compares the selected object's top-level fields with `Object.is`. An update to an unselected field must not rerender this component.
73
+ Kerros automatically tracks object, array, and nested property reads made during render. An update to an unread field must not rerender this component; Kerros does not deep-compare the complete Store.
74
+
75
+ ## Subscription modes
76
+
77
+ - `useStore()` is the default. Read properties immediately, normally through destructuring. Do not save, return, spread, serialize, or pass the complete tracked result.
78
+ - `useStore(s => ({ ... }))` is the advanced path for derived values or measured hot spots. Keep the selector inline, name its parameter `s`, and return an object whose top-level fields are shallowly compared with `Object.is`.
79
+ - `createStore(model, { tracking: false })` and `bindStore({ tracking: false })` disable automatic tracking for selector-free calls and compare the complete Store at the top level instead.
80
+ - Primitive Store snapshots use `Object.is`. `Map`, `Set`, class instances, and other atomic objects are tracked by reference as a whole.
77
81
 
78
82
  ## Advanced external Store binding
79
83
 
@@ -97,7 +101,7 @@ Mount the original instance without mirroring its snapshot:
97
101
  </StreamBindingProvider>
98
102
  ```
99
103
 
100
- Use `useStream` with focused selectors for snapshot reads. Use `useStreamInstance()` only in Provider descendants that need imperative commands or must supply the current instance to another headless service. It reads Context without subscribing to snapshots, so never use `useStreamInstance().getSnapshot()` for rendered state.
104
+ Use `useStream()` with immediate property access for ordinary snapshot reads; use an explicit selector only for derived values or measured hot spots. Use `useStreamInstance()` only in Provider descendants that need imperative commands or must supply the current instance to another headless service. It reads Context without subscribing to snapshots, so never use `useStreamInstance().getSnapshot()` for rendered state.
101
105
 
102
106
  Keep creation, start, stop, and disposal in the owner that creates the instance. If that owner already has the instance, use it directly instead of calling the instance Hook.
103
107
 
@@ -108,7 +112,7 @@ Do not replace this with `createStore(() => useSyncExternalStore(...))`; that su
108
112
  - Generate `useXxxModel` as a top-level function by default. Anonymous initializers remain valid at runtime, but React Compiler `infer` mode does not automatically recognize and compile them as Hooks.
109
113
  - Let the Store producer own action identity. React Compiler may stabilize ordinary returned actions; without Compiler support, use `useCallback` only when a consumer or effect requires a stable action reference.
110
114
  - Do not claim that Kerros or `use-context-selector` can determine whether two newly allocated functions are semantically equivalent. Both can compare references, not function behavior.
111
- - Prefer Kerros's existing object selector behavior for consumers that return fresh objects. Kerros shallowly compares the selected object's top-level fields; `use-context-selector` applies `Object.is` to the selector result, so a newly allocated object is different.
115
+ - For explicit selectors, Kerros shallowly compares the selected object's top-level fields; `use-context-selector` applies `Object.is` to the selector result, so a newly allocated object is different.
112
116
  - Do not recommend migrating to `use-context-selector` merely to avoid Context-wide rerenders. Kerros already keeps a stable Context container and publishes committed snapshots through `useSyncExternalStoreWithSelector`.
113
117
 
114
118
  ## Provider props
@@ -141,7 +145,7 @@ function useSessionModel() {
141
145
  const [useSession, SessionProvider] = createStore(useSessionModel)
142
146
 
143
147
  function usePermissionsModel() {
144
- const { userId } = useSession(s => ({ userId: s.userId }))
148
+ const { userId } = useSession()
145
149
  return { canEdit: Boolean(userId) }
146
150
  }
147
151
 
@@ -159,8 +163,8 @@ function Providers({ children }: PropsWithChildren) {
159
163
  ## Guardrails
160
164
 
161
165
  - Use `createStore` for state owned by a React Hook. Treat `bindStore` as an advanced adapter for an already-authoritative headless Store; do not mirror that snapshot through another Hook Store.
162
- - Require every Store read to use an object selector. Do not use array selectors.
163
- - Select concrete fields and actions. Do not expose or select a changing aggregate Store snapshot.
166
+ - Prefer selector-free reads with immediate destructuring. Do not let the tracked result escape render through saving, returning, spreading, serializing, or passing it as an argument.
167
+ - When an explicit selector is justified, return an object of concrete fields and actions. Do not use array selectors or select the complete Store.
164
168
  - Do not wrap inline selectors with `useCallback`; Kerros handles selector identity.
165
169
  - Keep public actions as ordinary functions unless their reference stability is an explicit producer-side requirement. In React 19, use `useEffectEvent` only for events called from Effects, never as a public Store action.
166
170
  - Do not mirror the same mutable state across Stores. Read it from its authoritative Store or move ownership.
@@ -172,8 +176,8 @@ function Providers({ children }: PropsWithChildren) {
172
176
 
173
177
  ## Migrate existing state
174
178
 
175
- - From React Context: keep the Provider boundary, move the changing value into `createStore`, and replace broad `useContext` reads with focused selectors.
176
- - From Hox: replace the factory with `createStore`, add the explicit Provider, remove compatibility exports, and migrate every consumer to an object selector.
179
+ - From React Context: keep the Provider boundary, move the changing value into `createStore`, and replace broad `useContext` reads with selector-free tracked access.
180
+ - From Hox: replace the factory with `createStore`, add the explicit Provider, remove compatibility exports, and migrate consumers to immediate selector-free access.
177
181
  - From a global Store: split by domain only when ownership and dependencies stay clear; do not split merely by field count.
178
182
 
179
183
  ## Verify
@@ -181,6 +185,6 @@ function Providers({ children }: PropsWithChildren) {
181
185
  - Confirm all consumers are below the correct Provider and multiple Provider instances stay isolated.
182
186
  - Search Kerros `createStore` calls and confirm every initializer references a top-level `useXxxModel` function. Search `bindStore` calls and confirm the supplied Store owns a stable immutable snapshot.
183
187
  - Test Provider props, Strict Mode, subscription cleanup, and the outside-Provider error when changing Store infrastructure.
184
- - Add a render-count test showing that changing an unselected field does not rerender the consumer.
185
- - Search for broad Store selections, array selectors, duplicate subscriptions, and dependency cycles.
188
+ - Add a render-count test showing that changing an unread field does not rerender the consumer.
189
+ - Search for tracked-result escape, broad Store reads, whole-Store or array selectors, duplicate subscriptions, and dependency cycles.
186
190
  - Run the consuming project's existing validation commands without introducing a new package manager.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Kerros"
3
- short_description: "Build selector-based shared React state with Kerros"
4
- default_prompt: "Use $kerros to implement shared React state with createStore or bindStore, scoped Providers, and focused selectors."
3
+ short_description: "Build automatically tracked shared React state with Kerros"
4
+ default_prompt: "Use $kerros to implement shared React state with createStore or bindStore, scoped Providers, and selector-free automatic property tracking by default."