sia-reactor 0.0.30 → 0.0.31
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/dist/{TimeTravelOverlay-DBMDUAK7.d.cts → TimeTravelOverlay-BlVhj8n1.d.cts} +2 -2
- package/dist/{TimeTravelOverlay-BzMn-xDV.d.ts → TimeTravelOverlay-D8jAd_Fz.d.ts} +2 -2
- package/dist/adapters/react.cjs +14 -17
- package/dist/adapters/react.d.cts +3 -3
- package/dist/adapters/react.d.ts +3 -3
- package/dist/adapters/react.js +3 -3
- package/dist/adapters/vanilla.cjs +14 -17
- package/dist/adapters/vanilla.d.cts +4 -4
- package/dist/adapters/vanilla.d.ts +4 -4
- package/dist/adapters/vanilla.js +3 -3
- package/dist/{chunk-2EIKOZAD.js → chunk-AKQSBLBX.js} +12 -12
- package/dist/{chunk-NG3WWQV4.js → chunk-GD7HZBXA.js} +1 -1
- package/dist/{chunk-3LIKXZ7X.js → chunk-UYRDN3OX.js} +4 -7
- package/dist/{index-BLpfq517.d.cts → index-CWbDYjby.d.cts} +18 -11
- package/dist/{index-BLpfq517.d.ts → index-CWbDYjby.d.ts} +18 -11
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/modules.cjs +14 -13
- package/dist/modules.d.cts +4 -4
- package/dist/modules.d.ts +4 -4
- package/dist/modules.js +4 -3
- package/dist/super.d.ts +18 -11
- package/dist/super.global.js +16 -18
- package/dist/{timeTravel-L32xiEw-.d.ts → timeTravel-BsVQ5z7v.d.ts} +1 -1
- package/dist/{timeTravel-W41Kk9SQ.d.cts → timeTravel-DoWtLH_e.d.cts} +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as Reactive } from './index-
|
|
2
|
-
import { m as TimeTravelModule } from './timeTravel-
|
|
1
|
+
import { e as Reactive } from './index-CWbDYjby.cjs';
|
|
2
|
+
import { m as TimeTravelModule } from './timeTravel-DoWtLH_e.cjs';
|
|
3
3
|
|
|
4
4
|
/** Reactive options for the TimeTravel overlay instance. */
|
|
5
5
|
interface TimeTravelOverlayConfig {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as Reactive } from './index-
|
|
2
|
-
import { m as TimeTravelModule } from './timeTravel-
|
|
1
|
+
import { e as Reactive } from './index-CWbDYjby.js';
|
|
2
|
+
import { m as TimeTravelModule } from './timeTravel-BsVQ5z7v.js';
|
|
3
3
|
|
|
4
4
|
/** Reactive options for the TimeTravel overlay instance. */
|
|
5
5
|
interface TimeTravelOverlayConfig {
|
package/dist/adapters/react.cjs
CHANGED
|
@@ -280,8 +280,8 @@ var ReactorEvent = class _ReactorEvent {
|
|
|
280
280
|
/**
|
|
281
281
|
* Marks a rejectable event as rejected.
|
|
282
282
|
* @param reason Optional rejection reason or identity.
|
|
283
|
-
* @example e.
|
|
284
|
-
* @example e.
|
|
283
|
+
* @example e.reject("html5Tech"); // identity
|
|
284
|
+
* @example e.reject("User is not logged in"); // reason
|
|
285
285
|
*/
|
|
286
286
|
reject(reason) {
|
|
287
287
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -652,7 +652,7 @@ var Reactor = class {
|
|
|
652
652
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
653
653
|
return clone;
|
|
654
654
|
}
|
|
655
|
-
|
|
655
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
656
656
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
657
657
|
let cords = store.get(path), cord;
|
|
658
658
|
if (cords)
|
|
@@ -671,7 +671,7 @@ var Reactor = class {
|
|
|
671
671
|
lazy ? this.stall(task) : task();
|
|
672
672
|
return this.bindSignal(cord, signal);
|
|
673
673
|
}
|
|
674
|
-
|
|
674
|
+
dropSync(store, path, cb) {
|
|
675
675
|
const cords = store?.get(path);
|
|
676
676
|
if (!cords) return void 0;
|
|
677
677
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -690,7 +690,7 @@ var Reactor = class {
|
|
|
690
690
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
691
691
|
*/
|
|
692
692
|
get(path, callback, options) {
|
|
693
|
-
return this.
|
|
693
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
694
694
|
}
|
|
695
695
|
/** Registers a get mediator for a path that only triggers once. */
|
|
696
696
|
gonce(path, callback, options) {
|
|
@@ -703,7 +703,7 @@ var Reactor = class {
|
|
|
703
703
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
704
704
|
*/
|
|
705
705
|
noget(path, callback) {
|
|
706
|
-
return this.
|
|
706
|
+
return this.dropSync(this.getters, path, callback);
|
|
707
707
|
}
|
|
708
708
|
/**
|
|
709
709
|
* Registers a set mediator for a path.
|
|
@@ -715,7 +715,7 @@ var Reactor = class {
|
|
|
715
715
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
716
716
|
*/
|
|
717
717
|
set(path, callback, options) {
|
|
718
|
-
return this.
|
|
718
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
719
719
|
}
|
|
720
720
|
/** Registers a set mediator for a path that only triggers once. */
|
|
721
721
|
sonce(path, callback, options) {
|
|
@@ -728,7 +728,7 @@ var Reactor = class {
|
|
|
728
728
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
729
729
|
*/
|
|
730
730
|
noset(path, callback) {
|
|
731
|
-
return this.
|
|
731
|
+
return this.dropSync(this.setters, path, callback);
|
|
732
732
|
}
|
|
733
733
|
/**
|
|
734
734
|
* Registers a delete mediator for a path.
|
|
@@ -740,7 +740,7 @@ var Reactor = class {
|
|
|
740
740
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
741
741
|
*/
|
|
742
742
|
delete(path, callback, options) {
|
|
743
|
-
return this.
|
|
743
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
744
744
|
}
|
|
745
745
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
746
746
|
donce(path, callback, options) {
|
|
@@ -753,7 +753,7 @@ var Reactor = class {
|
|
|
753
753
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
754
754
|
*/
|
|
755
755
|
nodelete(path, callback) {
|
|
756
|
-
return this.
|
|
756
|
+
return this.dropSync(this.deleters, path, callback);
|
|
757
757
|
}
|
|
758
758
|
/**
|
|
759
759
|
* Registers a watcher for a path.
|
|
@@ -766,7 +766,7 @@ var Reactor = class {
|
|
|
766
766
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
767
767
|
*/
|
|
768
768
|
watch(path, callback, options) {
|
|
769
|
-
return this.
|
|
769
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
770
770
|
}
|
|
771
771
|
/** Registers a watcher for a path that only triggers once. */
|
|
772
772
|
wonce(path, callback, options) {
|
|
@@ -779,7 +779,7 @@ var Reactor = class {
|
|
|
779
779
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
780
780
|
*/
|
|
781
781
|
nowatch(path, callback) {
|
|
782
|
-
return this.
|
|
782
|
+
return this.dropSync(this.watchers, path, callback);
|
|
783
783
|
}
|
|
784
784
|
/**
|
|
785
785
|
* Registers an event listener for a path.
|
|
@@ -1268,15 +1268,12 @@ var TimeTravelOverlay = class _TimeTravelOverlay {
|
|
|
1268
1268
|
nuke(this), --_TimeTravelOverlay.count;
|
|
1269
1269
|
}
|
|
1270
1270
|
};
|
|
1271
|
-
function getDirChild(parent, className) {
|
|
1272
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
1273
|
-
}
|
|
1274
1271
|
function getDock(container) {
|
|
1275
1272
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
1276
1273
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
1277
|
-
const layer =
|
|
1274
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
1278
1275
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
1279
|
-
const dock =
|
|
1276
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
1280
1277
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
1281
1278
|
}
|
|
1282
1279
|
function formatPaths(paths, emptyText) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EffectOptions, a as Reactor, e as Reactive, x as ReactorBuild, D as DeepReadonly, W as WildPaths, f as PathValue } from '../index-
|
|
1
|
+
import { E as EffectOptions, a as Reactor, e as Reactive, x as ReactorBuild, D as DeepReadonly, W as WildPaths, f as PathValue } from '../index-CWbDYjby.cjs';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { m as TimeTravelModule } from '../timeTravel-
|
|
4
|
-
import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-
|
|
3
|
+
import { m as TimeTravelModule } from '../timeTravel-DoWtLH_e.cjs';
|
|
4
|
+
import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-BlVhj8n1.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Subscribes a component to desired Reactor state and returns it.
|
package/dist/adapters/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EffectOptions, a as Reactor, e as Reactive, x as ReactorBuild, D as DeepReadonly, W as WildPaths, f as PathValue } from '../index-
|
|
1
|
+
import { E as EffectOptions, a as Reactor, e as Reactive, x as ReactorBuild, D as DeepReadonly, W as WildPaths, f as PathValue } from '../index-CWbDYjby.js';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { m as TimeTravelModule } from '../timeTravel-
|
|
4
|
-
import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-
|
|
3
|
+
import { m as TimeTravelModule } from '../timeTravel-BsVQ5z7v.js';
|
|
4
|
+
import { a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-D8jAd_Fz.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Subscribes a component to desired Reactor state and returns it.
|
package/dist/adapters/react.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
Autotracker,
|
|
3
3
|
TimeTravelOverlay,
|
|
4
4
|
withTracker
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-UYRDN3OX.js";
|
|
6
6
|
import "../chunk-PLYS4CVP.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-GD7HZBXA.js";
|
|
8
8
|
import {
|
|
9
9
|
getReactor
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-AKQSBLBX.js";
|
|
11
11
|
import "../chunk-RVYL3OLW.js";
|
|
12
12
|
import "../chunk-3OT72G7R.js";
|
|
13
13
|
import {
|
|
@@ -268,8 +268,8 @@ var ReactorEvent = class _ReactorEvent {
|
|
|
268
268
|
/**
|
|
269
269
|
* Marks a rejectable event as rejected.
|
|
270
270
|
* @param reason Optional rejection reason or identity.
|
|
271
|
-
* @example e.
|
|
272
|
-
* @example e.
|
|
271
|
+
* @example e.reject("html5Tech"); // identity
|
|
272
|
+
* @example e.reject("User is not logged in"); // reason
|
|
273
273
|
*/
|
|
274
274
|
reject(reason) {
|
|
275
275
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -640,7 +640,7 @@ var Reactor = class {
|
|
|
640
640
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
641
641
|
return clone;
|
|
642
642
|
}
|
|
643
|
-
|
|
643
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
644
644
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
645
645
|
let cords = store.get(path), cord;
|
|
646
646
|
if (cords)
|
|
@@ -659,7 +659,7 @@ var Reactor = class {
|
|
|
659
659
|
lazy ? this.stall(task) : task();
|
|
660
660
|
return this.bindSignal(cord, signal);
|
|
661
661
|
}
|
|
662
|
-
|
|
662
|
+
dropSync(store, path, cb) {
|
|
663
663
|
const cords = store?.get(path);
|
|
664
664
|
if (!cords) return void 0;
|
|
665
665
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -678,7 +678,7 @@ var Reactor = class {
|
|
|
678
678
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
679
679
|
*/
|
|
680
680
|
get(path, callback, options) {
|
|
681
|
-
return this.
|
|
681
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
682
682
|
}
|
|
683
683
|
/** Registers a get mediator for a path that only triggers once. */
|
|
684
684
|
gonce(path, callback, options) {
|
|
@@ -691,7 +691,7 @@ var Reactor = class {
|
|
|
691
691
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
692
692
|
*/
|
|
693
693
|
noget(path, callback) {
|
|
694
|
-
return this.
|
|
694
|
+
return this.dropSync(this.getters, path, callback);
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
697
697
|
* Registers a set mediator for a path.
|
|
@@ -703,7 +703,7 @@ var Reactor = class {
|
|
|
703
703
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
704
704
|
*/
|
|
705
705
|
set(path, callback, options) {
|
|
706
|
-
return this.
|
|
706
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
707
707
|
}
|
|
708
708
|
/** Registers a set mediator for a path that only triggers once. */
|
|
709
709
|
sonce(path, callback, options) {
|
|
@@ -716,7 +716,7 @@ var Reactor = class {
|
|
|
716
716
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
717
717
|
*/
|
|
718
718
|
noset(path, callback) {
|
|
719
|
-
return this.
|
|
719
|
+
return this.dropSync(this.setters, path, callback);
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
722
722
|
* Registers a delete mediator for a path.
|
|
@@ -728,7 +728,7 @@ var Reactor = class {
|
|
|
728
728
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
729
729
|
*/
|
|
730
730
|
delete(path, callback, options) {
|
|
731
|
-
return this.
|
|
731
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
732
732
|
}
|
|
733
733
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
734
734
|
donce(path, callback, options) {
|
|
@@ -741,7 +741,7 @@ var Reactor = class {
|
|
|
741
741
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
742
742
|
*/
|
|
743
743
|
nodelete(path, callback) {
|
|
744
|
-
return this.
|
|
744
|
+
return this.dropSync(this.deleters, path, callback);
|
|
745
745
|
}
|
|
746
746
|
/**
|
|
747
747
|
* Registers a watcher for a path.
|
|
@@ -754,7 +754,7 @@ var Reactor = class {
|
|
|
754
754
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
755
755
|
*/
|
|
756
756
|
watch(path, callback, options) {
|
|
757
|
-
return this.
|
|
757
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
758
758
|
}
|
|
759
759
|
/** Registers a watcher for a path that only triggers once. */
|
|
760
760
|
wonce(path, callback, options) {
|
|
@@ -767,7 +767,7 @@ var Reactor = class {
|
|
|
767
767
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
768
768
|
*/
|
|
769
769
|
nowatch(path, callback) {
|
|
770
|
-
return this.
|
|
770
|
+
return this.dropSync(this.watchers, path, callback);
|
|
771
771
|
}
|
|
772
772
|
/**
|
|
773
773
|
* Registers an event listener for a path.
|
|
@@ -1175,15 +1175,12 @@ var TimeTravelOverlay = class _TimeTravelOverlay {
|
|
|
1175
1175
|
nuke(this), --_TimeTravelOverlay.count;
|
|
1176
1176
|
}
|
|
1177
1177
|
};
|
|
1178
|
-
function getDirChild(parent, className) {
|
|
1179
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
1180
|
-
}
|
|
1181
1178
|
function getDock(container) {
|
|
1182
1179
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
1183
1180
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
1184
|
-
const layer =
|
|
1181
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
1185
1182
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
1186
|
-
const dock =
|
|
1183
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
1187
1184
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
1188
1185
|
}
|
|
1189
1186
|
function formatPaths(paths, emptyText) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EffectOptions } from '../index-
|
|
2
|
-
export { A as Autotracker, w as withTracker } from '../index-
|
|
3
|
-
export { T as TimeTravelOverlay, a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-
|
|
4
|
-
import '../timeTravel-
|
|
1
|
+
import { E as EffectOptions } from '../index-CWbDYjby.cjs';
|
|
2
|
+
export { A as Autotracker, w as withTracker } from '../index-CWbDYjby.cjs';
|
|
3
|
+
export { T as TimeTravelOverlay, a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-BlVhj8n1.cjs';
|
|
4
|
+
import '../timeTravel-DoWtLH_e.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Runs a reactive side effect in vanilla JavaScript.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EffectOptions } from '../index-
|
|
2
|
-
export { A as Autotracker, w as withTracker } from '../index-
|
|
3
|
-
export { T as TimeTravelOverlay, a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-
|
|
4
|
-
import '../timeTravel-
|
|
1
|
+
import { E as EffectOptions } from '../index-CWbDYjby.js';
|
|
2
|
+
export { A as Autotracker, w as withTracker } from '../index-CWbDYjby.js';
|
|
3
|
+
export { T as TimeTravelOverlay, a as TimeTravelOverlayConfig } from '../TimeTravelOverlay-D8jAd_Fz.js';
|
|
4
|
+
import '../timeTravel-BsVQ5z7v.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Runs a reactive side effect in vanilla JavaScript.
|
package/dist/adapters/vanilla.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
TimeTravelOverlay,
|
|
4
4
|
effect,
|
|
5
5
|
withTracker
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-UYRDN3OX.js";
|
|
7
7
|
import "../chunk-PLYS4CVP.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-GD7HZBXA.js";
|
|
9
|
+
import "../chunk-AKQSBLBX.js";
|
|
10
10
|
import "../chunk-RVYL3OLW.js";
|
|
11
11
|
import "../chunk-3OT72G7R.js";
|
|
12
12
|
import "../chunk-EZ4VRGYI.js";
|
|
@@ -124,8 +124,8 @@ var ReactorEvent = class _ReactorEvent {
|
|
|
124
124
|
/**
|
|
125
125
|
* Marks a rejectable event as rejected.
|
|
126
126
|
* @param reason Optional rejection reason or identity.
|
|
127
|
-
* @example e.
|
|
128
|
-
* @example e.
|
|
127
|
+
* @example e.reject("html5Tech"); // identity
|
|
128
|
+
* @example e.reject("User is not logged in"); // reason
|
|
129
129
|
*/
|
|
130
130
|
reject(reason) {
|
|
131
131
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -496,7 +496,7 @@ var Reactor = class {
|
|
|
496
496
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
497
497
|
return clone;
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
500
500
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
501
501
|
let cords = store.get(path), cord;
|
|
502
502
|
if (cords)
|
|
@@ -515,7 +515,7 @@ var Reactor = class {
|
|
|
515
515
|
lazy ? this.stall(task) : task();
|
|
516
516
|
return this.bindSignal(cord, signal);
|
|
517
517
|
}
|
|
518
|
-
|
|
518
|
+
dropSync(store, path, cb) {
|
|
519
519
|
const cords = store?.get(path);
|
|
520
520
|
if (!cords) return void 0;
|
|
521
521
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -534,7 +534,7 @@ var Reactor = class {
|
|
|
534
534
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
535
535
|
*/
|
|
536
536
|
get(path, callback, options) {
|
|
537
|
-
return this.
|
|
537
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
538
538
|
}
|
|
539
539
|
/** Registers a get mediator for a path that only triggers once. */
|
|
540
540
|
gonce(path, callback, options) {
|
|
@@ -547,7 +547,7 @@ var Reactor = class {
|
|
|
547
547
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
548
548
|
*/
|
|
549
549
|
noget(path, callback) {
|
|
550
|
-
return this.
|
|
550
|
+
return this.dropSync(this.getters, path, callback);
|
|
551
551
|
}
|
|
552
552
|
/**
|
|
553
553
|
* Registers a set mediator for a path.
|
|
@@ -559,7 +559,7 @@ var Reactor = class {
|
|
|
559
559
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
560
560
|
*/
|
|
561
561
|
set(path, callback, options) {
|
|
562
|
-
return this.
|
|
562
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
563
563
|
}
|
|
564
564
|
/** Registers a set mediator for a path that only triggers once. */
|
|
565
565
|
sonce(path, callback, options) {
|
|
@@ -572,7 +572,7 @@ var Reactor = class {
|
|
|
572
572
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
573
573
|
*/
|
|
574
574
|
noset(path, callback) {
|
|
575
|
-
return this.
|
|
575
|
+
return this.dropSync(this.setters, path, callback);
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
578
578
|
* Registers a delete mediator for a path.
|
|
@@ -584,7 +584,7 @@ var Reactor = class {
|
|
|
584
584
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
585
585
|
*/
|
|
586
586
|
delete(path, callback, options) {
|
|
587
|
-
return this.
|
|
587
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
588
588
|
}
|
|
589
589
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
590
590
|
donce(path, callback, options) {
|
|
@@ -597,7 +597,7 @@ var Reactor = class {
|
|
|
597
597
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
598
598
|
*/
|
|
599
599
|
nodelete(path, callback) {
|
|
600
|
-
return this.
|
|
600
|
+
return this.dropSync(this.deleters, path, callback);
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
603
|
* Registers a watcher for a path.
|
|
@@ -610,7 +610,7 @@ var Reactor = class {
|
|
|
610
610
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
611
611
|
*/
|
|
612
612
|
watch(path, callback, options) {
|
|
613
|
-
return this.
|
|
613
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
614
614
|
}
|
|
615
615
|
/** Registers a watcher for a path that only triggers once. */
|
|
616
616
|
wonce(path, callback, options) {
|
|
@@ -623,7 +623,7 @@ var Reactor = class {
|
|
|
623
623
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
624
624
|
*/
|
|
625
625
|
nowatch(path, callback) {
|
|
626
|
-
return this.
|
|
626
|
+
return this.dropSync(this.watchers, path, callback);
|
|
627
627
|
}
|
|
628
628
|
/**
|
|
629
629
|
* Registers an event listener for a path.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
wpArr
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GD7HZBXA.js";
|
|
4
4
|
import {
|
|
5
5
|
reactive
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AKQSBLBX.js";
|
|
7
7
|
import {
|
|
8
8
|
createEl,
|
|
9
9
|
formatKeyForDisplay,
|
|
@@ -228,15 +228,12 @@ var TimeTravelOverlay = class _TimeTravelOverlay {
|
|
|
228
228
|
nuke(this), --_TimeTravelOverlay.count;
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
function getDirChild(parent, className) {
|
|
232
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
233
|
-
}
|
|
234
231
|
function getDock(container) {
|
|
235
232
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
236
233
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
237
|
-
const layer =
|
|
234
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
238
235
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
239
|
-
const dock =
|
|
236
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
240
237
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
241
238
|
}
|
|
242
239
|
function formatPaths(paths, emptyText) {
|
|
@@ -301,8 +301,8 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
301
301
|
/**
|
|
302
302
|
* Marks a rejectable event as rejected.
|
|
303
303
|
* @param reason Optional rejection reason or identity.
|
|
304
|
-
* @example e.
|
|
305
|
-
* @example e.
|
|
304
|
+
* @example e.reject("html5Tech"); // identity
|
|
305
|
+
* @example e.reject("User is not logged in"); // reason
|
|
306
306
|
*/
|
|
307
307
|
reject(reason?: string): void;
|
|
308
308
|
/**
|
|
@@ -312,7 +312,7 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
312
312
|
composedPath(): any[];
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
/** Reactor method names exposed on objects returned by
|
|
315
|
+
/** `Reactor` method names exposed on objects returned by `reactive()`. */
|
|
316
316
|
declare const methods: readonly ["tick", "stall", "nostall", "get", "gonce", "noget", "set", "sonce", "noset", "delete", "donce", "nodelete", "watch", "wonce", "nowatch", "on", "once", "off", "snapshot", "use", "reset", "destroy"];
|
|
317
317
|
type Method = (typeof methods)[number];
|
|
318
318
|
type Prefix<P extends ReactivePreferences | undefined> = P extends {
|
|
@@ -331,17 +331,24 @@ type ReactiveMethodMap<T extends object, P extends ReactivePreferences | undefin
|
|
|
331
331
|
whitelist: readonly Method[];
|
|
332
332
|
} ? (K extends Whitelist<P> ? `${Prefix<P>}${K}${Suffix<P>}` : K) : `${Prefix<P>}${K}${Suffix<P>}`]: Pick<Reactor<T>, Method>[K];
|
|
333
333
|
};
|
|
334
|
+
/** Exposed `Reactor` methods and `__Reactor__` of a `reactive()` object. */
|
|
335
|
+
type APIKey<T extends object = any, P extends ReactivePreferences | undefined = undefined> = keyof ReactiveMethodMap<T, P> | "__Reactor__";
|
|
336
|
+
/** Type representing a `reactive()` object with mapped `Reactor` methods and `__Reactor__`. */
|
|
337
|
+
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
338
|
+
__Reactor__: Reactor<T>;
|
|
339
|
+
};
|
|
340
|
+
/** Object type with only the non-reactor props of a `reactive()` object, representing the runtime enumerable shape. */
|
|
341
|
+
type Pure<T extends object, P extends ReactivePreferences | undefined = undefined> = {
|
|
342
|
+
[K in keyof T as K extends APIKey<T, P> ? never : K]: T[K];
|
|
343
|
+
};
|
|
334
344
|
interface ReactivePreferences {
|
|
335
|
-
/** Prefix applied to exposed
|
|
345
|
+
/** Prefix applied to exposed `Reactor` methods. */
|
|
336
346
|
prefix?: string;
|
|
337
|
-
/** Suffix applied to exposed
|
|
347
|
+
/** Suffix applied to exposed `Reactor` methods. */
|
|
338
348
|
suffix?: string;
|
|
339
349
|
/** Methods that should keep their original names when affixes are used. */
|
|
340
350
|
whitelist?: readonly Method[];
|
|
341
351
|
}
|
|
342
|
-
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
343
|
-
__Reactor__: Reactor<T>;
|
|
344
|
-
};
|
|
345
352
|
/**
|
|
346
353
|
* Attaches `Reactor` APIs to a state object and returns its reactive proxy from the reactor's core.
|
|
347
354
|
* If an existing `reactive()` object is passed, it is re-returned ignoring change in preferences.
|
|
@@ -973,8 +980,8 @@ declare class Reactor<T extends object> {
|
|
|
973
980
|
getContext<P extends WildPaths<T>>(path: P): Target<T, P>;
|
|
974
981
|
protected bindSignal<Cb>(cord: GetterRecord<T> | SetterRecord<T> | DeleterRecord<T> | WatcherRecord<T> | ListenerRecord<T>, sig?: AbortSignal): Cb;
|
|
975
982
|
protected cloned<O>(target: O, raw: boolean, seen?: WeakMap<WeakKey, any>): O;
|
|
976
|
-
protected
|
|
977
|
-
protected
|
|
983
|
+
protected addSync<P extends WildPaths<T>>(key: "get" | "set" | "delete" | "watch", path: P, cb: any, opts: SyncOptions | undefined, onImmediate?: (immediate: boolean | "auto") => void): () => boolean | undefined;
|
|
984
|
+
protected dropSync<P extends WildPaths<T>>(store: Map<WildPaths<T>, any[]> | undefined, path: P, cb: any): boolean | undefined;
|
|
978
985
|
/**
|
|
979
986
|
* Registers a get mediator for a path.
|
|
980
987
|
* @param path Path or wildcard path.
|
|
@@ -1217,4 +1224,4 @@ declare const NIL: any;
|
|
|
1217
1224
|
/** Shared no-operation function. */
|
|
1218
1225
|
declare const NOOP: () => void;
|
|
1219
1226
|
|
|
1220
|
-
export { type
|
|
1227
|
+
export { type ListenerOptions as $, Autotracker as A, BaseReactorModule as B, CTX as C, type DeepReadonly as D, type EffectOptions as E, type FanoutTuple as F, type ChildPaths as G, type DeepKeys as H, type Inert as I, type DeepMerge as J, type DeepPartial as K, type DeepRequired as L, type ModulePaths as M, type Deleter as N, type DeleterRecord as O, type Paths as P, type DepthConfig as Q, type ReactorModulePathConfig as R, type DirectPayload as S, EVT_OPTS as T, type Getter as U, type GetterRecord as V, type WildPaths as W, INDIFFABLE as X, INERTIA as Y, type Intent as Z, type Listener as _, Reactor as a, type ListenerOptionsTuple as a0, type ListenerRecord as a1, type Live as a2, type MaxDepth as a3, NIL as a4, NOOP as a5, type NextDepth as a6, type NoTraverse as a7, type PathBranch as a8, type PathBranchValue as a9, type UpdatePayload as aA, VERSION as aB, type Volatile as aC, type Watcher as aD, type WatcherRecord as aE, getRaw as aF, getSnapshotVersion as aG, getVersion as aH, inert as aI, intent as aJ, isInert as aK, isIntent as aL, isVolatile as aM, live as aN, methods as aO, reactive as aP, stable as aQ, state as aR, volatile as aS, type PathDepth as aa, type PathKey as ab, type PathLeaf as ac, type Payload as ad, type PrevDepth as ae, type Primitive as af, type Pure as ag, RAW as ah, REJECTABLE as ai, RTR_BATCH as aj, RTR_LOG as ak, type ReactivePreferences as al, ReactorEvent as am, SSVERSION as an, type Setter as ao, type SetterRecord as ap, type Stable as aq, type State as ar, type StrictPathKey as as, type SubtractDepth as at, type SyncOptions as au, type SyncOptionsTuple as av, TERMINATOR as aw, type Target as ax, type Unflatten as ay, type UnionToIntersection as az, type ReactorModuleId as b, type REvent as c, type ReactorModuleConstructor as d, type Reactive as e, type PathValue as f, arrRegex as g, canHandle as h, deepClone as i, deleteAny as j, fanout as k, fanoutOptsArr as l, getAny as m, getTrailRecords as n, inAny as o, isObj as p, isPOJO as q, mergeObjs as r, nuke as s, parseAnyObj as t, parseEvtOpts as u, setAny as v, withTracker as w, type ReactorBuild as x, type APIKey as y, type AddDepth as z };
|
|
@@ -301,8 +301,8 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
301
301
|
/**
|
|
302
302
|
* Marks a rejectable event as rejected.
|
|
303
303
|
* @param reason Optional rejection reason or identity.
|
|
304
|
-
* @example e.
|
|
305
|
-
* @example e.
|
|
304
|
+
* @example e.reject("html5Tech"); // identity
|
|
305
|
+
* @example e.reject("User is not logged in"); // reason
|
|
306
306
|
*/
|
|
307
307
|
reject(reason?: string): void;
|
|
308
308
|
/**
|
|
@@ -312,7 +312,7 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
312
312
|
composedPath(): any[];
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
/** Reactor method names exposed on objects returned by
|
|
315
|
+
/** `Reactor` method names exposed on objects returned by `reactive()`. */
|
|
316
316
|
declare const methods: readonly ["tick", "stall", "nostall", "get", "gonce", "noget", "set", "sonce", "noset", "delete", "donce", "nodelete", "watch", "wonce", "nowatch", "on", "once", "off", "snapshot", "use", "reset", "destroy"];
|
|
317
317
|
type Method = (typeof methods)[number];
|
|
318
318
|
type Prefix<P extends ReactivePreferences | undefined> = P extends {
|
|
@@ -331,17 +331,24 @@ type ReactiveMethodMap<T extends object, P extends ReactivePreferences | undefin
|
|
|
331
331
|
whitelist: readonly Method[];
|
|
332
332
|
} ? (K extends Whitelist<P> ? `${Prefix<P>}${K}${Suffix<P>}` : K) : `${Prefix<P>}${K}${Suffix<P>}`]: Pick<Reactor<T>, Method>[K];
|
|
333
333
|
};
|
|
334
|
+
/** Exposed `Reactor` methods and `__Reactor__` of a `reactive()` object. */
|
|
335
|
+
type APIKey<T extends object = any, P extends ReactivePreferences | undefined = undefined> = keyof ReactiveMethodMap<T, P> | "__Reactor__";
|
|
336
|
+
/** Type representing a `reactive()` object with mapped `Reactor` methods and `__Reactor__`. */
|
|
337
|
+
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
338
|
+
__Reactor__: Reactor<T>;
|
|
339
|
+
};
|
|
340
|
+
/** Object type with only the non-reactor props of a `reactive()` object, representing the runtime enumerable shape. */
|
|
341
|
+
type Pure<T extends object, P extends ReactivePreferences | undefined = undefined> = {
|
|
342
|
+
[K in keyof T as K extends APIKey<T, P> ? never : K]: T[K];
|
|
343
|
+
};
|
|
334
344
|
interface ReactivePreferences {
|
|
335
|
-
/** Prefix applied to exposed
|
|
345
|
+
/** Prefix applied to exposed `Reactor` methods. */
|
|
336
346
|
prefix?: string;
|
|
337
|
-
/** Suffix applied to exposed
|
|
347
|
+
/** Suffix applied to exposed `Reactor` methods. */
|
|
338
348
|
suffix?: string;
|
|
339
349
|
/** Methods that should keep their original names when affixes are used. */
|
|
340
350
|
whitelist?: readonly Method[];
|
|
341
351
|
}
|
|
342
|
-
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
343
|
-
__Reactor__: Reactor<T>;
|
|
344
|
-
};
|
|
345
352
|
/**
|
|
346
353
|
* Attaches `Reactor` APIs to a state object and returns its reactive proxy from the reactor's core.
|
|
347
354
|
* If an existing `reactive()` object is passed, it is re-returned ignoring change in preferences.
|
|
@@ -973,8 +980,8 @@ declare class Reactor<T extends object> {
|
|
|
973
980
|
getContext<P extends WildPaths<T>>(path: P): Target<T, P>;
|
|
974
981
|
protected bindSignal<Cb>(cord: GetterRecord<T> | SetterRecord<T> | DeleterRecord<T> | WatcherRecord<T> | ListenerRecord<T>, sig?: AbortSignal): Cb;
|
|
975
982
|
protected cloned<O>(target: O, raw: boolean, seen?: WeakMap<WeakKey, any>): O;
|
|
976
|
-
protected
|
|
977
|
-
protected
|
|
983
|
+
protected addSync<P extends WildPaths<T>>(key: "get" | "set" | "delete" | "watch", path: P, cb: any, opts: SyncOptions | undefined, onImmediate?: (immediate: boolean | "auto") => void): () => boolean | undefined;
|
|
984
|
+
protected dropSync<P extends WildPaths<T>>(store: Map<WildPaths<T>, any[]> | undefined, path: P, cb: any): boolean | undefined;
|
|
978
985
|
/**
|
|
979
986
|
* Registers a get mediator for a path.
|
|
980
987
|
* @param path Path or wildcard path.
|
|
@@ -1217,4 +1224,4 @@ declare const NIL: any;
|
|
|
1217
1224
|
/** Shared no-operation function. */
|
|
1218
1225
|
declare const NOOP: () => void;
|
|
1219
1226
|
|
|
1220
|
-
export { type
|
|
1227
|
+
export { type ListenerOptions as $, Autotracker as A, BaseReactorModule as B, CTX as C, type DeepReadonly as D, type EffectOptions as E, type FanoutTuple as F, type ChildPaths as G, type DeepKeys as H, type Inert as I, type DeepMerge as J, type DeepPartial as K, type DeepRequired as L, type ModulePaths as M, type Deleter as N, type DeleterRecord as O, type Paths as P, type DepthConfig as Q, type ReactorModulePathConfig as R, type DirectPayload as S, EVT_OPTS as T, type Getter as U, type GetterRecord as V, type WildPaths as W, INDIFFABLE as X, INERTIA as Y, type Intent as Z, type Listener as _, Reactor as a, type ListenerOptionsTuple as a0, type ListenerRecord as a1, type Live as a2, type MaxDepth as a3, NIL as a4, NOOP as a5, type NextDepth as a6, type NoTraverse as a7, type PathBranch as a8, type PathBranchValue as a9, type UpdatePayload as aA, VERSION as aB, type Volatile as aC, type Watcher as aD, type WatcherRecord as aE, getRaw as aF, getSnapshotVersion as aG, getVersion as aH, inert as aI, intent as aJ, isInert as aK, isIntent as aL, isVolatile as aM, live as aN, methods as aO, reactive as aP, stable as aQ, state as aR, volatile as aS, type PathDepth as aa, type PathKey as ab, type PathLeaf as ac, type Payload as ad, type PrevDepth as ae, type Primitive as af, type Pure as ag, RAW as ah, REJECTABLE as ai, RTR_BATCH as aj, RTR_LOG as ak, type ReactivePreferences as al, ReactorEvent as am, SSVERSION as an, type Setter as ao, type SetterRecord as ap, type Stable as aq, type State as ar, type StrictPathKey as as, type SubtractDepth as at, type SyncOptions as au, type SyncOptionsTuple as av, TERMINATOR as aw, type Target as ax, type Unflatten as ay, type UnionToIntersection as az, type ReactorModuleId as b, type REvent as c, type ReactorModuleConstructor as d, type Reactive as e, type PathValue as f, arrRegex as g, canHandle as h, deepClone as i, deleteAny as j, fanout as k, fanoutOptsArr as l, getAny as m, getTrailRecords as n, inAny as o, isObj as p, isPOJO as q, mergeObjs as r, nuke as s, parseAnyObj as t, parseEvtOpts as u, setAny as v, withTracker as w, type ReactorBuild as x, type APIKey as y, type AddDepth as z };
|
package/dist/index.cjs
CHANGED
|
@@ -293,8 +293,8 @@ var ReactorEvent = class _ReactorEvent {
|
|
|
293
293
|
/**
|
|
294
294
|
* Marks a rejectable event as rejected.
|
|
295
295
|
* @param reason Optional rejection reason or identity.
|
|
296
|
-
* @example e.
|
|
297
|
-
* @example e.
|
|
296
|
+
* @example e.reject("html5Tech"); // identity
|
|
297
|
+
* @example e.reject("User is not logged in"); // reason
|
|
298
298
|
*/
|
|
299
299
|
reject(reason) {
|
|
300
300
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -665,7 +665,7 @@ var Reactor = class {
|
|
|
665
665
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
666
666
|
return clone;
|
|
667
667
|
}
|
|
668
|
-
|
|
668
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
669
669
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
670
670
|
let cords = store.get(path), cord;
|
|
671
671
|
if (cords)
|
|
@@ -684,7 +684,7 @@ var Reactor = class {
|
|
|
684
684
|
lazy ? this.stall(task) : task();
|
|
685
685
|
return this.bindSignal(cord, signal);
|
|
686
686
|
}
|
|
687
|
-
|
|
687
|
+
dropSync(store, path, cb) {
|
|
688
688
|
const cords = store?.get(path);
|
|
689
689
|
if (!cords) return void 0;
|
|
690
690
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -703,7 +703,7 @@ var Reactor = class {
|
|
|
703
703
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
704
704
|
*/
|
|
705
705
|
get(path, callback, options) {
|
|
706
|
-
return this.
|
|
706
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
707
707
|
}
|
|
708
708
|
/** Registers a get mediator for a path that only triggers once. */
|
|
709
709
|
gonce(path, callback, options) {
|
|
@@ -716,7 +716,7 @@ var Reactor = class {
|
|
|
716
716
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
717
717
|
*/
|
|
718
718
|
noget(path, callback) {
|
|
719
|
-
return this.
|
|
719
|
+
return this.dropSync(this.getters, path, callback);
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
722
722
|
* Registers a set mediator for a path.
|
|
@@ -728,7 +728,7 @@ var Reactor = class {
|
|
|
728
728
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
729
729
|
*/
|
|
730
730
|
set(path, callback, options) {
|
|
731
|
-
return this.
|
|
731
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
732
732
|
}
|
|
733
733
|
/** Registers a set mediator for a path that only triggers once. */
|
|
734
734
|
sonce(path, callback, options) {
|
|
@@ -741,7 +741,7 @@ var Reactor = class {
|
|
|
741
741
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
742
742
|
*/
|
|
743
743
|
noset(path, callback) {
|
|
744
|
-
return this.
|
|
744
|
+
return this.dropSync(this.setters, path, callback);
|
|
745
745
|
}
|
|
746
746
|
/**
|
|
747
747
|
* Registers a delete mediator for a path.
|
|
@@ -753,7 +753,7 @@ var Reactor = class {
|
|
|
753
753
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
754
754
|
*/
|
|
755
755
|
delete(path, callback, options) {
|
|
756
|
-
return this.
|
|
756
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
757
757
|
}
|
|
758
758
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
759
759
|
donce(path, callback, options) {
|
|
@@ -766,7 +766,7 @@ var Reactor = class {
|
|
|
766
766
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
767
767
|
*/
|
|
768
768
|
nodelete(path, callback) {
|
|
769
|
-
return this.
|
|
769
|
+
return this.dropSync(this.deleters, path, callback);
|
|
770
770
|
}
|
|
771
771
|
/**
|
|
772
772
|
* Registers a watcher for a path.
|
|
@@ -779,7 +779,7 @@ var Reactor = class {
|
|
|
779
779
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
780
780
|
*/
|
|
781
781
|
watch(path, callback, options) {
|
|
782
|
-
return this.
|
|
782
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
783
783
|
}
|
|
784
784
|
/** Registers a watcher for a path that only triggers once. */
|
|
785
785
|
wonce(path, callback, options) {
|
|
@@ -792,7 +792,7 @@ var Reactor = class {
|
|
|
792
792
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
793
793
|
*/
|
|
794
794
|
nowatch(path, callback) {
|
|
795
|
-
return this.
|
|
795
|
+
return this.dropSync(this.watchers, path, callback);
|
|
796
796
|
}
|
|
797
797
|
/**
|
|
798
798
|
* Registers an event listener for a path.
|
package/dist/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { y as AddDepth, C as CTX,
|
|
1
|
+
export { y as APIKey, z as AddDepth, C as CTX, G as ChildPaths, H as DeepKeys, J as DeepMerge, K as DeepPartial, D as DeepReadonly, L as DeepRequired, N as Deleter, O as DeleterRecord, Q as DepthConfig, S as DirectPayload, T as EVT_OPTS, E as EffectOptions, U as Getter, V as GetterRecord, X as INDIFFABLE, Y as INERTIA, I as Inert, Z as Intent, _ as Listener, $ as ListenerOptions, a0 as ListenerOptionsTuple, a1 as ListenerRecord, a2 as Live, a3 as MaxDepth, a4 as NIL, a5 as NOOP, a6 as NextDepth, a7 as NoTraverse, a8 as PathBranch, a9 as PathBranchValue, aa as PathDepth, ab as PathKey, ac as PathLeaf, f as PathValue, P as Paths, ad as Payload, ae as PrevDepth, af as Primitive, ag as Pure, ah as RAW, ai as REJECTABLE, c as REvent, aj as RTR_BATCH, ak as RTR_LOG, e as Reactive, al as ReactivePreferences, a as Reactor, x as ReactorBuild, am as ReactorEvent, an as SSVERSION, ao as Setter, ap as SetterRecord, aq as Stable, ar as State, as as StrictPathKey, at as SubtractDepth, au as SyncOptions, av as SyncOptionsTuple, aw as TERMINATOR, ax as Target, ay as Unflatten, az as UnionToIntersection, aA as UpdatePayload, aB as VERSION, aC as Volatile, aD as Watcher, aE as WatcherRecord, W as WildPaths, aF as getRaw, aG as getSnapshotVersion, aH as getVersion, aI as inert, aJ as intent, aK as isInert, aL as isIntent, aM as isVolatile, aN as live, aO as methods, aP as reactive, aQ as stable, aR as state, aS as volatile } from './index-CWbDYjby.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { y as AddDepth, C as CTX,
|
|
1
|
+
export { y as APIKey, z as AddDepth, C as CTX, G as ChildPaths, H as DeepKeys, J as DeepMerge, K as DeepPartial, D as DeepReadonly, L as DeepRequired, N as Deleter, O as DeleterRecord, Q as DepthConfig, S as DirectPayload, T as EVT_OPTS, E as EffectOptions, U as Getter, V as GetterRecord, X as INDIFFABLE, Y as INERTIA, I as Inert, Z as Intent, _ as Listener, $ as ListenerOptions, a0 as ListenerOptionsTuple, a1 as ListenerRecord, a2 as Live, a3 as MaxDepth, a4 as NIL, a5 as NOOP, a6 as NextDepth, a7 as NoTraverse, a8 as PathBranch, a9 as PathBranchValue, aa as PathDepth, ab as PathKey, ac as PathLeaf, f as PathValue, P as Paths, ad as Payload, ae as PrevDepth, af as Primitive, ag as Pure, ah as RAW, ai as REJECTABLE, c as REvent, aj as RTR_BATCH, ak as RTR_LOG, e as Reactive, al as ReactivePreferences, a as Reactor, x as ReactorBuild, am as ReactorEvent, an as SSVERSION, ao as Setter, ap as SetterRecord, aq as Stable, ar as State, as as StrictPathKey, at as SubtractDepth, au as SyncOptions, av as SyncOptionsTuple, aw as TERMINATOR, ax as Target, ay as Unflatten, az as UnionToIntersection, aA as UpdatePayload, aB as VERSION, aC as Volatile, aD as Watcher, aE as WatcherRecord, W as WildPaths, aF as getRaw, aG as getSnapshotVersion, aH as getVersion, aI as inert, aJ as intent, aK as isInert, aL as isIntent, aM as isVolatile, aN as live, aO as methods, aP as reactive, aQ as stable, aR as state, aS as volatile } from './index-CWbDYjby.js';
|
package/dist/index.js
CHANGED
package/dist/modules.cjs
CHANGED
|
@@ -330,8 +330,8 @@ var ReactorEvent = class _ReactorEvent {
|
|
|
330
330
|
/**
|
|
331
331
|
* Marks a rejectable event as rejected.
|
|
332
332
|
* @param reason Optional rejection reason or identity.
|
|
333
|
-
* @example e.
|
|
334
|
-
* @example e.
|
|
333
|
+
* @example e.reject("html5Tech"); // identity
|
|
334
|
+
* @example e.reject("User is not logged in"); // reason
|
|
335
335
|
*/
|
|
336
336
|
reject(reason) {
|
|
337
337
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -702,7 +702,7 @@ var Reactor = class {
|
|
|
702
702
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
703
703
|
return clone;
|
|
704
704
|
}
|
|
705
|
-
|
|
705
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
706
706
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
707
707
|
let cords = store.get(path), cord;
|
|
708
708
|
if (cords)
|
|
@@ -721,7 +721,7 @@ var Reactor = class {
|
|
|
721
721
|
lazy ? this.stall(task) : task();
|
|
722
722
|
return this.bindSignal(cord, signal);
|
|
723
723
|
}
|
|
724
|
-
|
|
724
|
+
dropSync(store, path, cb) {
|
|
725
725
|
const cords = store?.get(path);
|
|
726
726
|
if (!cords) return void 0;
|
|
727
727
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -740,7 +740,7 @@ var Reactor = class {
|
|
|
740
740
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
741
741
|
*/
|
|
742
742
|
get(path, callback, options) {
|
|
743
|
-
return this.
|
|
743
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
744
744
|
}
|
|
745
745
|
/** Registers a get mediator for a path that only triggers once. */
|
|
746
746
|
gonce(path, callback, options) {
|
|
@@ -753,7 +753,7 @@ var Reactor = class {
|
|
|
753
753
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
754
754
|
*/
|
|
755
755
|
noget(path, callback) {
|
|
756
|
-
return this.
|
|
756
|
+
return this.dropSync(this.getters, path, callback);
|
|
757
757
|
}
|
|
758
758
|
/**
|
|
759
759
|
* Registers a set mediator for a path.
|
|
@@ -765,7 +765,7 @@ var Reactor = class {
|
|
|
765
765
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
766
766
|
*/
|
|
767
767
|
set(path, callback, options) {
|
|
768
|
-
return this.
|
|
768
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
769
769
|
}
|
|
770
770
|
/** Registers a set mediator for a path that only triggers once. */
|
|
771
771
|
sonce(path, callback, options) {
|
|
@@ -778,7 +778,7 @@ var Reactor = class {
|
|
|
778
778
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
779
779
|
*/
|
|
780
780
|
noset(path, callback) {
|
|
781
|
-
return this.
|
|
781
|
+
return this.dropSync(this.setters, path, callback);
|
|
782
782
|
}
|
|
783
783
|
/**
|
|
784
784
|
* Registers a delete mediator for a path.
|
|
@@ -790,7 +790,7 @@ var Reactor = class {
|
|
|
790
790
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
791
791
|
*/
|
|
792
792
|
delete(path, callback, options) {
|
|
793
|
-
return this.
|
|
793
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
794
794
|
}
|
|
795
795
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
796
796
|
donce(path, callback, options) {
|
|
@@ -803,7 +803,7 @@ var Reactor = class {
|
|
|
803
803
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
804
804
|
*/
|
|
805
805
|
nodelete(path, callback) {
|
|
806
|
-
return this.
|
|
806
|
+
return this.dropSync(this.deleters, path, callback);
|
|
807
807
|
}
|
|
808
808
|
/**
|
|
809
809
|
* Registers a watcher for a path.
|
|
@@ -816,7 +816,7 @@ var Reactor = class {
|
|
|
816
816
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
817
817
|
*/
|
|
818
818
|
watch(path, callback, options) {
|
|
819
|
-
return this.
|
|
819
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
820
820
|
}
|
|
821
821
|
/** Registers a watcher for a path that only triggers once. */
|
|
822
822
|
wonce(path, callback, options) {
|
|
@@ -829,7 +829,7 @@ var Reactor = class {
|
|
|
829
829
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
830
830
|
*/
|
|
831
831
|
nowatch(path, callback) {
|
|
832
|
-
return this.
|
|
832
|
+
return this.dropSync(this.watchers, path, callback);
|
|
833
833
|
}
|
|
834
834
|
/**
|
|
835
835
|
* Registers an event listener for a path.
|
|
@@ -1581,7 +1581,8 @@ var TimeTravelModule = class extends BaseReactorModule {
|
|
|
1581
1581
|
this.lastTimestamp = performance.now();
|
|
1582
1582
|
const resume = !this.state.paused, target = this.state.currentFrame;
|
|
1583
1583
|
this.state.paused = false;
|
|
1584
|
-
for (const [rid, rtr] of this.rtrs)
|
|
1584
|
+
for (const [rid, rtr] of this.rtrs) fanout(rtr.core, "*", deepClone(this.state.initialState[rid], rtr.config));
|
|
1585
|
+
for (const rtr of this.rtrs.values()) rtr.tick();
|
|
1585
1586
|
this.state.currentFrame = 0, this.jumpTo(target), resume && this.play();
|
|
1586
1587
|
}
|
|
1587
1588
|
};
|
package/dist/modules.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Paths, R as ReactorModulePathConfig, I as Inert, F as FanoutTuple, B as BaseReactorModule, a as Reactor, b as ReactorModuleId, c as REvent } from './index-
|
|
2
|
-
export { M as ModulePaths, d as ReactorModuleConstructor } from './index-
|
|
3
|
-
import { S as StorageAdapter, A as AsyncStorageAdapter, a as StorageAdapterConstructor, b as AsyncStorageAdapterConstructor } from './timeTravel-
|
|
4
|
-
export { B as BaseStorageAdapter, C as COOKIE_ADAPTER_BUILD, c as CookieAdapter, d as CookieAdapterConfig, e as CookieOptions, H as HistoryEntry, I as INDEXED_DB_ADAPTER_BUILD, f as IndexedDBAdapter, g as IndexedDBAdapterConfig, J as JSONReplacer, h as JSONReviver, L as LocalStorageAdapter, M as MemoryAdapter, i as MemoryAdapterConfig, j as SessionStorageAdapter, k as StorageAdapterConfig, T as TIME_TRAVEL_MODULE_BUILD, l as TimeTravelConfig, m as TimeTravelModule, n as TimeTravelState } from './timeTravel-
|
|
1
|
+
import { P as Paths, R as ReactorModulePathConfig, I as Inert, F as FanoutTuple, B as BaseReactorModule, a as Reactor, b as ReactorModuleId, c as REvent } from './index-CWbDYjby.cjs';
|
|
2
|
+
export { M as ModulePaths, d as ReactorModuleConstructor } from './index-CWbDYjby.cjs';
|
|
3
|
+
import { S as StorageAdapter, A as AsyncStorageAdapter, a as StorageAdapterConstructor, b as AsyncStorageAdapterConstructor } from './timeTravel-DoWtLH_e.cjs';
|
|
4
|
+
export { B as BaseStorageAdapter, C as COOKIE_ADAPTER_BUILD, c as CookieAdapter, d as CookieAdapterConfig, e as CookieOptions, H as HistoryEntry, I as INDEXED_DB_ADAPTER_BUILD, f as IndexedDBAdapter, g as IndexedDBAdapterConfig, J as JSONReplacer, h as JSONReviver, L as LocalStorageAdapter, M as MemoryAdapter, i as MemoryAdapterConfig, j as SessionStorageAdapter, k as StorageAdapterConfig, T as TIME_TRAVEL_MODULE_BUILD, l as TimeTravelConfig, m as TimeTravelModule, n as TimeTravelState } from './timeTravel-DoWtLH_e.cjs';
|
|
5
5
|
|
|
6
6
|
interface PersistConfig<T extends object, P extends Paths<T> = Paths<T>> extends ReactorModulePathConfig<T, P> {
|
|
7
7
|
/** The key under which to store the persisted data */
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Paths, R as ReactorModulePathConfig, I as Inert, F as FanoutTuple, B as BaseReactorModule, a as Reactor, b as ReactorModuleId, c as REvent } from './index-
|
|
2
|
-
export { M as ModulePaths, d as ReactorModuleConstructor } from './index-
|
|
3
|
-
import { S as StorageAdapter, A as AsyncStorageAdapter, a as StorageAdapterConstructor, b as AsyncStorageAdapterConstructor } from './timeTravel-
|
|
4
|
-
export { B as BaseStorageAdapter, C as COOKIE_ADAPTER_BUILD, c as CookieAdapter, d as CookieAdapterConfig, e as CookieOptions, H as HistoryEntry, I as INDEXED_DB_ADAPTER_BUILD, f as IndexedDBAdapter, g as IndexedDBAdapterConfig, J as JSONReplacer, h as JSONReviver, L as LocalStorageAdapter, M as MemoryAdapter, i as MemoryAdapterConfig, j as SessionStorageAdapter, k as StorageAdapterConfig, T as TIME_TRAVEL_MODULE_BUILD, l as TimeTravelConfig, m as TimeTravelModule, n as TimeTravelState } from './timeTravel-
|
|
1
|
+
import { P as Paths, R as ReactorModulePathConfig, I as Inert, F as FanoutTuple, B as BaseReactorModule, a as Reactor, b as ReactorModuleId, c as REvent } from './index-CWbDYjby.js';
|
|
2
|
+
export { M as ModulePaths, d as ReactorModuleConstructor } from './index-CWbDYjby.js';
|
|
3
|
+
import { S as StorageAdapter, A as AsyncStorageAdapter, a as StorageAdapterConstructor, b as AsyncStorageAdapterConstructor } from './timeTravel-BsVQ5z7v.js';
|
|
4
|
+
export { B as BaseStorageAdapter, C as COOKIE_ADAPTER_BUILD, c as CookieAdapter, d as CookieAdapterConfig, e as CookieOptions, H as HistoryEntry, I as INDEXED_DB_ADAPTER_BUILD, f as IndexedDBAdapter, g as IndexedDBAdapterConfig, J as JSONReplacer, h as JSONReviver, L as LocalStorageAdapter, M as MemoryAdapter, i as MemoryAdapterConfig, j as SessionStorageAdapter, k as StorageAdapterConfig, T as TIME_TRAVEL_MODULE_BUILD, l as TimeTravelConfig, m as TimeTravelModule, n as TimeTravelState } from './timeTravel-BsVQ5z7v.js';
|
|
5
5
|
|
|
6
6
|
interface PersistConfig<T extends object, P extends Paths<T> = Paths<T>> extends ReactorModulePathConfig<T, P> {
|
|
7
7
|
/** The key under which to store the persisted data */
|
package/dist/modules.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
BaseReactorModule,
|
|
7
7
|
wpArr
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-GD7HZBXA.js";
|
|
9
|
+
import "./chunk-AKQSBLBX.js";
|
|
10
10
|
import "./chunk-3OT72G7R.js";
|
|
11
11
|
import {
|
|
12
12
|
NIL,
|
|
@@ -518,7 +518,8 @@ var TimeTravelModule = class extends BaseReactorModule {
|
|
|
518
518
|
this.lastTimestamp = performance.now();
|
|
519
519
|
const resume = !this.state.paused, target = this.state.currentFrame;
|
|
520
520
|
this.state.paused = false;
|
|
521
|
-
for (const [rid, rtr] of this.rtrs)
|
|
521
|
+
for (const [rid, rtr] of this.rtrs) fanout(rtr.core, "*", deepClone(this.state.initialState[rid], rtr.config));
|
|
522
|
+
for (const rtr of this.rtrs.values()) rtr.tick();
|
|
522
523
|
this.state.currentFrame = 0, this.jumpTo(target), resume && this.play();
|
|
523
524
|
}
|
|
524
525
|
};
|
package/dist/super.d.ts
CHANGED
|
@@ -301,8 +301,8 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
301
301
|
/**
|
|
302
302
|
* Marks a rejectable event as rejected.
|
|
303
303
|
* @param reason Optional rejection reason or identity.
|
|
304
|
-
* @example e.
|
|
305
|
-
* @example e.
|
|
304
|
+
* @example e.reject("html5Tech"); // identity
|
|
305
|
+
* @example e.reject("User is not logged in"); // reason
|
|
306
306
|
*/
|
|
307
307
|
reject(reason?: string): void;
|
|
308
308
|
/**
|
|
@@ -312,7 +312,7 @@ declare class ReactorEvent<T extends object, P extends WildPaths<T> = WildPaths<
|
|
|
312
312
|
composedPath(): any[];
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
/** Reactor method names exposed on objects returned by
|
|
315
|
+
/** `Reactor` method names exposed on objects returned by `reactive()`. */
|
|
316
316
|
declare const methods: readonly ["tick", "stall", "nostall", "get", "gonce", "noget", "set", "sonce", "noset", "delete", "donce", "nodelete", "watch", "wonce", "nowatch", "on", "once", "off", "snapshot", "use", "reset", "destroy"];
|
|
317
317
|
type Method = (typeof methods)[number];
|
|
318
318
|
type Prefix<P extends ReactivePreferences | undefined> = P extends {
|
|
@@ -331,17 +331,24 @@ type ReactiveMethodMap<T extends object, P extends ReactivePreferences | undefin
|
|
|
331
331
|
whitelist: readonly Method[];
|
|
332
332
|
} ? (K extends Whitelist<P> ? `${Prefix<P>}${K}${Suffix<P>}` : K) : `${Prefix<P>}${K}${Suffix<P>}`]: Pick<Reactor<T>, Method>[K];
|
|
333
333
|
};
|
|
334
|
+
/** Exposed `Reactor` methods and `__Reactor__` of a `reactive()` object. */
|
|
335
|
+
type APIKey<T extends object = any, P extends ReactivePreferences | undefined = undefined> = keyof ReactiveMethodMap<T, P> | "__Reactor__";
|
|
336
|
+
/** Type representing a `reactive()` object with mapped `Reactor` methods and `__Reactor__`. */
|
|
337
|
+
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
338
|
+
__Reactor__: Reactor<T>;
|
|
339
|
+
};
|
|
340
|
+
/** Object type with only the non-reactor props of a `reactive()` object, representing the runtime enumerable shape. */
|
|
341
|
+
type Pure<T extends object, P extends ReactivePreferences | undefined = undefined> = {
|
|
342
|
+
[K in keyof T as K extends APIKey<T, P> ? never : K]: T[K];
|
|
343
|
+
};
|
|
334
344
|
interface ReactivePreferences {
|
|
335
|
-
/** Prefix applied to exposed
|
|
345
|
+
/** Prefix applied to exposed `Reactor` methods. */
|
|
336
346
|
prefix?: string;
|
|
337
|
-
/** Suffix applied to exposed
|
|
347
|
+
/** Suffix applied to exposed `Reactor` methods. */
|
|
338
348
|
suffix?: string;
|
|
339
349
|
/** Methods that should keep their original names when affixes are used. */
|
|
340
350
|
whitelist?: readonly Method[];
|
|
341
351
|
}
|
|
342
|
-
type Reactive<T extends object, P extends ReactivePreferences | undefined = undefined> = T & ReactiveMethodMap<T, P> & {
|
|
343
|
-
__Reactor__: Reactor<T>;
|
|
344
|
-
};
|
|
345
352
|
/**
|
|
346
353
|
* Attaches `Reactor` APIs to a state object and returns its reactive proxy from the reactor's core.
|
|
347
354
|
* If an existing `reactive()` object is passed, it is re-returned ignoring change in preferences.
|
|
@@ -973,8 +980,8 @@ declare class Reactor<T extends object> {
|
|
|
973
980
|
getContext<P extends WildPaths<T>>(path: P): Target<T, P>;
|
|
974
981
|
protected bindSignal<Cb>(cord: GetterRecord<T> | SetterRecord<T> | DeleterRecord<T> | WatcherRecord<T> | ListenerRecord<T>, sig?: AbortSignal): Cb;
|
|
975
982
|
protected cloned<O>(target: O, raw: boolean, seen?: WeakMap<WeakKey, any>): O;
|
|
976
|
-
protected
|
|
977
|
-
protected
|
|
983
|
+
protected addSync<P extends WildPaths<T>>(key: "get" | "set" | "delete" | "watch", path: P, cb: any, opts: SyncOptions | undefined, onImmediate?: (immediate: boolean | "auto") => void): () => boolean | undefined;
|
|
984
|
+
protected dropSync<P extends WildPaths<T>>(store: Map<WildPaths<T>, any[]> | undefined, path: P, cb: any): boolean | undefined;
|
|
978
985
|
/**
|
|
979
986
|
* Registers a get mediator for a path.
|
|
980
987
|
* @param path Path or wildcard path.
|
|
@@ -1936,4 +1943,4 @@ declare const adapters: {
|
|
|
1936
1943
|
vanilla: typeof vanilla;
|
|
1937
1944
|
};
|
|
1938
1945
|
|
|
1939
|
-
export { type AddDepth, CTX, type ChildPaths, type DeepKeys, type DeepMerge, type DeepPartial, type DeepReadonly, type DeepRequired, type Deleter, type DeleterRecord, type DepthConfig, type DirectPayload, EVT_OPTS, type EffectOptions, type Getter, type GetterRecord, INDIFFABLE, INERTIA, type Inert, type Intent, type Listener, type ListenerOptions, type ListenerOptionsTuple, type ListenerRecord, type Live, type MaxDepth, NIL, NOOP, type NextDepth, type NoTraverse, type PathBranch, type PathBranchValue, type PathDepth, type PathKey, type PathLeaf, type PathValue, type Paths, type Payload, type PrevDepth, type Primitive, RAW, REJECTABLE, type REvent, RTR_BATCH, RTR_LOG, type Reactive, type ReactivePreferences, Reactor, type ReactorBuild, ReactorEvent, SSVERSION, type Setter, type SetterRecord, type Stable, type State, type StrictPathKey, type SubtractDepth, type SyncOptions, type SyncOptionsTuple, TERMINATOR, type Target, type Unflatten, type UnionToIntersection, type UpdatePayload, VERSION, type Volatile, type Watcher, type WatcherRecord, type WildPaths, adapters, getRaw, getSnapshotVersion, getVersion, inert, intent, isInert, isIntent, isVolatile, live, methods, modules, reactive, stable, state, utils, volatile };
|
|
1946
|
+
export { type APIKey, type AddDepth, CTX, type ChildPaths, type DeepKeys, type DeepMerge, type DeepPartial, type DeepReadonly, type DeepRequired, type Deleter, type DeleterRecord, type DepthConfig, type DirectPayload, EVT_OPTS, type EffectOptions, type Getter, type GetterRecord, INDIFFABLE, INERTIA, type Inert, type Intent, type Listener, type ListenerOptions, type ListenerOptionsTuple, type ListenerRecord, type Live, type MaxDepth, NIL, NOOP, type NextDepth, type NoTraverse, type PathBranch, type PathBranchValue, type PathDepth, type PathKey, type PathLeaf, type PathValue, type Paths, type Payload, type PrevDepth, type Primitive, type Pure, RAW, REJECTABLE, type REvent, RTR_BATCH, RTR_LOG, type Reactive, type ReactivePreferences, Reactor, type ReactorBuild, ReactorEvent, SSVERSION, type Setter, type SetterRecord, type Stable, type State, type StrictPathKey, type SubtractDepth, type SyncOptions, type SyncOptionsTuple, TERMINATOR, type Target, type Unflatten, type UnionToIntersection, type UpdatePayload, VERSION, type Volatile, type Watcher, type WatcherRecord, type WildPaths, adapters, getRaw, getSnapshotVersion, getVersion, inert, intent, isInert, isIntent, isVolatile, live, methods, modules, reactive, stable, state, utils, volatile };
|
package/dist/super.global.js
CHANGED
|
@@ -357,8 +357,8 @@ var sia = (() => {
|
|
|
357
357
|
/**
|
|
358
358
|
* Marks a rejectable event as rejected.
|
|
359
359
|
* @param reason Optional rejection reason or identity.
|
|
360
|
-
* @example e.
|
|
361
|
-
* @example e.
|
|
360
|
+
* @example e.reject("html5Tech"); // identity
|
|
361
|
+
* @example e.reject("User is not logged in"); // reason
|
|
362
362
|
*/
|
|
363
363
|
reject(reason) {
|
|
364
364
|
if (!this.rejectable) return this.reactor.log(`[ReactorEvent] Ignored \`reject()\` call on a non-rejectable ${this.staticType} at "${this.path}"`);
|
|
@@ -729,7 +729,7 @@ var sia = (() => {
|
|
|
729
729
|
if (!raw && this.config.smartCloning) this.snapCache.set(obj, clone), obj[SSVERSION] = version;
|
|
730
730
|
return clone;
|
|
731
731
|
}
|
|
732
|
-
|
|
732
|
+
addSync(key, path, cb, opts, onImmediate = NOOP) {
|
|
733
733
|
const { lazy = false, once = false, signal, immediate = false } = parseEvtOpts(opts, EVT_OPTS.MEDIATOR), store = this[`${key}${key.endsWith("t") ? "t" : ""}ers`] ??= /* @__PURE__ */ new Map();
|
|
734
734
|
let cords = store.get(path), cord;
|
|
735
735
|
if (cords)
|
|
@@ -748,7 +748,7 @@ var sia = (() => {
|
|
|
748
748
|
lazy ? this.stall(task) : task();
|
|
749
749
|
return this.bindSignal(cord, signal);
|
|
750
750
|
}
|
|
751
|
-
|
|
751
|
+
dropSync(store, path, cb) {
|
|
752
752
|
const cords = store?.get(path);
|
|
753
753
|
if (!cords) return void 0;
|
|
754
754
|
for (let i = 0, len = cords.length; i < len; i++) {
|
|
@@ -767,7 +767,7 @@ var sia = (() => {
|
|
|
767
767
|
* const cleanup = rtr.get("user.name", (value) => String(value).trim());
|
|
768
768
|
*/
|
|
769
769
|
get(path, callback, options) {
|
|
770
|
-
return this.
|
|
770
|
+
return this.addSync("get", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && getAny(this.core, path));
|
|
771
771
|
}
|
|
772
772
|
/** Registers a get mediator for a path that only triggers once. */
|
|
773
773
|
gonce(path, callback, options) {
|
|
@@ -780,7 +780,7 @@ var sia = (() => {
|
|
|
780
780
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
781
781
|
*/
|
|
782
782
|
noget(path, callback) {
|
|
783
|
-
return this.
|
|
783
|
+
return this.dropSync(this.getters, path, callback);
|
|
784
784
|
}
|
|
785
785
|
/**
|
|
786
786
|
* Registers a set mediator for a path.
|
|
@@ -792,7 +792,7 @@ var sia = (() => {
|
|
|
792
792
|
* rtr.set("user.name", (value) => String(value).trim());
|
|
793
793
|
*/
|
|
794
794
|
set(path, callback, options) {
|
|
795
|
-
return this.
|
|
795
|
+
return this.addSync("set", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && setAny(this.core, path, getAny(this.core, path)));
|
|
796
796
|
}
|
|
797
797
|
/** Registers a set mediator for a path that only triggers once. */
|
|
798
798
|
sonce(path, callback, options) {
|
|
@@ -805,7 +805,7 @@ var sia = (() => {
|
|
|
805
805
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
806
806
|
*/
|
|
807
807
|
noset(path, callback) {
|
|
808
|
-
return this.
|
|
808
|
+
return this.dropSync(this.setters, path, callback);
|
|
809
809
|
}
|
|
810
810
|
/**
|
|
811
811
|
* Registers a delete mediator for a path.
|
|
@@ -817,7 +817,7 @@ var sia = (() => {
|
|
|
817
817
|
* rtr.delete("cache.temp", () => TERMINATOR);
|
|
818
818
|
*/
|
|
819
819
|
delete(path, callback, options) {
|
|
820
|
-
return this.
|
|
820
|
+
return this.addSync("delete", path, callback, options, (imm) => (imm !== "auto" || inAny(this.core, path)) && deleteAny(this.core, path));
|
|
821
821
|
}
|
|
822
822
|
/** Registers a delete mediator for a path that only triggers once. */
|
|
823
823
|
donce(path, callback, options) {
|
|
@@ -830,7 +830,7 @@ var sia = (() => {
|
|
|
830
830
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
831
831
|
*/
|
|
832
832
|
nodelete(path, callback) {
|
|
833
|
-
return this.
|
|
833
|
+
return this.dropSync(this.deleters, path, callback);
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Registers a watcher for a path.
|
|
@@ -843,7 +843,7 @@ var sia = (() => {
|
|
|
843
843
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
844
844
|
*/
|
|
845
845
|
watch(path, callback, options) {
|
|
846
|
-
return this.
|
|
846
|
+
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto" && inAny(this.core, path) && ((target) => callback(target.value, { type: "init", target, currentTarget: target, root: this.core, rejectable: false }))(this.getContext(path)));
|
|
847
847
|
}
|
|
848
848
|
/** Registers a watcher for a path that only triggers once. */
|
|
849
849
|
wonce(path, callback, options) {
|
|
@@ -856,7 +856,7 @@ var sia = (() => {
|
|
|
856
856
|
* @returns `undefined` when the path has no records, `false` when records exist but callback is not found, `true` when removed.
|
|
857
857
|
*/
|
|
858
858
|
nowatch(path, callback) {
|
|
859
|
-
return this.
|
|
859
|
+
return this.dropSync(this.watchers, path, callback);
|
|
860
860
|
}
|
|
861
861
|
/**
|
|
862
862
|
* Registers an event listener for a path.
|
|
@@ -1801,7 +1801,8 @@ var sia = (() => {
|
|
|
1801
1801
|
this.lastTimestamp = performance.now();
|
|
1802
1802
|
const resume = !this.state.paused, target = this.state.currentFrame;
|
|
1803
1803
|
this.state.paused = false;
|
|
1804
|
-
for (const [rid, rtr] of this.rtrs)
|
|
1804
|
+
for (const [rid, rtr] of this.rtrs) fanout(rtr.core, "*", deepClone(this.state.initialState[rid], rtr.config));
|
|
1805
|
+
for (const rtr of this.rtrs.values()) rtr.tick();
|
|
1805
1806
|
this.state.currentFrame = 0, this.jumpTo(target), resume && this.play();
|
|
1806
1807
|
}
|
|
1807
1808
|
};
|
|
@@ -2039,15 +2040,12 @@ var sia = (() => {
|
|
|
2039
2040
|
nuke(this), --_TimeTravelOverlay.count;
|
|
2040
2041
|
}
|
|
2041
2042
|
};
|
|
2042
|
-
function getDirChild(parent, className) {
|
|
2043
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
2044
|
-
}
|
|
2045
2043
|
function getDock(container) {
|
|
2046
2044
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
2047
2045
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
2048
|
-
const layer =
|
|
2046
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
2049
2047
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
2050
|
-
const dock =
|
|
2048
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
2051
2049
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
2052
2050
|
}
|
|
2053
2051
|
function formatPaths(paths, emptyText) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Paths, f as PathValue, c as REvent, b as ReactorModuleId, R as ReactorModulePathConfig, B as BaseReactorModule, a as Reactor } from './index-
|
|
1
|
+
import { P as Paths, f as PathValue, c as REvent, b as ReactorModuleId, R as ReactorModulePathConfig, B as BaseReactorModule, a as Reactor } from './index-CWbDYjby.js';
|
|
2
2
|
|
|
3
3
|
type JSONReplacer = ((this: any, key: string, value: any) => any) | (number | string)[] | null;
|
|
4
4
|
type JSONReviver = ((this: any, key: string, value: any) => any) | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Paths, f as PathValue, c as REvent, b as ReactorModuleId, R as ReactorModulePathConfig, B as BaseReactorModule, a as Reactor } from './index-
|
|
1
|
+
import { P as Paths, f as PathValue, c as REvent, b as ReactorModuleId, R as ReactorModulePathConfig, B as BaseReactorModule, a as Reactor } from './index-CWbDYjby.cjs';
|
|
2
2
|
|
|
3
3
|
type JSONReplacer = ((this: any, key: string, value: any) => any) | (number | string)[] | null;
|
|
4
4
|
type JSONReviver = ((this: any, key: string, value: any) => any) | undefined;
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { F as FanoutTuple, g as arrRegex, h as canHandle, i as deepClone, j as deleteAny, k as fanout, l as fanoutOptsArr, m as getAny, n as getTrailRecords, o as inAny, p as isObj, q as isPOJO, r as mergeObjs, s as nuke, t as parseAnyObj, u as parseEvtOpts, v as setAny } from './index-
|
|
1
|
+
export { F as FanoutTuple, g as arrRegex, h as canHandle, i as deepClone, j as deleteAny, k as fanout, l as fanoutOptsArr, m as getAny, n as getTrailRecords, o as inAny, p as isObj, q as isPOJO, r as mergeObjs, s as nuke, t as parseAnyObj, u as parseEvtOpts, v as setAny } from './index-CWbDYjby.cjs';
|
|
2
2
|
|
|
3
3
|
declare function clamp(min: number | undefined, val: number, max?: number): number;
|
|
4
4
|
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { F as FanoutTuple, g as arrRegex, h as canHandle, i as deepClone, j as deleteAny, k as fanout, l as fanoutOptsArr, m as getAny, n as getTrailRecords, o as inAny, p as isObj, q as isPOJO, r as mergeObjs, s as nuke, t as parseAnyObj, u as parseEvtOpts, v as setAny } from './index-
|
|
1
|
+
export { F as FanoutTuple, g as arrRegex, h as canHandle, i as deepClone, j as deleteAny, k as fanout, l as fanoutOptsArr, m as getAny, n as getTrailRecords, o as inAny, p as isObj, q as isPOJO, r as mergeObjs, s as nuke, t as parseAnyObj, u as parseEvtOpts, v as setAny } from './index-CWbDYjby.js';
|
|
2
2
|
|
|
3
3
|
declare function clamp(min: number | undefined, val: number, max?: number): number;
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sia-reactor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
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",
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
],
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@changesets/cli": "^2.30.0",
|
|
94
|
-
"@types/node": "^25.
|
|
94
|
+
"@types/node": "^25.6.0",
|
|
95
|
+
"@types/react": "^18.0.0",
|
|
95
96
|
"@types/react-dom": "^18.0.0",
|
|
96
97
|
"@vitejs/plugin-react": "^5.0.4",
|
|
97
|
-
"@types/react": "^18.0.0",
|
|
98
98
|
"happy-dom": "^20.8.9",
|
|
99
99
|
"react": "^18.3.1",
|
|
100
100
|
"react-dom": "^18.3.1",
|