sia-reactor 0.0.23 → 0.0.25

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 (33) hide show
  1. package/README.md +12 -13
  2. package/dist/{TimeTravelOverlay-OjklzuCD.d.cts → TimeTravelOverlay-Bz2v9hov.d.cts} +6 -6
  3. package/dist/{TimeTravelOverlay-Dglcwpg-.d.ts → TimeTravelOverlay-CvTDJWpP.d.ts} +6 -6
  4. package/dist/adapters/react.cjs +54 -34
  5. package/dist/adapters/react.d.cts +8 -8
  6. package/dist/adapters/react.d.ts +8 -8
  7. package/dist/adapters/react.js +3 -3
  8. package/dist/adapters/vanilla.cjs +54 -34
  9. package/dist/adapters/vanilla.d.cts +4 -4
  10. package/dist/adapters/vanilla.d.ts +4 -4
  11. package/dist/adapters/vanilla.js +3 -3
  12. package/dist/{chunk-MSTHQVNK.js → chunk-3UHI7CNE.js} +55 -39
  13. package/dist/{chunk-MKL3JUPO.js → chunk-EZ4VRGYI.js} +19 -13
  14. package/dist/{chunk-5JNWC7Z4.js → chunk-MWC3R7QL.js} +6 -6
  15. package/dist/{index-m0aAWxhX.d.cts → index-CB-IiZIB.d.cts} +62 -48
  16. package/dist/{index-m0aAWxhX.d.ts → index-CB-IiZIB.d.ts} +62 -48
  17. package/dist/index.cjs +59 -39
  18. package/dist/index.d.cts +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/modules.cjs +61 -37
  22. package/dist/modules.d.cts +13 -13
  23. package/dist/modules.d.ts +13 -13
  24. package/dist/modules.js +4 -2
  25. package/dist/super.d.ts +97 -82
  26. package/dist/super.global.js +76 -52
  27. package/dist/{timeTravel-DctvcHVt.d.cts → timeTravel-CEc3grUE.d.cts} +15 -15
  28. package/dist/{timeTravel-DExvNb04.d.ts → timeTravel-D7NiYqdD.d.ts} +15 -15
  29. package/dist/utils.cjs +19 -13
  30. package/dist/utils.d.cts +1 -1
  31. package/dist/utils.d.ts +1 -1
  32. package/dist/utils.js +1 -1
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -156,21 +156,20 @@ reactor.core.player.volume = 100; // re-assign core if desired
156
156
  All methods are available on `Reactor` instances or objects wrapped in `reactive()`.
157
157
 
158
158
  #### **Mediators (Synchronous Gatekeepers)**
159
- - **`set(path, callback, options)`**: Intercept memory writes. Return a value to modify it, or return `TERMINATOR` to block the write entirely.
160
- - **`get(path, callback, options)`**: Intercept and format data during retrieval.
161
- - **`delete(path, callback, options)`**: Intercept property deletion.
159
+ - **`set(path, callback, options)` <-> `noset(path, callback)`**: Intercept memory writes. Return a value to modify it, or return `TERMINATOR` to block the write entirely.
160
+ - **`get(path, callback, options)` <-> `noget(path, callback)`**: Intercept and format data during retrieval.
161
+ - **`delete(path, callback, options)` <-> `nodelete(path, callback)`**: Intercept property deletion.
162
162
 
163
163
  #### **Watchers (Synchronous Observers)**
164
- - **`watch(path, callback, options)`**: Fires instantly after a mutation. Use strictly for critical internal engine syncing on leaf paths preferably, sees only direct operations.
164
+ - **`watch(path, callback, options)` <-> `nowatch(path, callback)`**: Fires instantly after a mutation. Use strictly for critical internal engine syncing on leaf paths preferably, sees only direct operations.
165
165
 
166
166
  #### **Listeners (Asynchronous/Batched UI Observers)**
167
- - **`on(path, callback, options)`**: Attach DOM-style event listeners that respect `depth`. Supports `{ capture: true, depth: 1, once: true, immediate: true }`.
168
- - **`once(path, callback, options)`**: Fires once and self-destructs.
169
- - **`off(path, callback, options)`**: Removes a listener.
167
+ - **`on(path, callback, options)` <-> `off(path, callback, options)`**: Attach DOM-style event listeners that respect `depth`. Supports `{ capture: true, depth: 1, once: true, immediate: true }`.
168
+ - **`once(path, callback, options)`**: Fires once and self-destructs, others have too: `sonce(...)`, `gonce(...)`, `donce(...)`, `wonce(...)`.
170
169
 
171
170
  #### **Lifecycle & Utilities**
172
171
  - **`tick(path)`**: Forces a synchronous flush of the batch queue for a specific path.
173
- - **`stall(task)` / `nostall(task)`**: Manually stall the queue to wait for calculations before rendering.
172
+ - **`stall(task)` <-> `nostall(task)`**: Manually stall the queue to wait for calculations before rendering.
174
173
  - **`snapshot(raw)`**: Generates a strict, structurally-shared, un-proxied clone of the current state tree.
175
174
  - **`use(new ReactorModule(config), id)`**: Allows extended behaviour with external logic.
176
175
  - **`reset()`**: Clears all records bringing everything back to a clean slate.
@@ -178,18 +177,18 @@ All methods are available on `Reactor` instances or objects wrapped in `reactive
178
177
 
179
178
  ### Memory & Granular Control Flags
180
179
 
181
- You can wrap properties in special flags *before* initializing the reactor to dictate exactly how the Proxy treats them.
180
+ You can wrap properties in special flags *before* initializing the reactor to dictate exactly how the Proxy treats them. e.g. `reactive(volatile(intent({ behavior: "auto" })))`, e.t.c.
182
181
 
183
- - **`inert(obj)` / `live(obj)`**: Tells the proxy to completely ignore an object. It will not be deeply tracked.
184
- - **`intent(obj)` / `state(obj)`**: Marks an object as rejectable. Allows listeners to call `e.reject()` during the Capture phase.
185
- - **`volatile(obj)` / `stable(obj)`**: Forces the reactor to fire event waves even if the new value is identical to the old value (bypassing the Proxy's unchanged performance check).
182
+ - **`intent(obj)` <-> `state(obj)`**: Marks an object as rejectable. Allows listeners to call `e.reject()` during the Capture phase.
183
+ - **`inert(obj)` <-> `live(obj)`**: Tells the proxy to completely ignore an object. It will not be deeply tracked.
184
+ - **`volatile(obj)` <-> `stable(obj)`**: Forces the reactor to fire event waves even if the new value is identical to the old value (bypassing the Proxy's unchanged performance check).
186
185
 
187
186
  ```javascript
188
187
  import { reactive, intent, volatile, inert } from "sia-reactor";
189
188
 
190
189
  const data = reactive({
191
190
  apiResponse: inert({ heavy: "data" }), // Proxy won't traverse this
192
- userWish: intent({ flying: false }), // Can be rejected by a Higher Power
191
+ userWish: intent({ flying: false }), // Can be rejected by a Handler or a Higher Power
193
192
  trigger: volatile({ clickCount: 0 }) // Fires events even if set to 0 again
194
193
  });
195
194
  ```
@@ -1,8 +1,8 @@
1
- import { d as Reactive } from './index-m0aAWxhX.cjs';
2
- import { m as TimeTravelModule } from './timeTravel-DctvcHVt.cjs';
1
+ import { d as Reactive } from './index-CB-IiZIB.cjs';
2
+ import { m as TimeTravelModule } from './timeTravel-CEc3grUE.cjs';
3
3
 
4
4
  /** Reactive options for the TimeTravel overlay instance. */
5
- interface TimeTravelConfig {
5
+ interface TimeTravelOverlayConfig {
6
6
  /** Header text shown at the top of the overlay panel. */
7
7
  title: string;
8
8
  /** Accent color used to derive panel theme variables. */
@@ -22,7 +22,7 @@ interface TimeTravelConfig {
22
22
  declare class TimeTravelOverlay {
23
23
  static count: number;
24
24
  index: number;
25
- config: TimeTravelConfig;
25
+ config: TimeTravelOverlayConfig;
26
26
  readonly state: Reactive<{
27
27
  open: boolean;
28
28
  import: string;
@@ -35,8 +35,8 @@ declare class TimeTravelOverlay {
35
35
  * @param time TimeTravel module instance that owns timeline operations.
36
36
  * @param build Optional initial overlay config overrides.
37
37
  */
38
- constructor(time: TimeTravelModule, build?: Partial<TimeTravelConfig>);
38
+ constructor(time: TimeTravelModule, build?: Partial<TimeTravelOverlayConfig>);
39
39
  destroy(): void;
40
40
  }
41
41
 
42
- export { type TimeTravelConfig as T, TimeTravelOverlay as a };
42
+ export { TimeTravelOverlay as T, type TimeTravelOverlayConfig as a };
@@ -1,8 +1,8 @@
1
- import { d as Reactive } from './index-m0aAWxhX.js';
2
- import { m as TimeTravelModule } from './timeTravel-DExvNb04.js';
1
+ import { d as Reactive } from './index-CB-IiZIB.js';
2
+ import { m as TimeTravelModule } from './timeTravel-D7NiYqdD.js';
3
3
 
4
4
  /** Reactive options for the TimeTravel overlay instance. */
5
- interface TimeTravelConfig {
5
+ interface TimeTravelOverlayConfig {
6
6
  /** Header text shown at the top of the overlay panel. */
7
7
  title: string;
8
8
  /** Accent color used to derive panel theme variables. */
@@ -22,7 +22,7 @@ interface TimeTravelConfig {
22
22
  declare class TimeTravelOverlay {
23
23
  static count: number;
24
24
  index: number;
25
- config: TimeTravelConfig;
25
+ config: TimeTravelOverlayConfig;
26
26
  readonly state: Reactive<{
27
27
  open: boolean;
28
28
  import: string;
@@ -35,8 +35,8 @@ declare class TimeTravelOverlay {
35
35
  * @param time TimeTravel module instance that owns timeline operations.
36
36
  * @param build Optional initial overlay config overrides.
37
37
  */
38
- constructor(time: TimeTravelModule, build?: Partial<TimeTravelConfig>);
38
+ constructor(time: TimeTravelModule, build?: Partial<TimeTravelOverlayConfig>);
39
39
  destroy(): void;
40
40
  }
41
41
 
42
- export { type TimeTravelConfig as T, TimeTravelOverlay as a };
42
+ export { TimeTravelOverlay as T, type TimeTravelOverlayConfig as a };
@@ -73,7 +73,7 @@ function isPOJO(obj, config = NIL, typecheck = true) {
73
73
  function canHandle(obj, config = NIL, typecheck = true) {
74
74
  if (typecheck && !isObj(obj, false) || obj[INERTIA]) return false;
75
75
  if (Array.isArray(obj) || !config.preserveContext && isPOJO(obj, config, false)) return true;
76
- if (config.preserveContext) return !(obj instanceof Map) && !(obj instanceof Set) && !(obj instanceof WeakMap) && !(obj instanceof WeakSet) && !(obj instanceof Error) && !(obj instanceof Number) && !(obj instanceof Date) && !(obj instanceof String) && !(obj instanceof RegExp) && !(obj instanceof ArrayBuffer) && !(obj instanceof Promise);
76
+ if (config.preserveContext) return !(obj instanceof String) && !(obj instanceof Number) && !(obj instanceof Function) && !(obj instanceof Date) && !(obj instanceof Error) && !(obj instanceof RegExp) && !(obj instanceof Promise) && !(obj instanceof Map) && !(obj instanceof WeakMap) && !(obj instanceof Set) && !(obj instanceof WeakSet) && !(obj instanceof EventTarget);
77
77
  return false;
78
78
  }
79
79
  function getAny(source, key, separator = ".", keyFunc) {
@@ -157,7 +157,10 @@ function parseEvtOpts(options, opts, boolOpt = opts[0], result = {}) {
157
157
  }
158
158
  function getTrailRecords(obj, path, reverse = false) {
159
159
  const parts = path.split("."), chain = [["*", obj, obj]];
160
- for (let acc = "", currObj = obj, i = 0, len = parts.length; i < len; i++) chain.push([acc += (i ? "." : "") + parts[i], currObj, currObj = currObj?.[parts[i]]]);
160
+ for (let acc = "", currObj = obj, i = 0, len = parts.length; i < len; i++) {
161
+ const part = parts[i];
162
+ chain.push([acc += (i ? "." : "") + part, currObj, currObj = currObj?.[part]]);
163
+ }
161
164
  return reverse ? chain.reverse() : chain;
162
165
  }
163
166
  function nuke(target) {
@@ -165,10 +168,11 @@ function nuke(target) {
165
168
  while (proto && proto !== Object.prototype) {
166
169
  const keys2 = Object.getOwnPropertyNames(proto);
167
170
  for (let i = 0, len = keys2.length; i < len; i++) {
168
- if (keys2[i] === "constructor") continue;
171
+ const key = keys2[i];
172
+ if (key === "constructor") continue;
169
173
  const desc = Object.getOwnPropertyDescriptor(proto, keys2[i]);
170
174
  if (desc && ("function" === typeof desc.value || desc.get || desc.set)) continue;
171
- proto[keys2[i]] = null;
175
+ proto[key] = null;
172
176
  }
173
177
  proto = Object.getPrototypeOf(proto);
174
178
  }
@@ -463,7 +467,10 @@ var Reactor = class {
463
467
  seen.add(target);
464
468
  const es = (this.lineage ??= /* @__PURE__ */ new WeakMap()).get(target);
465
469
  if (!es) return paths;
466
- for (let i = 0, len = es.length; i < len; i += 2) this.trace(es[i], es[i + 1] ? es[i + 1] + "." + path : path, paths, seen);
470
+ for (let i = 0, len = es.length; i < len; i += 2) {
471
+ const prev = es[i + 1];
472
+ this.trace(es[i], prev ? prev + "." + path : path, paths, seen);
473
+ }
467
474
  return paths;
468
475
  }
469
476
  // won't be called without `.config.referenceTracking` so internal guard avoided
@@ -493,9 +500,9 @@ var Reactor = class {
493
500
  let terminated = false, value = payload.target.value;
494
501
  const isGet = type === "get", isSet = type === "set", mediators = isGet ? this.getters : isSet ? this.setters : this.deleters;
495
502
  for (let i = !isGet ? 0 : cords.length - 1, len = !isGet ? cords.length : -1; i !== len; i += !isGet ? 1 : -1) {
496
- const response = isGet ? cords[i].cb(value, payload) : isSet ? cords[i].cb(value, terminated, payload) : cords[i].cb(terminated, payload);
503
+ const cord = cords[i], response = isGet ? cord.cb(value, payload) : isSet ? cord.cb(value, terminated, payload) : cord.cb(terminated, payload);
497
504
  if (isGet || !(terminated ||= payload.terminated = response === TERMINATOR)) value = response;
498
- if (cords[i].once) cords.splice((len--, i--), 1), !cords.length && mediators.delete(path);
505
+ if (cord.once) cords.splice((len--, i--), 1), !cords.length && mediators.delete(path);
499
506
  }
500
507
  return value;
501
508
  }
@@ -504,13 +511,15 @@ var Reactor = class {
504
511
  const wildcords = this.watchers.get("*"), cords = this.watchers.get(path);
505
512
  if (cords)
506
513
  for (let i = 0, len = cords.length; i < len; i++) {
507
- cords[i].cb(payload.target.value, payload);
508
- if (cords[i].once) cords.splice((len--, i--), 1), !cords.length && this.watchers.delete(path);
514
+ const cord = cords[i];
515
+ cord.cb(payload.target.value, payload);
516
+ if (cord.once) cords.splice((len--, i--), 1), !cords.length && this.watchers.delete(path);
509
517
  }
510
518
  if (wildcords)
511
519
  for (let i = 0, len = wildcords.length; i < len; i++) {
512
- wildcords[i].cb(payload.target.value, payload);
513
- if (wildcords[i].once) wildcords.splice((len--, i--), 1), !wildcords.length && this.watchers.delete("*");
520
+ const wildcord = wildcords[i];
521
+ wildcord.cb(payload.target.value, payload);
522
+ if (wildcord.once) wildcords.splice((len--, i--), 1), !wildcords.length && this.watchers.delete("*");
514
523
  }
515
524
  }
516
525
  this.listeners && this.schedule(path, payload);
@@ -549,14 +558,15 @@ var Reactor = class {
549
558
  e.type = path !== e.target.path ? "update" : e.staticType;
550
559
  e.currentTarget = { path, value, oldValue: e.type !== "update" ? e.target.oldValue : void 0, key: e.type !== "update" ? path : path.slice(path.lastIndexOf(".") + 1) || "", hadKey: e.type !== "update" ? e.target.hadKey : true, object };
551
560
  for (let i = 0, len = cords.length, tDepth; i < len; i++) {
561
+ const cord = cords[i];
552
562
  if (e.immediatePropagationStopped) break;
553
- if (cords[i].capture !== isCapture) continue;
554
- if (cords[i].depth !== void 0) {
563
+ if (cord.capture !== isCapture) continue;
564
+ if (cord.depth !== void 0) {
555
565
  tDepth ??= this.getDepth(e.target.path);
556
- if (tDepth > cords[i].lDepth + cords[i].depth) continue;
566
+ if (tDepth > cord.lDepth + cord.depth) continue;
557
567
  }
558
- cords[i].cb(e);
559
- if (cords[i].once) cords.splice((len--, i--), 1), !cords.length && this.listeners.delete(path);
568
+ cord.cb(e);
569
+ if (cord.once) cords.splice((len--, i--), 1), !cords.length && this.listeners.delete(path);
560
570
  }
561
571
  }
562
572
  /**
@@ -618,25 +628,28 @@ var Reactor = class {
618
628
  const clone = !raw ? this.config.preserveContext ? Object.create(Object.getPrototypeOf(obj)) : Array.isArray(obj) ? [] : {} : obj;
619
629
  seen.set(obj, clone);
620
630
  const keys2 = this.config.preserveContext ? Reflect.ownKeys(obj) : Object.keys(obj);
621
- for (let i = 0, len = keys2.length; i < len; i++)
631
+ for (let i = 0, len = keys2.length; i < len; i++) {
632
+ const key = keys2[i];
622
633
  try {
623
- clone[keys2[i]] = this.cloned(obj[keys2[i]], raw, seen);
634
+ clone[key] = this.cloned(obj[key], raw, seen);
624
635
  } catch (e) {
625
636
  if (e instanceof RangeError) throw e;
626
637
  }
638
+ }
627
639
  if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
628
640
  return clone;
629
641
  }
630
642
  syncAdd(key, path, cb, opts, onImmediate = NOOP) {
631
643
  const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
632
644
  let cords = store.get(path), cord;
633
- if (cords) {
634
- for (let i = 0, len = cords.length; i < len; i++)
635
- if (Object.is(cords[i].cb, cb)) {
636
- cord = cords[i];
645
+ if (cords)
646
+ for (let i = 0, len = cords.length; i < len; i++) {
647
+ const excord = cords[i];
648
+ if (Object.is(excord.cb, cb)) {
649
+ cord = excord;
637
650
  break;
638
651
  }
639
- }
652
+ }
640
653
  if (cord) return cord.clup;
641
654
  let task;
642
655
  cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
@@ -648,7 +661,10 @@ var Reactor = class {
648
661
  syncDrop(store, path, cb) {
649
662
  const cords = store?.get(path);
650
663
  if (!cords) return void 0;
651
- for (let i = 0, len = cords.length; i < len; i++) if (Object.is(cords[i].cb, cb)) return cords[i].sclup(), cords.splice((len--, i--), 1), !cords.length && store.delete(path), true;
664
+ for (let i = 0, len = cords.length; i < len; i++) {
665
+ const cord = cords[i];
666
+ if (Object.is(cord.cb, cb)) return cord.sclup(), cords.splice((len--, i--), 1), !cords.length && store.delete(path), true;
667
+ }
652
668
  return false;
653
669
  }
654
670
  /**
@@ -766,13 +782,14 @@ var Reactor = class {
766
782
  this.listeners ??= /* @__PURE__ */ new Map();
767
783
  const { capture = false, once = false, signal, immediate = false, depth } = parseEvtOpts(options, EVT_OPTS.LISTENER);
768
784
  let cords = this.listeners.get(path), cord;
769
- if (cords) {
770
- for (let i = 0, len = cords.length; i < len; i++)
771
- if (Object.is(cords[i].cb, callback) && capture === cords[i].capture) {
772
- cord = cords[i];
785
+ if (cords)
786
+ for (let i = 0, len = cords.length; i < len; i++) {
787
+ const excord = cords[i];
788
+ if (Object.is(excord.cb, callback) && capture === excord.capture) {
789
+ cord = excord;
773
790
  break;
774
791
  }
775
- }
792
+ }
776
793
  if (cord) return cord.clup;
777
794
  cord = { cb: callback, capture, depth, once, clup: () => this.off(path, callback, options), lDepth: depth !== void 0 ? this.getDepth(path) : depth };
778
795
  if (immediate && (immediate !== "auto" || inAny(this.core, path))) {
@@ -801,7 +818,10 @@ var Reactor = class {
801
818
  const cords = this.listeners?.get(path);
802
819
  if (!cords) return void 0;
803
820
  const { capture } = parseEvtOpts(options, EVT_OPTS.LISTENER);
804
- for (let i = 0, len = cords.length; i < len; i++) if (Object.is(cords[i].cb, callback) && cords[i].capture === capture) return cords[i].sclup(), cords.splice((len--, i--), 1), !cords.length && this.listeners.delete(path), true;
821
+ for (let i = 0, len = cords.length; i < len; i++) {
822
+ const cord = cords[i];
823
+ if (Object.is(cord.cb, callback) && cord.capture === capture) return cord.sclup(), cords.splice((len--, i--), 1), !cords.length && this.listeners.delete(path), true;
824
+ }
805
825
  return false;
806
826
  }
807
827
  snapshot(raw = !this.config.smartCloning, branch) {
@@ -873,19 +893,19 @@ var Autotracker = class {
873
893
  this.autortr = this.rtr = rtr;
874
894
  }
875
895
  /**
876
- * Starts a new tracking pass and returns a tracking proxy for `target` if `this` was instantiated with a `Reactor`.
896
+ * Starts a new tracking pass and returns a readonly tracking proxy for `target` if `this` was instantiated with a `Reactor`.
877
897
  * @param target Snapshot (or state branch) to track reads from.
878
- * @returns Read-tracking proxy.
898
+ * @returns Read-tracking readonly proxy.
879
899
  * @example
880
900
  * const atrkr = new Autotracker(rtr);
881
901
  * const state = atrkr.tracked(rtr.snapshot());
882
902
  * const name = state.user.profile.name;
883
903
  */
884
904
  tracked(target) {
885
- return this.unblock(), this.rtr ? this.proxy = this.proxied(target, "") : target;
905
+ return this.unblock(), this.proxy = this.proxied(target, "");
886
906
  }
887
907
  proxied(obj, path) {
888
- if (!obj || "object" !== typeof obj) return obj;
908
+ if (!this.rtr || !obj || "object" !== typeof obj) return obj;
889
909
  const cached = this.proxyCache.get(obj);
890
910
  if (cached) return cached;
891
911
  if (!canHandle(obj, this.rtr.config, false)) return obj;
@@ -1,7 +1,7 @@
1
- import { E as EffectOptions, R as Reactor, d as Reactive, u as ReactorBuild, W as WildPaths, v as PathValue } from '../index-m0aAWxhX.cjs';
1
+ import { E as EffectOptions, R as Reactor, d as Reactive, v as ReactorBuild, D as DeepReadonly, W as WildPaths, e as PathValue } from '../index-CB-IiZIB.cjs';
2
2
  import { useLayoutEffect } from 'react';
3
- import { m as TimeTravelModule } from '../timeTravel-DctvcHVt.cjs';
4
- import { T as TimeTravelConfig } from '../TimeTravelOverlay-OjklzuCD.cjs';
3
+ import { m as TimeTravelModule } from '../timeTravel-CEc3grUE.cjs';
4
+ import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-Bz2v9hov.cjs';
5
5
 
6
6
  /**
7
7
  * Subscribes a component to desired Reactor state and returns it.
@@ -30,7 +30,7 @@ declare function useReactor<T extends object>(target: T | Reactor<T> | Reactive<
30
30
  */
31
31
  declare function useAnyReactor(options?: EffectOptions): void;
32
32
  /**
33
- * Subscribes a component to Reactor state and returns a tracked snapshot.
33
+ * Subscribes a component to Reactor state and returns a readonly tracked snapshot.
34
34
  * Rule of thumb: read from snapshots, mutate the source.
35
35
  * The hook uses access tracking so re-renders occur only when accessed fields change.
36
36
  * @typeParam T Root state object type.
@@ -47,7 +47,7 @@ declare function useAnyReactor(options?: EffectOptions): void;
47
47
  * const rtr = new Reactor({ user: { name: "Kosi" } });
48
48
  * const c = useReactorSnapshot(rtr);
49
49
  */
50
- declare function useReactorSnapshot<T extends object>(target: T | Reactor<T> | Reactive<T>, options?: EffectOptions, build?: ReactorBuild<T>): T;
50
+ declare function useReactorSnapshot<T extends object>(target: T | Reactor<T> | Reactive<T>, options?: EffectOptions, build?: ReactorBuild<T>): DeepReadonly<T>;
51
51
 
52
52
  /**
53
53
  * Subscribes to a derived slice of Reactor state.
@@ -84,7 +84,7 @@ declare function useSelector<T extends object, R>(target: T | Reactor<T> | React
84
84
  declare function useAnySelector<R>(sel: () => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions): R;
85
85
  /**
86
86
  * Subscribes to a derived slice of Reactor state.
87
- * The selector runs against a tracked snapshot and uses the provided equality function
87
+ * The selector runs against a readonly tracked snapshot and uses the provided equality function
88
88
  * to suppress unchanged results.
89
89
  * @typeParam T Root state object type.
90
90
  * @typeParam R Selector return type.
@@ -103,7 +103,7 @@ declare function useAnySelector<R>(sel: () => R, eq?: (value1: any, value2: any)
103
103
  * const rtr = new Reactor({ user: { name: "Kosi" } });
104
104
  * const c = useSelectorSnapshot(rtr, (s) => s.user.name);
105
105
  */
106
- declare function useSelectorSnapshot<T extends object, R>(target: T | Reactor<T> | Reactive<T>, sel: (state: T) => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions, build?: ReactorBuild<T>): R;
106
+ declare function useSelectorSnapshot<T extends object, R>(target: T | Reactor<T> | Reactive<T>, sel: (state: DeepReadonly<T>) => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions, build?: ReactorBuild<T>): R;
107
107
 
108
108
  /**
109
109
  * Subscribes to a single path in Reactor state.
@@ -132,7 +132,7 @@ declare function usePath<T extends object, P extends WildPaths<T>>(target: T | R
132
132
  declare const useISOLayoutEffect: typeof useLayoutEffect;
133
133
 
134
134
  /** React props for controlling the vanilla TimeTravel overlay. */
135
- interface TimeTravelOverlayProps extends Partial<TimeTravelConfig> {
135
+ interface TimeTravelOverlayProps extends Partial<TimeTravelOverlayConfig> {
136
136
  /** Module instance controlled by this overlay bridge. */
137
137
  time: TimeTravelModule;
138
138
  }
@@ -1,7 +1,7 @@
1
- import { E as EffectOptions, R as Reactor, d as Reactive, u as ReactorBuild, W as WildPaths, v as PathValue } from '../index-m0aAWxhX.js';
1
+ import { E as EffectOptions, R as Reactor, d as Reactive, v as ReactorBuild, D as DeepReadonly, W as WildPaths, e as PathValue } from '../index-CB-IiZIB.js';
2
2
  import { useLayoutEffect } from 'react';
3
- import { m as TimeTravelModule } from '../timeTravel-DExvNb04.js';
4
- import { T as TimeTravelConfig } from '../TimeTravelOverlay-Dglcwpg-.js';
3
+ import { m as TimeTravelModule } from '../timeTravel-D7NiYqdD.js';
4
+ import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-CvTDJWpP.js';
5
5
 
6
6
  /**
7
7
  * Subscribes a component to desired Reactor state and returns it.
@@ -30,7 +30,7 @@ declare function useReactor<T extends object>(target: T | Reactor<T> | Reactive<
30
30
  */
31
31
  declare function useAnyReactor(options?: EffectOptions): void;
32
32
  /**
33
- * Subscribes a component to Reactor state and returns a tracked snapshot.
33
+ * Subscribes a component to Reactor state and returns a readonly tracked snapshot.
34
34
  * Rule of thumb: read from snapshots, mutate the source.
35
35
  * The hook uses access tracking so re-renders occur only when accessed fields change.
36
36
  * @typeParam T Root state object type.
@@ -47,7 +47,7 @@ declare function useAnyReactor(options?: EffectOptions): void;
47
47
  * const rtr = new Reactor({ user: { name: "Kosi" } });
48
48
  * const c = useReactorSnapshot(rtr);
49
49
  */
50
- declare function useReactorSnapshot<T extends object>(target: T | Reactor<T> | Reactive<T>, options?: EffectOptions, build?: ReactorBuild<T>): T;
50
+ declare function useReactorSnapshot<T extends object>(target: T | Reactor<T> | Reactive<T>, options?: EffectOptions, build?: ReactorBuild<T>): DeepReadonly<T>;
51
51
 
52
52
  /**
53
53
  * Subscribes to a derived slice of Reactor state.
@@ -84,7 +84,7 @@ declare function useSelector<T extends object, R>(target: T | Reactor<T> | React
84
84
  declare function useAnySelector<R>(sel: () => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions): R;
85
85
  /**
86
86
  * Subscribes to a derived slice of Reactor state.
87
- * The selector runs against a tracked snapshot and uses the provided equality function
87
+ * The selector runs against a readonly tracked snapshot and uses the provided equality function
88
88
  * to suppress unchanged results.
89
89
  * @typeParam T Root state object type.
90
90
  * @typeParam R Selector return type.
@@ -103,7 +103,7 @@ declare function useAnySelector<R>(sel: () => R, eq?: (value1: any, value2: any)
103
103
  * const rtr = new Reactor({ user: { name: "Kosi" } });
104
104
  * const c = useSelectorSnapshot(rtr, (s) => s.user.name);
105
105
  */
106
- declare function useSelectorSnapshot<T extends object, R>(target: T | Reactor<T> | Reactive<T>, sel: (state: T) => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions, build?: ReactorBuild<T>): R;
106
+ declare function useSelectorSnapshot<T extends object, R>(target: T | Reactor<T> | Reactive<T>, sel: (state: DeepReadonly<T>) => R, eq?: (value1: any, value2: any) => boolean, options?: EffectOptions, build?: ReactorBuild<T>): R;
107
107
 
108
108
  /**
109
109
  * Subscribes to a single path in Reactor state.
@@ -132,7 +132,7 @@ declare function usePath<T extends object, P extends WildPaths<T>>(target: T | R
132
132
  declare const useISOLayoutEffect: typeof useLayoutEffect;
133
133
 
134
134
  /** React props for controlling the vanilla TimeTravel overlay. */
135
- interface TimeTravelOverlayProps extends Partial<TimeTravelConfig> {
135
+ interface TimeTravelOverlayProps extends Partial<TimeTravelOverlayConfig> {
136
136
  /** Module instance controlled by this overlay bridge. */
137
137
  time: TimeTravelModule;
138
138
  }
@@ -2,10 +2,10 @@ import {
2
2
  Autotracker,
3
3
  TimeTravelOverlay,
4
4
  withTracker
5
- } from "../chunk-5JNWC7Z4.js";
5
+ } from "../chunk-MWC3R7QL.js";
6
6
  import {
7
7
  getReactor
8
- } from "../chunk-MSTHQVNK.js";
8
+ } from "../chunk-3UHI7CNE.js";
9
9
  import "../chunk-5A44QFT6.js";
10
10
  import "../chunk-P37ADJMM.js";
11
11
  import {
@@ -13,7 +13,7 @@ import {
13
13
  NIL,
14
14
  NOOP,
15
15
  getAny
16
- } from "../chunk-MKL3JUPO.js";
16
+ } from "../chunk-EZ4VRGYI.js";
17
17
 
18
18
  // src/ts/adapters/react/hooks/useReactor.ts
19
19
  import { useRef, useCallback, useSyncExternalStore, useMemo } from "react";