sia-reactor 0.0.30 → 0.0.32
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 +19 -18
- package/dist/adapters/react.d.cts +3 -3
- package/dist/adapters/react.d.ts +3 -3
- package/dist/adapters/react.js +4 -4
- package/dist/adapters/vanilla.cjs +36 -35
- package/dist/adapters/vanilla.d.cts +4 -4
- package/dist/adapters/vanilla.d.ts +4 -4
- package/dist/adapters/vanilla.js +4 -4
- package/dist/{chunk-2EIKOZAD.js → chunk-AKQSBLBX.js} +12 -12
- package/dist/{chunk-NG3WWQV4.js → chunk-GD7HZBXA.js} +1 -1
- package/dist/{chunk-RVYL3OLW.js → chunk-RI45W4O6.js} +26 -21
- package/dist/{chunk-3LIKXZ7X.js → chunk-XNYVGOKB.js} +5 -8
- 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 +41 -13
- package/dist/super.global.js +39 -36
- 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.cjs +24 -18
- package/dist/utils.d.cts +23 -3
- package/dist/utils.d.ts +23 -3
- package/dist/utils.js +3 -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.
|
|
@@ -1132,6 +1132,10 @@ function assignEl(el, props, dataset, styles) {
|
|
|
1132
1132
|
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
+
function getActiveEl(root) {
|
|
1136
|
+
const activeEl = (root ?? document).activeElement;
|
|
1137
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1138
|
+
}
|
|
1135
1139
|
|
|
1136
1140
|
// src/ts/utils/keys.ts
|
|
1137
1141
|
function stringifyKeyEvent(e) {
|
|
@@ -1173,7 +1177,7 @@ function getTermsForKey(combo, settings) {
|
|
|
1173
1177
|
return terms;
|
|
1174
1178
|
}
|
|
1175
1179
|
function keyEventAllowed(e, settings) {
|
|
1176
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
1180
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
1177
1181
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
1178
1182
|
if (block) return false;
|
|
1179
1183
|
if (override) e.preventDefault();
|
|
@@ -1268,15 +1272,12 @@ var TimeTravelOverlay = class _TimeTravelOverlay {
|
|
|
1268
1272
|
nuke(this), --_TimeTravelOverlay.count;
|
|
1269
1273
|
}
|
|
1270
1274
|
};
|
|
1271
|
-
function getDirChild(parent, className) {
|
|
1272
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
1273
|
-
}
|
|
1274
1275
|
function getDock(container) {
|
|
1275
1276
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
1276
1277
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
1277
|
-
const layer =
|
|
1278
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
1278
1279
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
1279
|
-
const dock =
|
|
1280
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
1280
1281
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
1281
1282
|
}
|
|
1282
1283
|
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,13 +2,13 @@ import {
|
|
|
2
2
|
Autotracker,
|
|
3
3
|
TimeTravelOverlay,
|
|
4
4
|
withTracker
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-XNYVGOKB.js";
|
|
6
6
|
import "../chunk-PLYS4CVP.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-GD7HZBXA.js";
|
|
8
8
|
import {
|
|
9
9
|
getReactor
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-AKQSBLBX.js";
|
|
11
|
+
import "../chunk-RI45W4O6.js";
|
|
12
12
|
import "../chunk-3OT72G7R.js";
|
|
13
13
|
import {
|
|
14
14
|
CTX,
|
|
@@ -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.
|
|
@@ -878,6 +878,27 @@ function getReactor(target, create = false, build) {
|
|
|
878
878
|
return (target instanceof Reactor ? target : target.__Reactor__) || (create ? new Reactor(target, build) : void 0);
|
|
879
879
|
}
|
|
880
880
|
|
|
881
|
+
// src/ts/utils/dom.ts
|
|
882
|
+
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
883
|
+
return assignEl(el, props, dataset, styles), el;
|
|
884
|
+
}
|
|
885
|
+
function assignEl(el, props, dataset, styles) {
|
|
886
|
+
if (!el) return;
|
|
887
|
+
if (props) {
|
|
888
|
+
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
889
|
+
}
|
|
890
|
+
if (dataset) {
|
|
891
|
+
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
892
|
+
}
|
|
893
|
+
if (styles) {
|
|
894
|
+
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
function getActiveEl(root) {
|
|
898
|
+
const activeEl = (root ?? document).activeElement;
|
|
899
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
900
|
+
}
|
|
901
|
+
|
|
881
902
|
// src/ts/utils/keys.ts
|
|
882
903
|
function stringifyKeyEvent(e) {
|
|
883
904
|
const parts = [];
|
|
@@ -918,7 +939,7 @@ function getTermsForKey(combo, settings) {
|
|
|
918
939
|
return terms;
|
|
919
940
|
}
|
|
920
941
|
function keyEventAllowed(e, settings) {
|
|
921
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
942
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
922
943
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
923
944
|
if (block) return false;
|
|
924
945
|
if (override) e.preventDefault();
|
|
@@ -932,23 +953,6 @@ function parseForARIAKS(s, formatted = true) {
|
|
|
932
953
|
return (formatted && !Array.isArray(s) ? s : formatKeyForDisplay(s)).toLowerCase().replace(/[()]/g, "").replace(/\bor\b/g, " ").replace(/\w+/g, (k) => m[k] || k).replace(/\s+/g, " ").trim();
|
|
933
954
|
}
|
|
934
955
|
|
|
935
|
-
// src/ts/utils/dom.ts
|
|
936
|
-
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
937
|
-
return assignEl(el, props, dataset, styles), el;
|
|
938
|
-
}
|
|
939
|
-
function assignEl(el, props, dataset, styles) {
|
|
940
|
-
if (!el) return;
|
|
941
|
-
if (props) {
|
|
942
|
-
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
943
|
-
}
|
|
944
|
-
if (dataset) {
|
|
945
|
-
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
946
|
-
}
|
|
947
|
-
if (styles) {
|
|
948
|
-
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
|
|
952
956
|
// src/ts/modules/base.ts
|
|
953
957
|
var wpArr = ["*"];
|
|
954
958
|
|
|
@@ -1175,15 +1179,12 @@ var TimeTravelOverlay = class _TimeTravelOverlay {
|
|
|
1175
1179
|
nuke(this), --_TimeTravelOverlay.count;
|
|
1176
1180
|
}
|
|
1177
1181
|
};
|
|
1178
|
-
function getDirChild(parent, className) {
|
|
1179
|
-
for (const child of parent.children) if (child instanceof HTMLElement && child.classList.contains(className)) return child;
|
|
1180
|
-
}
|
|
1181
1182
|
function getDock(container) {
|
|
1182
1183
|
const host = container && container !== document.documentElement ? container : document.body;
|
|
1183
1184
|
if (host !== document.body && getComputedStyle(host).position === "static") host.style.position = "relative";
|
|
1184
|
-
const layer =
|
|
1185
|
+
const layer = host.querySelector(":scope > .tt-overlay-layer") || createEl("div", { className: "tt-overlay-layer" }, void 0, { position: host === document.body ? "fixed" : "absolute" });
|
|
1185
1186
|
if (layer.parentElement !== host) host.appendChild(layer);
|
|
1186
|
-
const dock =
|
|
1187
|
+
const dock = layer.querySelector(":scope > .tt-overlay-dock") || createEl("div", { className: "tt-overlay-dock" });
|
|
1187
1188
|
return dock.parentElement !== layer && layer.appendChild(dock), dock;
|
|
1188
1189
|
}
|
|
1189
1190
|
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,11 +3,11 @@ import {
|
|
|
3
3
|
TimeTravelOverlay,
|
|
4
4
|
effect,
|
|
5
5
|
withTracker
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-XNYVGOKB.js";
|
|
7
7
|
import "../chunk-PLYS4CVP.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-GD7HZBXA.js";
|
|
9
|
+
import "../chunk-AKQSBLBX.js";
|
|
10
|
+
import "../chunk-RI45W4O6.js";
|
|
11
11
|
import "../chunk-3OT72G7R.js";
|
|
12
12
|
import "../chunk-EZ4VRGYI.js";
|
|
13
13
|
export {
|
|
@@ -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,3 +1,24 @@
|
|
|
1
|
+
// src/ts/utils/dom.ts
|
|
2
|
+
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
3
|
+
return assignEl(el, props, dataset, styles), el;
|
|
4
|
+
}
|
|
5
|
+
function assignEl(el, props, dataset, styles) {
|
|
6
|
+
if (!el) return;
|
|
7
|
+
if (props) {
|
|
8
|
+
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
9
|
+
}
|
|
10
|
+
if (dataset) {
|
|
11
|
+
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
12
|
+
}
|
|
13
|
+
if (styles) {
|
|
14
|
+
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function getActiveEl(root) {
|
|
18
|
+
const activeEl = (root ?? document).activeElement;
|
|
19
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
// src/ts/utils/keys.ts
|
|
2
23
|
function parseKeyCombo(combo) {
|
|
3
24
|
const parts = cleanKeyCombo(combo).toLowerCase().split("+");
|
|
@@ -42,7 +63,7 @@ function getTermsForKey(combo, settings) {
|
|
|
42
63
|
return terms;
|
|
43
64
|
}
|
|
44
65
|
function keyEventAllowed(e, settings) {
|
|
45
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
66
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
46
67
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
47
68
|
if (block) return false;
|
|
48
69
|
if (override) e.preventDefault();
|
|
@@ -61,24 +82,10 @@ function parseForARIAKS(s, formatted = true) {
|
|
|
61
82
|
return (formatted && !Array.isArray(s) ? s : formatKeyForDisplay(s)).toLowerCase().replace(/[()]/g, "").replace(/\bor\b/g, " ").replace(/\w+/g, (k) => m[k] || k).replace(/\s+/g, " ").trim();
|
|
62
83
|
}
|
|
63
84
|
|
|
64
|
-
// src/ts/utils/dom.ts
|
|
65
|
-
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
66
|
-
return assignEl(el, props, dataset, styles), el;
|
|
67
|
-
}
|
|
68
|
-
function assignEl(el, props, dataset, styles) {
|
|
69
|
-
if (!el) return;
|
|
70
|
-
if (props) {
|
|
71
|
-
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
72
|
-
}
|
|
73
|
-
if (dataset) {
|
|
74
|
-
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
75
|
-
}
|
|
76
|
-
if (styles) {
|
|
77
|
-
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
85
|
export {
|
|
86
|
+
createEl,
|
|
87
|
+
assignEl,
|
|
88
|
+
getActiveEl,
|
|
82
89
|
parseKeyCombo,
|
|
83
90
|
stringifyKeyEvent,
|
|
84
91
|
cleanKeyCombo,
|
|
@@ -87,7 +94,5 @@ export {
|
|
|
87
94
|
keyEventAllowed,
|
|
88
95
|
formatKeyForDisplay,
|
|
89
96
|
formatKeyShortcutsForDisplay,
|
|
90
|
-
parseForARIAKS
|
|
91
|
-
createEl,
|
|
92
|
-
assignEl
|
|
97
|
+
parseForARIAKS
|
|
93
98
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
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,
|
|
10
10
|
keyEventAllowed,
|
|
11
11
|
parseForARIAKS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RI45W4O6.js";
|
|
13
13
|
import {
|
|
14
14
|
CTX,
|
|
15
15
|
NIL,
|
|
@@ -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) {
|