sia-reactor 0.0.10 → 0.0.12

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.
@@ -138,7 +138,7 @@ var Reactor = class {
138
138
  this.isTracing = this.isTracking && !!options.lineageTracing;
139
139
  }
140
140
  proxied(obj, rejectable = false, indiffable = false, parent, key, path) {
141
- if (!obj || "object" === typeof obj) return obj;
141
+ if (!obj || "object" !== typeof obj) return obj;
142
142
  if (!(isStrictObj(obj, this.config.crossRealms, false) || Array.isArray(obj)) || obj[INERTIA]) return obj;
143
143
  obj = obj[RAW] || obj;
144
144
  if (this.isTracking && parent && key) this.link(obj, parent, key, false);
@@ -368,11 +368,11 @@ interface ReactorOptions<T extends object, P extends Paths<T> = Paths<T>> {
368
368
  equalityFunction?: (a: any, b: any) => boolean; // used in setters and for adapters custom control, e.g: `Object.is` {default}
369
369
  batchingFunction?: (cb: () => void) => void; // custom set for listener's notifications, e.g: `queueMicrotask` {default}, `unstable_batchedUpdates` from ReactDOM
370
370
  referenceTracking?: boolean; // 1-time set to activate
371
- } // debating making use of the Reflect API opt-in
371
+ } // debating keeping use of the Reflect API opt-in
372
372
 
373
373
  declare function isDef(val: any): boolean;
374
- declare function isObj<T = object>(obj: any, checkArr?: boolean): obj is T;
375
- declare function isStrictObj<T = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
374
+ declare function isObj<T extends object = object>(obj: any, checkArr?: boolean): obj is T;
375
+ declare function isStrictObj<T extends object = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
376
376
  declare function setAny<T extends object, const S extends string = ".">(target: T, key: Paths<T, S>, value: PathValue<T, typeof key, S>, separator?: S, keyFunc?: (p: string) => string): void;
377
377
  declare function getAny<T extends object, const S extends string = ".">(source: T, key: Paths<T, S>, separator?: S, keyFunc?: (p: string) => string): PathValue<T, typeof key, S> | undefined;
378
378
  declare function deleteAny<T extends object, const S extends string = ".">(target: T, key: Paths<T, S>, separator?: S, keyFunc?: (p: string) => string): void;
@@ -368,11 +368,11 @@ interface ReactorOptions<T extends object, P extends Paths<T> = Paths<T>> {
368
368
  equalityFunction?: (a: any, b: any) => boolean; // used in setters and for adapters custom control, e.g: `Object.is` {default}
369
369
  batchingFunction?: (cb: () => void) => void; // custom set for listener's notifications, e.g: `queueMicrotask` {default}, `unstable_batchedUpdates` from ReactDOM
370
370
  referenceTracking?: boolean; // 1-time set to activate
371
- } // debating making use of the Reflect API opt-in
371
+ } // debating keeping use of the Reflect API opt-in
372
372
 
373
373
  declare function isDef(val: any): boolean;
374
- declare function isObj<T = object>(obj: any, checkArr?: boolean): obj is T;
375
- declare function isStrictObj<T = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
374
+ declare function isObj<T extends object = object>(obj: any, checkArr?: boolean): obj is T;
375
+ declare function isStrictObj<T extends object = object>(obj: any, crossRealms?: boolean, typecheck?: boolean): obj is T;
376
376
  declare function setAny<T extends object, const S extends string = ".">(target: T, key: Paths<T, S>, value: PathValue<T, typeof key, S>, separator?: S, keyFunc?: (p: string) => string): void;
377
377
  declare function getAny<T extends object, const S extends string = ".">(source: T, key: Paths<T, S>, separator?: S, keyFunc?: (p: string) => string): PathValue<T, typeof key, S> | undefined;
378
378
  declare function deleteAny<T extends object, const S extends string = ".">(target: T, key: Paths<T, S>, separator?: S, keyFunc?: (p: string) => string): void;
package/dist/index.cjs CHANGED
@@ -277,7 +277,7 @@ var Reactor = class {
277
277
  this.isTracing = this.isTracking && !!options.lineageTracing;
278
278
  }
279
279
  proxied(obj, rejectable = false, indiffable = false, parent, key, path) {
280
- if (!obj || "object" === typeof obj) return obj;
280
+ if (!obj || "object" !== typeof obj) return obj;
281
281
  if (!(isStrictObj(obj, this.config.crossRealms, false) || Array.isArray(obj)) || obj[INERTIA]) return obj;
282
282
  obj = obj[RAW] || obj;
283
283
  if (this.isTracking && parent && key) this.link(obj, parent, key, false);
package/dist/index.d.cts CHANGED
@@ -1 +1 @@
1
- export { C as ChildPaths, D as DeepKeys, l as DeepMerge, o as DeepPartial, q as DeepRequired, r as Deleter, t as DeleterRecord, u as DirectPayload, G as Getter, v as GetterRecord, I as Inert, w as Intent, L as Listener, x as ListenerOptions, y as ListenerOptionsTuple, z as ListenerRecord, A as Live, P as PathBranch, B as PathBranchValue, E as PathKey, F as PathLeaf, H as PathValue, J as Paths, K as Payload, M as REvent, a as Reactive, N as ReactivePrefs, R as Reactor, O as ReactorEvent, Q as ReactorOptions, S as Setter, T as SetterRecord, U as Stable, V as State, W as StrictPathKey, X as SyncOptions, Y as SyncOptionsTuple, Z as TERMINATOR, _ as Target, $ as Unflatten, a0 as UnionToIntersection, a1 as UpdatePayload, a2 as Volatile, a3 as Watcher, a4 as WatcherRecord, a5 as WildPaths, a6 as getSnapshotVersion, a7 as getVersion, a8 as inert, a9 as intent, aa as isInert, ab as isIntent, ac as isVolatile, ad as live, ae as methods, af as reactive, ag as stable, ah as state, ai as volatile } from './index-DUqRClya.cjs';
1
+ export { C as ChildPaths, D as DeepKeys, l as DeepMerge, o as DeepPartial, q as DeepRequired, r as Deleter, t as DeleterRecord, u as DirectPayload, G as Getter, v as GetterRecord, I as Inert, w as Intent, L as Listener, x as ListenerOptions, y as ListenerOptionsTuple, z as ListenerRecord, A as Live, P as PathBranch, B as PathBranchValue, E as PathKey, F as PathLeaf, H as PathValue, J as Paths, K as Payload, M as REvent, a as Reactive, N as ReactivePrefs, R as Reactor, O as ReactorEvent, Q as ReactorOptions, S as Setter, T as SetterRecord, U as Stable, V as State, W as StrictPathKey, X as SyncOptions, Y as SyncOptionsTuple, Z as TERMINATOR, _ as Target, $ as Unflatten, a0 as UnionToIntersection, a1 as UpdatePayload, a2 as Volatile, a3 as Watcher, a4 as WatcherRecord, a5 as WildPaths, a6 as getSnapshotVersion, a7 as getVersion, a8 as inert, a9 as intent, aa as isInert, ab as isIntent, ac as isVolatile, ad as live, ae as methods, af as reactive, ag as stable, ah as state, ai as volatile } from './index-Bmuqp8Xy.cjs';
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { C as ChildPaths, D as DeepKeys, l as DeepMerge, o as DeepPartial, q as DeepRequired, r as Deleter, t as DeleterRecord, u as DirectPayload, G as Getter, v as GetterRecord, I as Inert, w as Intent, L as Listener, x as ListenerOptions, y as ListenerOptionsTuple, z as ListenerRecord, A as Live, P as PathBranch, B as PathBranchValue, E as PathKey, F as PathLeaf, H as PathValue, J as Paths, K as Payload, M as REvent, a as Reactive, N as ReactivePrefs, R as Reactor, O as ReactorEvent, Q as ReactorOptions, S as Setter, T as SetterRecord, U as Stable, V as State, W as StrictPathKey, X as SyncOptions, Y as SyncOptionsTuple, Z as TERMINATOR, _ as Target, $ as Unflatten, a0 as UnionToIntersection, a1 as UpdatePayload, a2 as Volatile, a3 as Watcher, a4 as WatcherRecord, a5 as WildPaths, a6 as getSnapshotVersion, a7 as getVersion, a8 as inert, a9 as intent, aa as isInert, ab as isIntent, ac as isVolatile, ad as live, ae as methods, af as reactive, ag as stable, ah as state, ai as volatile } from './index-DUqRClya.js';
1
+ export { C as ChildPaths, D as DeepKeys, l as DeepMerge, o as DeepPartial, q as DeepRequired, r as Deleter, t as DeleterRecord, u as DirectPayload, G as Getter, v as GetterRecord, I as Inert, w as Intent, L as Listener, x as ListenerOptions, y as ListenerOptionsTuple, z as ListenerRecord, A as Live, P as PathBranch, B as PathBranchValue, E as PathKey, F as PathLeaf, H as PathValue, J as Paths, K as Payload, M as REvent, a as Reactive, N as ReactivePrefs, R as Reactor, O as ReactorEvent, Q as ReactorOptions, S as Setter, T as SetterRecord, U as Stable, V as State, W as StrictPathKey, X as SyncOptions, Y as SyncOptionsTuple, Z as TERMINATOR, _ as Target, $ as Unflatten, a0 as UnionToIntersection, a1 as UpdatePayload, a2 as Volatile, a3 as Watcher, a4 as WatcherRecord, a5 as WildPaths, a6 as getSnapshotVersion, a7 as getVersion, a8 as inert, a9 as intent, aa as isInert, ab as isIntent, ac as isVolatile, ad as live, ae as methods, af as reactive, ag as stable, ah as state, ai as volatile } from './index-Bmuqp8Xy.js';
@@ -277,7 +277,7 @@ var sia = (() => {
277
277
  this.isTracing = this.isTracking && !!options.lineageTracing;
278
278
  }
279
279
  proxied(obj, rejectable = false, indiffable = false, parent, key, path) {
280
- if (!obj || "object" === typeof obj) return obj;
280
+ if (!obj || "object" !== typeof obj) return obj;
281
281
  if (!(isStrictObj(obj, this.config.crossRealms, false) || Array.isArray(obj)) || obj[INERTIA]) return obj;
282
282
  obj = obj[RAW] || obj;
283
283
  if (this.isTracking && parent && key) this.link(obj, parent, key, false);
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  stable,
16
16
  state,
17
17
  volatile
18
- } from "./chunk-KLH6P5BH.js";
18
+ } from "./chunk-KFPA5OPK.js";
19
19
  import "./chunk-DW7Z7YEA.js";
20
20
  export {
21
21
  Reactor,
package/dist/react.cjs CHANGED
@@ -266,7 +266,7 @@ var Reactor = class {
266
266
  this.isTracing = this.isTracking && !!options.lineageTracing;
267
267
  }
268
268
  proxied(obj, rejectable = false, indiffable = false, parent, key, path) {
269
- if (!obj || "object" === typeof obj) return obj;
269
+ if (!obj || "object" !== typeof obj) return obj;
270
270
  if (!(isStrictObj(obj, this.config.crossRealms, false) || Array.isArray(obj)) || obj[INERTIA]) return obj;
271
271
  obj = obj[RAW] || obj;
272
272
  if (this.isTracking && parent && key) this.link(obj, parent, key, false);
@@ -629,7 +629,7 @@ var Reactor = class {
629
629
  };
630
630
 
631
631
  // src/adapters/react/valtio.ts
632
- var useISOLayoutEffect = isDef(window) ? import_react.useLayoutEffect : import_react.useCallback;
632
+ var useISOLayoutEffect = isDef(window) ? import_react.useLayoutEffect : import_react.useEffect;
633
633
  function useReactor(target, prefs = NIL) {
634
634
  const rtrRef = (0, import_react.useRef)(), rtr = rtrRef.current ||= target instanceof Reactor ? target : target.__Reactor__ || new Reactor(target, { lineageTracing: true, smartCloning: true }), cache = (0, import_react.useRef)(/* @__PURE__ */ new WeakMap()), paths = (0, import_react.useRef)(/* @__PURE__ */ new Set()), clups = (0, import_react.useRef)([]), notifyRef = (0, import_react.useRef)(NOOP);
635
635
  const track = (path, ps = paths.current) => {
@@ -652,7 +652,7 @@ function useReactor(target, prefs = NIL) {
652
652
  clups.current.length = 0;
653
653
  if (!paths.current.size || paths.current.has("")) clups.current.push(rtr[prefs.sync ? "watch" : "on"]("*", notifyRef.current));
654
654
  else for (const p of paths.current) clups.current.push(rtr[prefs.sync ? "watch" : "on"](p, notifyRef.current));
655
- }, []);
655
+ });
656
656
  return (0, import_react.useMemo)(() => {
657
657
  paths.current.clear();
658
658
  const wrap = (obj, path = "") => {
package/dist/react.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as Reactor, a as Reactive } from './index-DUqRClya.cjs';
1
+ import { R as Reactor, a as Reactive } from './index-Bmuqp8Xy.cjs';
2
2
 
3
3
  declare function useReactor<T extends object>(target: T | Reactor<T> | Reactive<T>, prefs?: {
4
4
  sync: boolean;
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as Reactor, a as Reactive } from './index-DUqRClya.js';
1
+ import { R as Reactor, a as Reactive } from './index-Bmuqp8Xy.js';
2
2
 
3
3
  declare function useReactor<T extends object>(target: T | Reactor<T> | Reactive<T>, prefs?: {
4
4
  sync: boolean;
@@ -1375,7 +1375,7 @@ var sia = (() => {
1375
1375
  var dispatcher = resolveDispatcher();
1376
1376
  return dispatcher.useRef(initialValue);
1377
1377
  }
1378
- function useEffect(create, deps) {
1378
+ function useEffect2(create, deps) {
1379
1379
  var dispatcher = resolveDispatcher();
1380
1380
  return dispatcher.useEffect(create, deps);
1381
1381
  }
@@ -2158,7 +2158,7 @@ var sia = (() => {
2158
2158
  exports.useContext = useContext;
2159
2159
  exports.useDebugValue = useDebugValue;
2160
2160
  exports.useDeferredValue = useDeferredValue;
2161
- exports.useEffect = useEffect;
2161
+ exports.useEffect = useEffect2;
2162
2162
  exports.useId = useId;
2163
2163
  exports.useImperativeHandle = useImperativeHandle;
2164
2164
  exports.useInsertionEffect = useInsertionEffect;
@@ -2438,7 +2438,7 @@ var sia = (() => {
2438
2438
  this.isTracing = this.isTracking && !!options.lineageTracing;
2439
2439
  }
2440
2440
  proxied(obj, rejectable = false, indiffable = false, parent, key, path) {
2441
- if (!obj || "object" === typeof obj) return obj;
2441
+ if (!obj || "object" !== typeof obj) return obj;
2442
2442
  if (!(isStrictObj(obj, this.config.crossRealms, false) || Array.isArray(obj)) || obj[INERTIA]) return obj;
2443
2443
  obj = obj[RAW] || obj;
2444
2444
  if (this.isTracking && parent && key) this.link(obj, parent, key, false);
@@ -2801,7 +2801,7 @@ var sia = (() => {
2801
2801
  };
2802
2802
 
2803
2803
  // src/adapters/react/valtio.ts
2804
- var useISOLayoutEffect = isDef(window) ? import_react.useLayoutEffect : import_react.useCallback;
2804
+ var useISOLayoutEffect = isDef(window) ? import_react.useLayoutEffect : import_react.useEffect;
2805
2805
  function useReactor(target, prefs = NIL) {
2806
2806
  const rtrRef = (0, import_react.useRef)(), rtr = rtrRef.current ||= target instanceof Reactor ? target : target.__Reactor__ || new Reactor(target, { lineageTracing: true, smartCloning: true }), cache = (0, import_react.useRef)(/* @__PURE__ */ new WeakMap()), paths = (0, import_react.useRef)(/* @__PURE__ */ new Set()), clups = (0, import_react.useRef)([]), notifyRef = (0, import_react.useRef)(NOOP);
2807
2807
  const track = (path, ps = paths.current) => {
@@ -2824,7 +2824,7 @@ var sia = (() => {
2824
2824
  clups.current.length = 0;
2825
2825
  if (!paths.current.size || paths.current.has("")) clups.current.push(rtr[prefs.sync ? "watch" : "on"]("*", notifyRef.current));
2826
2826
  else for (const p of paths.current) clups.current.push(rtr[prefs.sync ? "watch" : "on"](p, notifyRef.current));
2827
- }, []);
2827
+ });
2828
2828
  return (0, import_react.useMemo)(() => {
2829
2829
  paths.current.clear();
2830
2830
  const wrap = (obj, path = "") => {
package/dist/react.js CHANGED
@@ -2,15 +2,15 @@ import {
2
2
  NIL,
3
3
  NOOP,
4
4
  Reactor
5
- } from "./chunk-KLH6P5BH.js";
5
+ } from "./chunk-KFPA5OPK.js";
6
6
  import {
7
7
  isDef,
8
8
  isStrictObj
9
9
  } from "./chunk-DW7Z7YEA.js";
10
10
 
11
11
  // src/adapters/react/valtio.ts
12
- import { useSyncExternalStore, useRef, useMemo, useCallback, useLayoutEffect } from "react";
13
- var useISOLayoutEffect = isDef(window) ? useLayoutEffect : useCallback;
12
+ import { useSyncExternalStore, useRef, useMemo, useCallback, useLayoutEffect, useEffect } from "react";
13
+ var useISOLayoutEffect = isDef(window) ? useLayoutEffect : useEffect;
14
14
  function useReactor(target, prefs = NIL) {
15
15
  const rtrRef = useRef(), rtr = rtrRef.current ||= target instanceof Reactor ? target : target.__Reactor__ || new Reactor(target, { lineageTracing: true, smartCloning: true }), cache = useRef(/* @__PURE__ */ new WeakMap()), paths = useRef(/* @__PURE__ */ new Set()), clups = useRef([]), notifyRef = useRef(NOOP);
16
16
  const track = (path, ps = paths.current) => {
@@ -33,7 +33,7 @@ function useReactor(target, prefs = NIL) {
33
33
  clups.current.length = 0;
34
34
  if (!paths.current.size || paths.current.has("")) clups.current.push(rtr[prefs.sync ? "watch" : "on"]("*", notifyRef.current));
35
35
  else for (const p of paths.current) clups.current.push(rtr[prefs.sync ? "watch" : "on"](p, notifyRef.current));
36
- }, []);
36
+ });
37
37
  return useMemo(() => {
38
38
  paths.current.clear();
39
39
  const wrap = (obj, path = "") => {
package/dist/utils.d.cts CHANGED
@@ -1 +1 @@
1
- export { d as deepClone, b as deleteAny, g as getAny, c as getTrailPaths, e as getTrailRecords, i as inAny, f as isDef, h as isObj, j as isStrictObj, m as mergeObjs, n as nuke, p as parseAnyObj, k as parseEvtOpts, s as setAny } from './index-DUqRClya.cjs';
1
+ export { d as deepClone, b as deleteAny, g as getAny, c as getTrailPaths, e as getTrailRecords, i as inAny, f as isDef, h as isObj, j as isStrictObj, m as mergeObjs, n as nuke, p as parseAnyObj, k as parseEvtOpts, s as setAny } from './index-Bmuqp8Xy.cjs';
package/dist/utils.d.ts CHANGED
@@ -1 +1 @@
1
- export { d as deepClone, b as deleteAny, g as getAny, c as getTrailPaths, e as getTrailRecords, i as inAny, f as isDef, h as isObj, j as isStrictObj, m as mergeObjs, n as nuke, p as parseAnyObj, k as parseEvtOpts, s as setAny } from './index-DUqRClya.js';
1
+ export { d as deepClone, b as deleteAny, g as getAny, c as getTrailPaths, e as getTrailRecords, i as inAny, f as isDef, h as isObj, j as isStrictObj, m as mergeObjs, n as nuke, p as parseAnyObj, k as parseEvtOpts, s as setAny } from './index-Bmuqp8Xy.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sia-reactor",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "The Programmable Data DOM. A high-performance State Intent Architecture (S.I.A.) Engine with zero-allocation loops, event propagation, and structural sharing.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",