sia-reactor 0.0.40 → 0.0.42
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/{TimeTravelConsole-BjDL0JjZ.d.ts → TimeTravelConsole-Bo83b1S5.d.ts} +2 -2
- package/dist/{TimeTravelConsole-Dt8txKnt.d.cts → TimeTravelConsole-DPJf_Ee7.d.cts} +2 -2
- package/dist/adapters/react.cjs +30 -24
- 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 +30 -24
- 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-ORK3EGB6.js → chunk-4SGW3Y6X.js} +18 -12
- package/dist/{chunk-ENEEV334.js → chunk-4U7VB3JS.js} +3 -3
- package/dist/{chunk-KPJ5SPXP.js → chunk-BOBAOEKS.js} +2 -2
- package/dist/{chunk-LZJYX2LE.js → chunk-GH5QAGIC.js} +16 -16
- package/dist/{index-C_djeddc.d.cts → index-B55979dE.d.cts} +1 -1
- package/dist/{index-BtHNGnRR.d.cts → index-C4Z3aveO.d.cts} +10 -10
- package/dist/{index-BtHNGnRR.d.ts → index-C4Z3aveO.d.ts} +10 -10
- package/dist/{index-CKHoDs6x.d.ts → index-DN85zmt_.d.ts} +1 -1
- package/dist/index.cjs +13 -13
- 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 -14
- package/dist/modules.d.cts +4 -4
- package/dist/modules.d.ts +4 -4
- package/dist/modules.js +3 -3
- package/dist/super.d.ts +17 -13
- package/dist/super.global.js +34 -28
- package/dist/utils.cjs +34 -28
- package/dist/utils.d.cts +8 -4
- package/dist/utils.d.ts +8 -4
- package/dist/utils.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Reactive } from './index-
|
|
2
|
-
import { T as TimeTravelModule } from './index-
|
|
1
|
+
import { R as Reactive } from './index-C4Z3aveO.js';
|
|
2
|
+
import { T as TimeTravelModule } from './index-DN85zmt_.js';
|
|
3
3
|
|
|
4
4
|
/** Reactive options for the TimeTravel overlay instance. */
|
|
5
5
|
interface TimeTravelConsoleConfig {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Reactive } from './index-
|
|
2
|
-
import { T as TimeTravelModule } from './index-
|
|
1
|
+
import { R as Reactive } from './index-C4Z3aveO.cjs';
|
|
2
|
+
import { T as TimeTravelModule } from './index-B55979dE.cjs';
|
|
3
3
|
|
|
4
4
|
/** Reactive options for the TimeTravel overlay instance. */
|
|
5
5
|
interface TimeTravelConsoleConfig {
|
package/dist/adapters/react.cjs
CHANGED
|
@@ -95,12 +95,12 @@ function canHandle(obj, config = CTX.defaults, typecheck = true) {
|
|
|
95
95
|
if (config.preserveContext) return !(obj instanceof String) && !(obj instanceof Number) && !(obj instanceof Function) && !(obj instanceof Date) && !(obj instanceof Error) && !(obj instanceof RegExp) && !(obj instanceof Promise) && !(obj instanceof Map) && !(obj instanceof WeakMap) && !(obj instanceof Set) && !(obj instanceof WeakSet) && !(obj instanceof EventTarget);
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
|
-
function getPath(source, key, separator = ".",
|
|
98
|
+
function getPath(source, key, separator = ".", keyFn) {
|
|
99
99
|
if (key === "*") return source;
|
|
100
100
|
const keys2 = key.split(separator);
|
|
101
101
|
let currObj = source;
|
|
102
102
|
for (let i = 0, len = keys2.length; i < len; i++) {
|
|
103
|
-
const key2 =
|
|
103
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
104
104
|
if (match) {
|
|
105
105
|
const [, key3, iStr] = match;
|
|
106
106
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return currObj[key3];
|
|
@@ -112,11 +112,11 @@ function getPath(source, key, separator = ".", keyFunc) {
|
|
|
112
112
|
}
|
|
113
113
|
return currObj;
|
|
114
114
|
}
|
|
115
|
-
function setPath(target, key, value, separator = ".",
|
|
115
|
+
function setPath(target, key, value, separator = ".", keyFn) {
|
|
116
116
|
if (key === "*") return Object.assign(target, value);
|
|
117
117
|
const keys2 = key.split(separator);
|
|
118
118
|
for (let currObj = target, i = 0, len = keys2.length; i < len; i++) {
|
|
119
|
-
const key2 =
|
|
119
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
120
120
|
if (match) {
|
|
121
121
|
const [, key3, iStr] = match;
|
|
122
122
|
if (!Array.isArray(currObj[key3])) currObj[key3] = [];
|
|
@@ -128,7 +128,7 @@ function setPath(target, key, value, separator = ".", keyFunc) {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function deletePath(target, key, separator = ".",
|
|
131
|
+
function deletePath(target, key, separator = ".", keyFn) {
|
|
132
132
|
if (key === "*") {
|
|
133
133
|
const keys3 = Object.keys(target);
|
|
134
134
|
for (let i = 0, len = keys3.length; i < len; i++) delete target[keys3[i]];
|
|
@@ -136,7 +136,7 @@ function deletePath(target, key, separator = ".", keyFunc) {
|
|
|
136
136
|
}
|
|
137
137
|
const keys2 = key.split(separator);
|
|
138
138
|
for (let currObj = target, i = 0, len = keys2.length; i < len; i++) {
|
|
139
|
-
const key2 =
|
|
139
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
140
140
|
if (match) {
|
|
141
141
|
const [, key3, iStr] = match;
|
|
142
142
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return;
|
|
@@ -149,11 +149,11 @@ function deletePath(target, key, separator = ".", keyFunc) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
function hasPath(source, key, separator = ".",
|
|
152
|
+
function hasPath(source, key, separator = ".", keyFn) {
|
|
153
153
|
if (key === "*") return true;
|
|
154
154
|
const keys2 = key.split(separator);
|
|
155
155
|
for (let currObj = source, i = 0, len = keys2.length; i < len; i++) {
|
|
156
|
-
const key2 =
|
|
156
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
157
157
|
if (match) {
|
|
158
158
|
const [, key3, iStr] = match;
|
|
159
159
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return false;
|
|
@@ -515,7 +515,7 @@ var Reactor = class {
|
|
|
515
515
|
if (cord._dead) continue;
|
|
516
516
|
const response = isGet ? cord.cb(value, payload) : isSet ? cord.cb(value, terminated, payload) : cord.cb(terminated, payload);
|
|
517
517
|
if (isGet || !(terminated ||= payload.terminated = response === TERMINATOR)) value = response;
|
|
518
|
-
if (cord.once) cord._dead = true
|
|
518
|
+
if (cord.once) killed = cord._dead = true;
|
|
519
519
|
}
|
|
520
520
|
if (killed) {
|
|
521
521
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && mediators.delete(path);
|
|
@@ -531,7 +531,7 @@ var Reactor = class {
|
|
|
531
531
|
const cord = scords[i];
|
|
532
532
|
if (cord._dead) continue;
|
|
533
533
|
cord.cb(payload.target.value, payload);
|
|
534
|
-
if (cord.once) cord._dead = true
|
|
534
|
+
if (cord.once) killed = cord._dead = true;
|
|
535
535
|
}
|
|
536
536
|
if (killed) {
|
|
537
537
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && this.watchers.delete(path);
|
|
@@ -543,7 +543,7 @@ var Reactor = class {
|
|
|
543
543
|
const wildcord = wildscords[i];
|
|
544
544
|
if (wildcord._dead) continue;
|
|
545
545
|
wildcord.cb(payload.target.value, payload);
|
|
546
|
-
if (wildcord.once) wildcord._dead = true
|
|
546
|
+
if (wildcord.once) killed = wildcord._dead = true;
|
|
547
547
|
}
|
|
548
548
|
if (killed) {
|
|
549
549
|
for (let i = wildcords.length - 1; i >= 0; i--) if (wildcords[i]._dead) wildcords.splice(i, 1), !wildcords.length && this.watchers.delete("*");
|
|
@@ -599,7 +599,7 @@ var Reactor = class {
|
|
|
599
599
|
if (tDepth > cord.lDepth + cord.depth) continue;
|
|
600
600
|
}
|
|
601
601
|
cord.cb(e);
|
|
602
|
-
if (cord.once) cord._dead = true
|
|
602
|
+
if (cord.once) killed = cord._dead = true;
|
|
603
603
|
}
|
|
604
604
|
if (killed) {
|
|
605
605
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && this.listeners.delete(path);
|
|
@@ -607,7 +607,7 @@ var Reactor = class {
|
|
|
607
607
|
}
|
|
608
608
|
/**
|
|
609
609
|
* Flushes queued listener payloads.
|
|
610
|
-
* @param paths Optional path
|
|
610
|
+
* @param paths Optional path(s) to flush.
|
|
611
611
|
* @example
|
|
612
612
|
* rtr.tick(); // to flush all paths in batch or pass "*" wildcard
|
|
613
613
|
* @example
|
|
@@ -1159,9 +1159,9 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
return el;
|
|
1161
1161
|
}
|
|
1162
|
-
function getActiveEl(root) {
|
|
1162
|
+
function getActiveEl(root, noBody = true) {
|
|
1163
1163
|
const activeEl = (root ?? document).activeElement;
|
|
1164
|
-
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1164
|
+
return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1165
1165
|
}
|
|
1166
1166
|
|
|
1167
1167
|
// src/ts/utils/keys.ts
|
|
@@ -1185,24 +1185,30 @@ function cleanKeyCombo(combo) {
|
|
|
1185
1185
|
};
|
|
1186
1186
|
return Array.isArray(combo) ? combo.map(clean) : clean(combo);
|
|
1187
1187
|
}
|
|
1188
|
-
function matchKeys(required, actual, strict = false) {
|
|
1189
|
-
actual = cleanKeyCombo(actual);
|
|
1188
|
+
function matchKeys(required, actual, strict = false, cleaned = false) {
|
|
1189
|
+
if (!cleaned) actual = cleanKeyCombo(actual);
|
|
1190
1190
|
const match = (required2, actual2) => {
|
|
1191
|
-
required2 = cleanKeyCombo(required2);
|
|
1191
|
+
if (!cleaned) required2 = cleanKeyCombo(required2);
|
|
1192
1192
|
if (strict) return required2 === actual2;
|
|
1193
|
-
const
|
|
1194
|
-
return
|
|
1193
|
+
const actualKeys = actual2.split("+");
|
|
1194
|
+
return required2.split("+").every((k) => actualKeys.includes(k));
|
|
1195
1195
|
};
|
|
1196
|
-
return Array.isArray(required) ? required.some((
|
|
1196
|
+
return Array.isArray(required) ? required.some((required2) => match(required2, actual)) : match(required, actual);
|
|
1197
1197
|
}
|
|
1198
1198
|
function getTermsForKey(combo, settings) {
|
|
1199
|
-
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [],
|
|
1199
|
+
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: s = false, rankedMatch = true, whitelist = [] } = settings || {};
|
|
1200
1200
|
combo = cleanKeyCombo(combo);
|
|
1201
1201
|
if (matchKeys(overrides, combo, s)) terms.override = true;
|
|
1202
1202
|
if (matchKeys(blocks, combo, s)) terms.block = true;
|
|
1203
1203
|
if (matchKeys(whitelist, combo)) terms.whitelisted = true;
|
|
1204
|
-
terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null;
|
|
1205
|
-
|
|
1204
|
+
if (!rankedMatch) return terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null, terms;
|
|
1205
|
+
let bestA = null, bestE = false, bestL = 0;
|
|
1206
|
+
for (const action of Object.keys(shortcuts))
|
|
1207
|
+
for (const c of Array.isArray(shortcuts[action]) ? shortcuts[action] : [shortcuts[action]]) {
|
|
1208
|
+
const required = cleanKeyCombo(c), isE = required === combo, len = required.split("+").length;
|
|
1209
|
+
if (matchKeys(required, combo, s, true) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = action, bestE = isE, bestL = len;
|
|
1210
|
+
}
|
|
1211
|
+
return terms.action = bestA, terms;
|
|
1206
1212
|
}
|
|
1207
1213
|
function keyEventAllowed(e, settings) {
|
|
1208
1214
|
if (settings.disabled) return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as EffectOptions, d as Reactor, R as Reactive, J as ReactorBuild, K as DeepReadonly, W as WildPaths, a as PathValue } from '../index-
|
|
1
|
+
import { E as EffectOptions, d as Reactor, R as Reactive, J as ReactorBuild, K as DeepReadonly, W as WildPaths, a as PathValue } from '../index-C4Z3aveO.cjs';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { T as TimeTravelModule } from '../index-
|
|
4
|
-
import { a as TimeTravelConsoleConfig } from '../TimeTravelConsole-
|
|
3
|
+
import { T as TimeTravelModule } from '../index-B55979dE.cjs';
|
|
4
|
+
import { a as TimeTravelConsoleConfig } from '../TimeTravelConsole-DPJf_Ee7.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, d as Reactor, R as Reactive, J as ReactorBuild, K as DeepReadonly, W as WildPaths, a as PathValue } from '../index-
|
|
1
|
+
import { E as EffectOptions, d as Reactor, R as Reactive, J as ReactorBuild, K as DeepReadonly, W as WildPaths, a as PathValue } from '../index-C4Z3aveO.js';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { T as TimeTravelModule } from '../index-
|
|
4
|
-
import { a as TimeTravelConsoleConfig } from '../TimeTravelConsole-
|
|
3
|
+
import { T as TimeTravelModule } from '../index-DN85zmt_.js';
|
|
4
|
+
import { a as TimeTravelConsoleConfig } from '../TimeTravelConsole-Bo83b1S5.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Subscribes a component to desired Reactor state and returns it.
|
package/dist/adapters/react.js
CHANGED
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
Autotracker,
|
|
3
3
|
TimeTravelConsole,
|
|
4
4
|
withTracker
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-4U7VB3JS.js";
|
|
6
|
+
import "../chunk-BOBAOEKS.js";
|
|
7
|
+
import "../chunk-4SGW3Y6X.js";
|
|
8
8
|
import {
|
|
9
9
|
CTX,
|
|
10
10
|
NIL,
|
|
11
11
|
NOOP,
|
|
12
12
|
getPath,
|
|
13
13
|
getReactor
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-GH5QAGIC.js";
|
|
15
15
|
|
|
16
16
|
// src/ts/adapters/react/hooks/useReactor.ts
|
|
17
17
|
import { useRef, useCallback, useSyncExternalStore, useMemo } from "react";
|
|
@@ -385,7 +385,7 @@ var Reactor = class {
|
|
|
385
385
|
if (cord._dead) continue;
|
|
386
386
|
const response = isGet ? cord.cb(value, payload) : isSet ? cord.cb(value, terminated, payload) : cord.cb(terminated, payload);
|
|
387
387
|
if (isGet || !(terminated ||= payload.terminated = response === TERMINATOR)) value = response;
|
|
388
|
-
if (cord.once) cord._dead = true
|
|
388
|
+
if (cord.once) killed = cord._dead = true;
|
|
389
389
|
}
|
|
390
390
|
if (killed) {
|
|
391
391
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && mediators.delete(path);
|
|
@@ -401,7 +401,7 @@ var Reactor = class {
|
|
|
401
401
|
const cord = scords[i];
|
|
402
402
|
if (cord._dead) continue;
|
|
403
403
|
cord.cb(payload.target.value, payload);
|
|
404
|
-
if (cord.once) cord._dead = true
|
|
404
|
+
if (cord.once) killed = cord._dead = true;
|
|
405
405
|
}
|
|
406
406
|
if (killed) {
|
|
407
407
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && this.watchers.delete(path);
|
|
@@ -413,7 +413,7 @@ var Reactor = class {
|
|
|
413
413
|
const wildcord = wildscords[i];
|
|
414
414
|
if (wildcord._dead) continue;
|
|
415
415
|
wildcord.cb(payload.target.value, payload);
|
|
416
|
-
if (wildcord.once) wildcord._dead = true
|
|
416
|
+
if (wildcord.once) killed = wildcord._dead = true;
|
|
417
417
|
}
|
|
418
418
|
if (killed) {
|
|
419
419
|
for (let i = wildcords.length - 1; i >= 0; i--) if (wildcords[i]._dead) wildcords.splice(i, 1), !wildcords.length && this.watchers.delete("*");
|
|
@@ -469,7 +469,7 @@ var Reactor = class {
|
|
|
469
469
|
if (tDepth > cord.lDepth + cord.depth) continue;
|
|
470
470
|
}
|
|
471
471
|
cord.cb(e);
|
|
472
|
-
if (cord.once) cord._dead = true
|
|
472
|
+
if (cord.once) killed = cord._dead = true;
|
|
473
473
|
}
|
|
474
474
|
if (killed) {
|
|
475
475
|
for (let i = cords.length - 1; i >= 0; i--) if (cords[i]._dead) cords.splice(i, 1), !cords.length && this.listeners.delete(path);
|
|
@@ -477,7 +477,7 @@ var Reactor = class {
|
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
479
|
* Flushes queued listener payloads.
|
|
480
|
-
* @param paths Optional path
|
|
480
|
+
* @param paths Optional path(s) to flush.
|
|
481
481
|
* @example
|
|
482
482
|
* rtr.tick(); // to flush all paths in batch or pass "*" wildcard
|
|
483
483
|
* @example
|
|
@@ -791,12 +791,12 @@ function canHandle(obj, config = CTX.defaults, typecheck = true) {
|
|
|
791
791
|
if (config.preserveContext) return !(obj instanceof String) && !(obj instanceof Number) && !(obj instanceof Function) && !(obj instanceof Date) && !(obj instanceof Error) && !(obj instanceof RegExp) && !(obj instanceof Promise) && !(obj instanceof Map) && !(obj instanceof WeakMap) && !(obj instanceof Set) && !(obj instanceof WeakSet) && !(obj instanceof EventTarget);
|
|
792
792
|
return false;
|
|
793
793
|
}
|
|
794
|
-
function getPath(source, key, separator = ".",
|
|
794
|
+
function getPath(source, key, separator = ".", keyFn) {
|
|
795
795
|
if (key === "*") return source;
|
|
796
796
|
const keys2 = key.split(separator);
|
|
797
797
|
let currObj = source;
|
|
798
798
|
for (let i = 0, len = keys2.length; i < len; i++) {
|
|
799
|
-
const key2 =
|
|
799
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
800
800
|
if (match) {
|
|
801
801
|
const [, key3, iStr] = match;
|
|
802
802
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return currObj[key3];
|
|
@@ -808,11 +808,11 @@ function getPath(source, key, separator = ".", keyFunc) {
|
|
|
808
808
|
}
|
|
809
809
|
return currObj;
|
|
810
810
|
}
|
|
811
|
-
function setPath(target, key, value, separator = ".",
|
|
811
|
+
function setPath(target, key, value, separator = ".", keyFn) {
|
|
812
812
|
if (key === "*") return Object.assign(target, value);
|
|
813
813
|
const keys2 = key.split(separator);
|
|
814
814
|
for (let currObj = target, i = 0, len = keys2.length; i < len; i++) {
|
|
815
|
-
const key2 =
|
|
815
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
816
816
|
if (match) {
|
|
817
817
|
const [, key3, iStr] = match;
|
|
818
818
|
if (!Array.isArray(currObj[key3])) currObj[key3] = [];
|
|
@@ -824,7 +824,7 @@ function setPath(target, key, value, separator = ".", keyFunc) {
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
|
-
function deletePath(target, key, separator = ".",
|
|
827
|
+
function deletePath(target, key, separator = ".", keyFn) {
|
|
828
828
|
if (key === "*") {
|
|
829
829
|
const keys3 = Object.keys(target);
|
|
830
830
|
for (let i = 0, len = keys3.length; i < len; i++) delete target[keys3[i]];
|
|
@@ -832,7 +832,7 @@ function deletePath(target, key, separator = ".", keyFunc) {
|
|
|
832
832
|
}
|
|
833
833
|
const keys2 = key.split(separator);
|
|
834
834
|
for (let currObj = target, i = 0, len = keys2.length; i < len; i++) {
|
|
835
|
-
const key2 =
|
|
835
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
836
836
|
if (match) {
|
|
837
837
|
const [, key3, iStr] = match;
|
|
838
838
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return;
|
|
@@ -845,11 +845,11 @@ function deletePath(target, key, separator = ".", keyFunc) {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
function hasPath(source, key, separator = ".",
|
|
848
|
+
function hasPath(source, key, separator = ".", keyFn) {
|
|
849
849
|
if (key === "*") return true;
|
|
850
850
|
const keys2 = key.split(separator);
|
|
851
851
|
for (let currObj = source, i = 0, len = keys2.length; i < len; i++) {
|
|
852
|
-
const key2 =
|
|
852
|
+
const key2 = keyFn ? keyFn(keys2[i]) : keys2[i], match = key2.includes("[") && key2.match(arrRegex);
|
|
853
853
|
if (match) {
|
|
854
854
|
const [, key3, iStr] = match;
|
|
855
855
|
if (!Array.isArray(currObj[key3]) || !(key3 in currObj)) return false;
|
|
@@ -1079,9 +1079,9 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
return el;
|
|
1081
1081
|
}
|
|
1082
|
-
function getActiveEl(root) {
|
|
1082
|
+
function getActiveEl(root, noBody = true) {
|
|
1083
1083
|
const activeEl = (root ?? document).activeElement;
|
|
1084
|
-
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1084
|
+
return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
1087
|
// src/ts/utils/keys.ts
|
|
@@ -1105,24 +1105,30 @@ function cleanKeyCombo(combo) {
|
|
|
1105
1105
|
};
|
|
1106
1106
|
return Array.isArray(combo) ? combo.map(clean) : clean(combo);
|
|
1107
1107
|
}
|
|
1108
|
-
function matchKeys(required, actual, strict = false) {
|
|
1109
|
-
actual = cleanKeyCombo(actual);
|
|
1108
|
+
function matchKeys(required, actual, strict = false, cleaned = false) {
|
|
1109
|
+
if (!cleaned) actual = cleanKeyCombo(actual);
|
|
1110
1110
|
const match = (required2, actual2) => {
|
|
1111
|
-
required2 = cleanKeyCombo(required2);
|
|
1111
|
+
if (!cleaned) required2 = cleanKeyCombo(required2);
|
|
1112
1112
|
if (strict) return required2 === actual2;
|
|
1113
|
-
const
|
|
1114
|
-
return
|
|
1113
|
+
const actualKeys = actual2.split("+");
|
|
1114
|
+
return required2.split("+").every((k) => actualKeys.includes(k));
|
|
1115
1115
|
};
|
|
1116
|
-
return Array.isArray(required) ? required.some((
|
|
1116
|
+
return Array.isArray(required) ? required.some((required2) => match(required2, actual)) : match(required, actual);
|
|
1117
1117
|
}
|
|
1118
1118
|
function getTermsForKey(combo, settings) {
|
|
1119
|
-
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [],
|
|
1119
|
+
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: s = false, rankedMatch = true, whitelist = [] } = settings || {};
|
|
1120
1120
|
combo = cleanKeyCombo(combo);
|
|
1121
1121
|
if (matchKeys(overrides, combo, s)) terms.override = true;
|
|
1122
1122
|
if (matchKeys(blocks, combo, s)) terms.block = true;
|
|
1123
1123
|
if (matchKeys(whitelist, combo)) terms.whitelisted = true;
|
|
1124
|
-
terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null;
|
|
1125
|
-
|
|
1124
|
+
if (!rankedMatch) return terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null, terms;
|
|
1125
|
+
let bestA = null, bestE = false, bestL = 0;
|
|
1126
|
+
for (const action of Object.keys(shortcuts))
|
|
1127
|
+
for (const c of Array.isArray(shortcuts[action]) ? shortcuts[action] : [shortcuts[action]]) {
|
|
1128
|
+
const required = cleanKeyCombo(c), isE = required === combo, len = required.split("+").length;
|
|
1129
|
+
if (matchKeys(required, combo, s, true) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = action, bestE = isE, bestL = len;
|
|
1130
|
+
}
|
|
1131
|
+
return terms.action = bestA, terms;
|
|
1126
1132
|
}
|
|
1127
1133
|
function keyEventAllowed(e, settings) {
|
|
1128
1134
|
if (settings.disabled) return false;
|
|
@@ -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 TimeTravelConsole, a as TimeTravelConsoleConfig } from '../TimeTravelConsole-
|
|
4
|
-
import '../index-
|
|
1
|
+
import { E as EffectOptions } from '../index-C4Z3aveO.cjs';
|
|
2
|
+
export { A as Autotracker, w as withTracker } from '../index-C4Z3aveO.cjs';
|
|
3
|
+
export { T as TimeTravelConsole, a as TimeTravelConsoleConfig } from '../TimeTravelConsole-DPJf_Ee7.cjs';
|
|
4
|
+
import '../index-B55979dE.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 TimeTravelConsole, a as TimeTravelConsoleConfig } from '../TimeTravelConsole-
|
|
4
|
-
import '../index-
|
|
1
|
+
import { E as EffectOptions } from '../index-C4Z3aveO.js';
|
|
2
|
+
export { A as Autotracker, w as withTracker } from '../index-C4Z3aveO.js';
|
|
3
|
+
export { T as TimeTravelConsole, a as TimeTravelConsoleConfig } from '../TimeTravelConsole-Bo83b1S5.js';
|
|
4
|
+
import '../index-DN85zmt_.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
|
TimeTravelConsole,
|
|
4
4
|
effect,
|
|
5
5
|
withTracker
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-4U7VB3JS.js";
|
|
7
|
+
import "../chunk-BOBAOEKS.js";
|
|
8
|
+
import "../chunk-4SGW3Y6X.js";
|
|
9
|
+
import "../chunk-GH5QAGIC.js";
|
|
10
10
|
export {
|
|
11
11
|
Autotracker,
|
|
12
12
|
TimeTravelConsole,
|
|
@@ -54,16 +54,16 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
|
|
|
54
54
|
}
|
|
55
55
|
return el;
|
|
56
56
|
}
|
|
57
|
-
function getActiveEl(root) {
|
|
57
|
+
function getActiveEl(root, noBody = true) {
|
|
58
58
|
const activeEl = (root ?? document).activeElement;
|
|
59
|
-
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
59
|
+
return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/ts/utils/keys.ts
|
|
63
63
|
var KEYS_BLOCKS = ["Ctrl+Tab", "Ctrl+Shift+Tab", "Ctrl+PageUp", "Ctrl+PageDown", "Cmd+Option+ArrowRight", "Cmd+Option+ArrowLeft", "Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Ctrl+5", "Ctrl+6", "Ctrl+7", "Ctrl+8", "Ctrl+9", "Cmd+1", "Cmd+2", "Cmd+3", "Cmd+4", "Cmd+5", "Cmd+6", "Cmd+7", "Cmd+8", "Cmd+9", "Alt+ArrowLeft", "Alt+ArrowRight", "Cmd+ArrowLeft", "Cmd+ArrowRight", "Ctrl+r", "Ctrl+Shift+r", "F5", "Shift+F5", "Cmd+r", "Cmd+Shift+r", "Ctrl+h", "Ctrl+j", "Ctrl+d", "Ctrl+f", "Cmd+y", "Cmd+Option+b", "Cmd+d", "Cmd+f", "Ctrl+Shift+i", "Ctrl+Shift+j", "Ctrl+Shift+c", "Ctrl+u", "F12", "Cmd+Option+i", "Cmd+Option+j", "Cmd+Option+c", "Cmd+Option+u", "Ctrl+=", "Ctrl+-", "Ctrl+0", "Cmd+=", "Cmd+-", "Cmd+0", "Ctrl+p", "Ctrl+s", "Ctrl+o", "Cmd+p", "Cmd+s", "Cmd+o"];
|
|
64
64
|
function parseKeyCombo(combo) {
|
|
65
65
|
const parts = cleanKeyCombo(combo).toLowerCase().split("+");
|
|
66
|
-
return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) =>
|
|
66
|
+
return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !/^(ctrl|shift|alt|meta|cmd)$/.test(p)) || "" };
|
|
67
67
|
}
|
|
68
68
|
function stringifyKeyEvent(e) {
|
|
69
69
|
const parts = [];
|
|
@@ -84,24 +84,30 @@ function cleanKeyCombo(combo) {
|
|
|
84
84
|
};
|
|
85
85
|
return Array.isArray(combo) ? combo.map(clean) : clean(combo);
|
|
86
86
|
}
|
|
87
|
-
function matchKeys(required, actual, strict = false) {
|
|
88
|
-
actual = cleanKeyCombo(actual);
|
|
87
|
+
function matchKeys(required, actual, strict = false, cleaned = false) {
|
|
88
|
+
if (!cleaned) actual = cleanKeyCombo(actual);
|
|
89
89
|
const match = (required2, actual2) => {
|
|
90
|
-
required2 = cleanKeyCombo(required2);
|
|
90
|
+
if (!cleaned) required2 = cleanKeyCombo(required2);
|
|
91
91
|
if (strict) return required2 === actual2;
|
|
92
|
-
const
|
|
93
|
-
return
|
|
92
|
+
const actualKeys = actual2.split("+");
|
|
93
|
+
return required2.split("+").every((k) => actualKeys.includes(k));
|
|
94
94
|
};
|
|
95
|
-
return Array.isArray(required) ? required.some((
|
|
95
|
+
return Array.isArray(required) ? required.some((required2) => match(required2, actual)) : match(required, actual);
|
|
96
96
|
}
|
|
97
97
|
function getTermsForKey(combo, settings) {
|
|
98
|
-
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [],
|
|
98
|
+
const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: s = false, rankedMatch = true, whitelist = [] } = settings || {};
|
|
99
99
|
combo = cleanKeyCombo(combo);
|
|
100
100
|
if (matchKeys(overrides, combo, s)) terms.override = true;
|
|
101
101
|
if (matchKeys(blocks, combo, s)) terms.block = true;
|
|
102
102
|
if (matchKeys(whitelist, combo)) terms.whitelisted = true;
|
|
103
|
-
terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null;
|
|
104
|
-
|
|
103
|
+
if (!rankedMatch) return terms.action = Object.keys(shortcuts).find((key) => matchKeys(shortcuts[key], combo, s)) || null, terms;
|
|
104
|
+
let bestA = null, bestE = false, bestL = 0;
|
|
105
|
+
for (const action of Object.keys(shortcuts))
|
|
106
|
+
for (const c of Array.isArray(shortcuts[action]) ? shortcuts[action] : [shortcuts[action]]) {
|
|
107
|
+
const required = cleanKeyCombo(c), isE = required === combo, len = required.split("+").length;
|
|
108
|
+
if (matchKeys(required, combo, s, true) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = action, bestE = isE, bestL = len;
|
|
109
|
+
}
|
|
110
|
+
return terms.action = bestA, terms;
|
|
105
111
|
}
|
|
106
112
|
function keyEventAllowed(e, settings) {
|
|
107
113
|
if (settings.disabled) return false;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
wpArr
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BOBAOEKS.js";
|
|
4
4
|
import {
|
|
5
5
|
KEYS_BLOCKS,
|
|
6
6
|
createEl,
|
|
7
7
|
formatKeyForDisplay,
|
|
8
8
|
keyEventAllowed,
|
|
9
9
|
parseForARIAKS
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4SGW3Y6X.js";
|
|
11
11
|
import {
|
|
12
12
|
CTX,
|
|
13
13
|
NIL,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
canHandle,
|
|
16
16
|
nuke,
|
|
17
17
|
reactive
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GH5QAGIC.js";
|
|
19
19
|
|
|
20
20
|
// src/ts/adapters/autotracker.ts
|
|
21
21
|
var Autotracker = class {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
guardAllMethods,
|
|
3
3
|
guardMethod
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4SGW3Y6X.js";
|
|
5
5
|
import {
|
|
6
6
|
getPath,
|
|
7
7
|
getReactor,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
nuke,
|
|
11
11
|
reactive,
|
|
12
12
|
setPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GH5QAGIC.js";
|
|
14
14
|
|
|
15
15
|
// src/ts/modules/base/index.ts
|
|
16
16
|
var BaseReactorModule = class {
|