@oddkin/state 0.0.0-stage → 1.0.0-beta.0

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -2
  3. package/dist/context/context.d.ts +77 -0
  4. package/dist/context/context.d.ts.map +1 -0
  5. package/dist/context/context.js +335 -0
  6. package/dist/context/context.js.map +1 -0
  7. package/dist/context/index.d.ts +8 -0
  8. package/dist/context/index.d.ts.map +1 -0
  9. package/dist/context/index.js +7 -0
  10. package/dist/context/index.js.map +1 -0
  11. package/dist/index.d.ts +15 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +15 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/inspect/index.d.ts +33 -0
  16. package/dist/inspect/index.d.ts.map +1 -0
  17. package/dist/inspect/index.js +63 -0
  18. package/dist/inspect/index.js.map +1 -0
  19. package/dist/internal/dev.d.ts +6 -0
  20. package/dist/internal/dev.d.ts.map +1 -0
  21. package/dist/internal/dev.js +6 -0
  22. package/dist/internal/dev.js.map +1 -0
  23. package/dist/persist/index.d.ts +74 -0
  24. package/dist/persist/index.d.ts.map +1 -0
  25. package/dist/persist/index.js +228 -0
  26. package/dist/persist/index.js.map +1 -0
  27. package/dist/prod/context/context.js +222 -0
  28. package/dist/prod/context/index.js +8 -0
  29. package/dist/prod/index.js +7 -0
  30. package/dist/prod/inspect/index.js +45 -0
  31. package/dist/prod/internal/dev.js +4 -0
  32. package/dist/prod/persist/index.js +140 -0
  33. package/dist/prod/store/index.js +6 -0
  34. package/dist/prod/store/store.js +167 -0
  35. package/dist/store/index.d.ts +7 -0
  36. package/dist/store/index.d.ts.map +1 -0
  37. package/dist/store/index.js +6 -0
  38. package/dist/store/index.js.map +1 -0
  39. package/dist/store/store.d.ts +83 -0
  40. package/dist/store/store.d.ts.map +1 -0
  41. package/dist/store/store.js +235 -0
  42. package/dist/store/store.js.map +1 -0
  43. package/package.json +50 -4
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Optional shared stores on Oddkin's reactive graph (core-contracts.md §7). DOM-free.
3
+ *
4
+ * A store holds one immutable snapshot in a core signal. `state` and `select()` are ordinary
5
+ * readables (a read-only computed view and memoized computed values), so effects, bindings, and
6
+ * other computed values observe them through the same graph and `Scope` ownership as any signal:
7
+ * a selector registers with the store only while something observes it.
8
+ */
9
+ import { DEV } from '../internal/dev.js';
10
+ import { OddkinError } from '@oddkin/core/diagnostics';
11
+ import { batch, computed, signal, untracked, } from '@oddkin/core/reactive';
12
+ /** @internal Key of a store's {@link StoreInternals}. */
13
+ export const INTERNALS = Symbol('oddkin.store.internals');
14
+ const live = { stores: 0, subscriptions: 0 };
15
+ /** @internal Live stores (created, not disposed) and live `subscribe()` listeners. */
16
+ export function liveCounts() {
17
+ return { ...live };
18
+ }
19
+ /** Action names currently running, outermost first. */
20
+ const running = [];
21
+ const noop = () => { };
22
+ /** A root prototype (of any realm): plain objects, `Object.create(null)` dictionaries. */
23
+ function isPlainObject(value) {
24
+ const proto = Object.getPrototypeOf(value);
25
+ return proto === null || Object.getPrototypeOf(proto) === null;
26
+ }
27
+ /**
28
+ * Freeze the plain objects and arrays reachable from `root`. Stops at frozen values (unchanged
29
+ * parts of a snapshot were frozen with an earlier one) and at other objects. Iterative, so deep
30
+ * structures cannot overflow the stack; reads data properties only, so no getter runs.
31
+ */
32
+ function freezeSnapshot(root) {
33
+ const pending = [root];
34
+ while (pending.length > 0) {
35
+ const value = pending.pop();
36
+ if (typeof value !== 'object' || value === null || Object.isFrozen(value))
37
+ continue;
38
+ if (Array.isArray(value)) {
39
+ Object.freeze(value);
40
+ for (let i = 0; i < value.length; i++)
41
+ pending.push(value[i]);
42
+ }
43
+ else if (isPlainObject(value)) {
44
+ Object.freeze(value);
45
+ for (const key of Object.keys(value)) {
46
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
47
+ if (descriptor && 'value' in descriptor)
48
+ pending.push(descriptor.value);
49
+ }
50
+ }
51
+ }
52
+ }
53
+ class StoreImpl {
54
+ name;
55
+ state;
56
+ #value;
57
+ #initial;
58
+ #freeze;
59
+ #subscriptions = new Set();
60
+ #observers;
61
+ #updates = 0;
62
+ #updating = false;
63
+ #disposed = false;
64
+ constructor(initial, options) {
65
+ this.name = options?.name;
66
+ this.#freeze = options?.freeze ?? true;
67
+ if (this.#freeze)
68
+ freezeSnapshot(initial);
69
+ this.#initial = initial;
70
+ const named = this.name === undefined ? undefined : { name: this.name };
71
+ this.#value = signal(initial, named);
72
+ this.state = computed(() => this.#value.value, named);
73
+ live.stores++;
74
+ }
75
+ get disposed() {
76
+ return this.#disposed;
77
+ }
78
+ getSnapshot = () => this.#value.peek();
79
+ subscribe = (listener) => {
80
+ if (this.#disposed)
81
+ return noop;
82
+ const off = this.#value.subscribe(listener);
83
+ let active = true;
84
+ const release = () => {
85
+ if (!active)
86
+ return;
87
+ active = false;
88
+ this.#subscriptions.delete(release);
89
+ live.subscriptions--;
90
+ off();
91
+ };
92
+ this.#subscriptions.add(release);
93
+ live.subscriptions++;
94
+ return release;
95
+ };
96
+ update(updater) {
97
+ this.#check('update');
98
+ const previous = this.#value.peek();
99
+ let next;
100
+ this.#updating = true;
101
+ try {
102
+ next = untracked(() => updater(previous));
103
+ }
104
+ finally {
105
+ this.#updating = false;
106
+ }
107
+ this.#commit(previous, next);
108
+ }
109
+ select(selector, options) {
110
+ return computed(() => selector(this.#value.value), options);
111
+ }
112
+ reset() {
113
+ this.#check('reset');
114
+ this.#commit(this.#value.peek(), this.#initial);
115
+ }
116
+ dispose() {
117
+ if (this.#disposed)
118
+ return;
119
+ this.#disposed = true;
120
+ live.stores--;
121
+ for (const release of [...this.#subscriptions])
122
+ release();
123
+ const observers = this.#observers;
124
+ this.#observers = undefined;
125
+ if (observers)
126
+ for (const observer of observers)
127
+ observer.dispose();
128
+ }
129
+ get [INTERNALS]() {
130
+ const store = this;
131
+ return {
132
+ get subscribers() {
133
+ return store.#subscriptions.size;
134
+ },
135
+ get updates() {
136
+ return store.#updates;
137
+ },
138
+ observe(observer) {
139
+ if (store.#disposed) {
140
+ observer.dispose();
141
+ return noop;
142
+ }
143
+ (store.#observers ??= new Set()).add(observer);
144
+ return () => void store.#observers?.delete(observer);
145
+ },
146
+ };
147
+ }
148
+ #check(operation) {
149
+ if (this.#disposed) {
150
+ throw new OddkinError('state.store.disposed', DEV
151
+ ? `Cannot ${operation} ${this.name ? `store "${this.name}"` : 'a store'} after dispose(). Stop the work that updates it (own it with the same Scope) or keep the store alive.`
152
+ : '');
153
+ }
154
+ if (this.#updating) {
155
+ throw new OddkinError('state.update.reentrant', DEV
156
+ ? `Cannot ${operation} ${this.name ? `store "${this.name}"` : 'a store'} from inside its own updater: the outer updater would overwrite the result. Return the combined change from one updater instead.`
157
+ : '');
158
+ }
159
+ }
160
+ #commit(previous, next) {
161
+ if (Object.is(previous, next))
162
+ return;
163
+ if (this.#freeze)
164
+ freezeSnapshot(next);
165
+ // Observers record the update before subscribers run, so an update a subscriber makes is
166
+ // recorded after the one that caused it.
167
+ batch(() => {
168
+ this.#value.value = next;
169
+ this.#updates++;
170
+ const observers = this.#observers;
171
+ if (!observers)
172
+ return;
173
+ const record = { previous, next, actions: [...running] };
174
+ for (const observer of [...observers])
175
+ observer.update(record);
176
+ });
177
+ }
178
+ }
179
+ /**
180
+ * Create a store holding `initial` as its first snapshot. Update it with `update()`, which takes the
181
+ * current snapshot and returns the next one; read it through `state`, `select()`, `getSnapshot()`,
182
+ * or `subscribe()`. No provider, registry, or reducer is needed.
183
+ */
184
+ export function createStore(initial, options) {
185
+ return new StoreImpl(initial, options);
186
+ }
187
+ /**
188
+ * Name a unit of work for inspection. `fn` runs inside `batch()`, so subscribers are notified once
189
+ * when it returns, and every store update it makes records the name; nested actions record the
190
+ * whole chain. Batching is not a transaction: if `fn` throws, updates it already made stay. Only
191
+ * synchronous work belongs to the action; updates after an `await` do not.
192
+ */
193
+ export function action(name, fn) {
194
+ return (...args) => {
195
+ running.push(name);
196
+ try {
197
+ return batch(() => fn(...args));
198
+ }
199
+ finally {
200
+ running.pop();
201
+ }
202
+ };
203
+ }
204
+ /**
205
+ * Equality for `select()` results built from several fields: the same value, or arrays or plain
206
+ * objects with the same entries compared with `Object.is`. Maps, sets, and class instances are
207
+ * equal only when identical.
208
+ */
209
+ export function shallowEqual(a, b) {
210
+ if (Object.is(a, b))
211
+ return true;
212
+ if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
213
+ return false;
214
+ if (Array.isArray(a) || Array.isArray(b)) {
215
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
216
+ return false;
217
+ for (let i = 0; i < a.length; i++)
218
+ if (!Object.is(a[i], b[i]))
219
+ return false;
220
+ return true;
221
+ }
222
+ if (!isPlainObject(a) || !isPlainObject(b))
223
+ return false;
224
+ const keys = Object.keys(a);
225
+ if (keys.length !== Object.keys(b).length)
226
+ return false;
227
+ for (const key of keys) {
228
+ if (!Object.hasOwn(b, key))
229
+ return false;
230
+ if (!Object.is(a[key], b[key]))
231
+ return false;
232
+ }
233
+ return true;
234
+ }
235
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,GAKV,MAAM,uBAAuB,CAAC;AA+D/B,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAkB,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAEzE,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;AAE7C,sFAAsF;AACtF,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,G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,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAE,CAA6B,CAAC,GAAG,CAAC,EAAG,CAA6B,CAAC,GAAG,CAAC,CAAC;YACtF,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@oddkin/state",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0-beta.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/brianchristopherbrady/oddkin.git",
8
+ "directory": "packages/state"
9
+ },
10
+ "description": "Optional stores, selectors, context, persistence, and inspection.",
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "development": "./dist/index.js",
17
+ "default": "./dist/prod/index.js"
18
+ },
19
+ "./store": {
20
+ "types": "./dist/store/index.d.ts",
21
+ "development": "./dist/store/index.js",
22
+ "default": "./dist/prod/store/index.js"
23
+ },
24
+ "./context": {
25
+ "types": "./dist/context/index.d.ts",
26
+ "development": "./dist/context/index.js",
27
+ "default": "./dist/prod/context/index.js"
28
+ },
29
+ "./inspect": {
30
+ "types": "./dist/inspect/index.d.ts",
31
+ "development": "./dist/inspect/index.js",
32
+ "default": "./dist/prod/inspect/index.js"
33
+ },
34
+ "./persist": {
35
+ "types": "./dist/persist/index.d.ts",
36
+ "development": "./dist/persist/index.js",
37
+ "default": "./dist/prod/persist/index.js"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "README.md"
44
+ ],
45
+ "dependencies": {
46
+ "@oddkin/core": "^1.0.0-beta.0"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "tag": "beta"
51
+ }
52
+ }