sia-reactor 0.0.31 → 0.0.33
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/adapters/react.cjs +7 -4
- package/dist/adapters/react.js +4 -4
- package/dist/adapters/vanilla.cjs +24 -21
- package/dist/adapters/vanilla.js +4 -4
- package/dist/{chunk-AKQSBLBX.js → chunk-6HZSS2TX.js} +2 -3
- package/dist/{chunk-GD7HZBXA.js → chunk-QPJNSYXT.js} +1 -1
- package/dist/{chunk-RVYL3OLW.js → chunk-RI45W4O6.js} +26 -21
- package/dist/{chunk-UYRDN3OX.js → chunk-UXQ5NJIO.js} +3 -3
- package/dist/index.cjs +2 -3
- package/dist/index.js +1 -1
- package/dist/modules.cjs +2 -3
- package/dist/modules.js +2 -2
- package/dist/styles/time-travel-overlay.css +14 -13
- package/dist/super.d.ts +23 -2
- package/dist/super.global.js +25 -21
- package/dist/utils.cjs +24 -18
- package/dist/utils.d.cts +22 -2
- package/dist/utils.d.ts +22 -2
- package/dist/utils.js +3 -1
- package/package.json +1 -1
package/dist/adapters/react.cjs
CHANGED
|
@@ -666,9 +666,8 @@ var Reactor = class {
|
|
|
666
666
|
if (cord) return cord.clup;
|
|
667
667
|
let task;
|
|
668
668
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
669
|
-
immediate && onImmediate(immediate);
|
|
670
669
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
671
|
-
lazy ? this.stall(task) : task();
|
|
670
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
672
671
|
return this.bindSignal(cord, signal);
|
|
673
672
|
}
|
|
674
673
|
dropSync(store, path, cb) {
|
|
@@ -766,7 +765,7 @@ var Reactor = class {
|
|
|
766
765
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
767
766
|
*/
|
|
768
767
|
watch(path, callback, options) {
|
|
769
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
768
|
+
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
769
|
}
|
|
771
770
|
/** Registers a watcher for a path that only triggers once. */
|
|
772
771
|
wonce(path, callback, options) {
|
|
@@ -1132,6 +1131,10 @@ function assignEl(el, props, dataset, styles) {
|
|
|
1132
1131
|
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
1133
1132
|
}
|
|
1134
1133
|
}
|
|
1134
|
+
function getActiveEl(root) {
|
|
1135
|
+
const activeEl = (root ?? document).activeElement;
|
|
1136
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1137
|
+
}
|
|
1135
1138
|
|
|
1136
1139
|
// src/ts/utils/keys.ts
|
|
1137
1140
|
function stringifyKeyEvent(e) {
|
|
@@ -1173,7 +1176,7 @@ function getTermsForKey(combo, settings) {
|
|
|
1173
1176
|
return terms;
|
|
1174
1177
|
}
|
|
1175
1178
|
function keyEventAllowed(e, settings) {
|
|
1176
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
1179
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
1177
1180
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
1178
1181
|
if (block) return false;
|
|
1179
1182
|
if (override) e.preventDefault();
|
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-UXQ5NJIO.js";
|
|
6
6
|
import "../chunk-PLYS4CVP.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-QPJNSYXT.js";
|
|
8
8
|
import {
|
|
9
9
|
getReactor
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-6HZSS2TX.js";
|
|
11
|
+
import "../chunk-RI45W4O6.js";
|
|
12
12
|
import "../chunk-3OT72G7R.js";
|
|
13
13
|
import {
|
|
14
14
|
CTX,
|
|
@@ -654,9 +654,8 @@ var Reactor = class {
|
|
|
654
654
|
if (cord) return cord.clup;
|
|
655
655
|
let task;
|
|
656
656
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
657
|
-
immediate && onImmediate(immediate);
|
|
658
657
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
659
|
-
lazy ? this.stall(task) : task();
|
|
658
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
660
659
|
return this.bindSignal(cord, signal);
|
|
661
660
|
}
|
|
662
661
|
dropSync(store, path, cb) {
|
|
@@ -754,7 +753,7 @@ var Reactor = class {
|
|
|
754
753
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
755
754
|
*/
|
|
756
755
|
watch(path, callback, options) {
|
|
757
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
756
|
+
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
757
|
}
|
|
759
758
|
/** Registers a watcher for a path that only triggers once. */
|
|
760
759
|
wonce(path, callback, options) {
|
|
@@ -878,6 +877,27 @@ function getReactor(target, create = false, build) {
|
|
|
878
877
|
return (target instanceof Reactor ? target : target.__Reactor__) || (create ? new Reactor(target, build) : void 0);
|
|
879
878
|
}
|
|
880
879
|
|
|
880
|
+
// src/ts/utils/dom.ts
|
|
881
|
+
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
882
|
+
return assignEl(el, props, dataset, styles), el;
|
|
883
|
+
}
|
|
884
|
+
function assignEl(el, props, dataset, styles) {
|
|
885
|
+
if (!el) return;
|
|
886
|
+
if (props) {
|
|
887
|
+
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
888
|
+
}
|
|
889
|
+
if (dataset) {
|
|
890
|
+
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
891
|
+
}
|
|
892
|
+
if (styles) {
|
|
893
|
+
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function getActiveEl(root) {
|
|
897
|
+
const activeEl = (root ?? document).activeElement;
|
|
898
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
899
|
+
}
|
|
900
|
+
|
|
881
901
|
// src/ts/utils/keys.ts
|
|
882
902
|
function stringifyKeyEvent(e) {
|
|
883
903
|
const parts = [];
|
|
@@ -918,7 +938,7 @@ function getTermsForKey(combo, settings) {
|
|
|
918
938
|
return terms;
|
|
919
939
|
}
|
|
920
940
|
function keyEventAllowed(e, settings) {
|
|
921
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
941
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
922
942
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
923
943
|
if (block) return false;
|
|
924
944
|
if (override) e.preventDefault();
|
|
@@ -932,23 +952,6 @@ function parseForARIAKS(s, formatted = true) {
|
|
|
932
952
|
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
953
|
}
|
|
934
954
|
|
|
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
955
|
// src/ts/modules/base.ts
|
|
953
956
|
var wpArr = ["*"];
|
|
954
957
|
|
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-UXQ5NJIO.js";
|
|
7
7
|
import "../chunk-PLYS4CVP.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-QPJNSYXT.js";
|
|
9
|
+
import "../chunk-6HZSS2TX.js";
|
|
10
|
+
import "../chunk-RI45W4O6.js";
|
|
11
11
|
import "../chunk-3OT72G7R.js";
|
|
12
12
|
import "../chunk-EZ4VRGYI.js";
|
|
13
13
|
export {
|
|
@@ -510,9 +510,8 @@ var Reactor = class {
|
|
|
510
510
|
if (cord) return cord.clup;
|
|
511
511
|
let task;
|
|
512
512
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
513
|
-
immediate && onImmediate(immediate);
|
|
514
513
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
515
|
-
lazy ? this.stall(task) : task();
|
|
514
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
516
515
|
return this.bindSignal(cord, signal);
|
|
517
516
|
}
|
|
518
517
|
dropSync(store, path, cb) {
|
|
@@ -610,7 +609,7 @@ var Reactor = class {
|
|
|
610
609
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
611
610
|
*/
|
|
612
611
|
watch(path, callback, options) {
|
|
613
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
612
|
+
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
613
|
}
|
|
615
614
|
/** Registers a watcher for a path that only triggers once. */
|
|
616
615
|
wonce(path, callback, options) {
|
|
@@ -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-QPJNSYXT.js";
|
|
4
4
|
import {
|
|
5
5
|
reactive
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6HZSS2TX.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,
|
package/dist/index.cjs
CHANGED
|
@@ -679,9 +679,8 @@ var Reactor = class {
|
|
|
679
679
|
if (cord) return cord.clup;
|
|
680
680
|
let task;
|
|
681
681
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
682
|
-
immediate && onImmediate(immediate);
|
|
683
682
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
684
|
-
lazy ? this.stall(task) : task();
|
|
683
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
685
684
|
return this.bindSignal(cord, signal);
|
|
686
685
|
}
|
|
687
686
|
dropSync(store, path, cb) {
|
|
@@ -779,7 +778,7 @@ var Reactor = class {
|
|
|
779
778
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
780
779
|
*/
|
|
781
780
|
watch(path, callback, options) {
|
|
782
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
781
|
+
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
782
|
}
|
|
784
783
|
/** Registers a watcher for a path that only triggers once. */
|
|
785
784
|
wonce(path, callback, options) {
|
package/dist/index.js
CHANGED
package/dist/modules.cjs
CHANGED
|
@@ -716,9 +716,8 @@ var Reactor = class {
|
|
|
716
716
|
if (cord) return cord.clup;
|
|
717
717
|
let task;
|
|
718
718
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
719
|
-
immediate && onImmediate(immediate);
|
|
720
719
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
721
|
-
lazy ? this.stall(task) : task();
|
|
720
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
722
721
|
return this.bindSignal(cord, signal);
|
|
723
722
|
}
|
|
724
723
|
dropSync(store, path, cb) {
|
|
@@ -816,7 +815,7 @@ var Reactor = class {
|
|
|
816
815
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
817
816
|
*/
|
|
818
817
|
watch(path, callback, options) {
|
|
819
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
818
|
+
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
819
|
}
|
|
821
820
|
/** Registers a watcher for a path that only triggers once. */
|
|
822
821
|
wonce(path, callback, options) {
|
package/dist/modules.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
.tt-overlay-host {
|
|
2
2
|
--sia-tt-color: #e26e02;
|
|
3
|
-
--sia-
|
|
4
|
-
--sia-tt-bg
|
|
5
|
-
--sia-tt-
|
|
6
|
-
--sia-tt-
|
|
7
|
-
--sia-tt-
|
|
8
|
-
--sia-tt-
|
|
3
|
+
--sia-brand-color: rgb(from var(--sia-tt-color) r g b / 1);
|
|
4
|
+
--sia-tt-bg: rgb(from var(--sia-brand-color) calc((r * 0.09) + 6) calc((g * 0.08) + 7) calc((b * 0.1) + 10) / 0.66);
|
|
5
|
+
--sia-tt-bg-soft: rgb(from var(--sia-brand-color) calc((r * 0.11) + 9) calc((g * 0.1) + 9) calc((b * 0.12) + 12) / 0.64);
|
|
6
|
+
--sia-tt-line: hsl(from var(--sia-brand-color) h calc(s * 0.1) 24% / 0.6);
|
|
7
|
+
--sia-tt-text: rgb(from var(--sia-brand-color) calc((r * 0.2) + 218) calc((g * 0.11) + 214) calc((b * 0.09) + 214));
|
|
8
|
+
--sia-tt-muted: rgb(from var(--sia-brand-color) calc((r * 0.24) + 150) calc((g * 0.14) + 146) calc((b * 0.12) + 146));
|
|
9
|
+
--sia-tt-input-bg: rgb(from var(--sia-brand-color) calc((r * 0.08) + 8) calc((g * 0.07) + 8) calc((b * 0.09) + 10) / 0.66);
|
|
9
10
|
position: relative;
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -21,15 +22,15 @@
|
|
|
21
22
|
padding: 0;
|
|
22
23
|
margin: 0;
|
|
23
24
|
scrollbar-width: thin;
|
|
24
|
-
scrollbar-color: var(--sia-
|
|
25
|
+
scrollbar-color: var(--sia-brand-color) transparent;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
:where(.tt-overlay-host) *::selection {
|
|
28
29
|
color: currentColor;
|
|
29
|
-
background-color: var(--sia-
|
|
30
|
+
background-color: rgb(from var(--sia-brand-color) r g b / 0.25);
|
|
30
31
|
}
|
|
31
32
|
.tt-overlay-host :is(*:focus-visible, #o#o#o#o#o) {
|
|
32
|
-
outline: 1.5px dashed var(--sia-
|
|
33
|
+
outline: 1.5px dashed var(--sia-brand-color);
|
|
33
34
|
outline-offset: 1px;
|
|
34
35
|
transition: none;
|
|
35
36
|
}
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
.tt-overlay .title {
|
|
109
|
-
color: var(--sia-
|
|
110
|
+
color: var(--sia-brand-color);
|
|
110
111
|
font-weight: bold;
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -122,7 +123,7 @@
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
.tt-overlay button:hover {
|
|
125
|
-
border-color: hsl(from var(--sia-
|
|
126
|
+
border-color: hsl(from var(--sia-brand-color) h calc(s * 0.35) 40% / 0.9);
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
.tt-overlay button:disabled {
|
|
@@ -175,7 +176,7 @@
|
|
|
175
176
|
.tt-overlay input[type="range"] {
|
|
176
177
|
width: 100%;
|
|
177
178
|
height: 5px;
|
|
178
|
-
accent-color: var(--sia-
|
|
179
|
+
accent-color: var(--sia-brand-color);
|
|
179
180
|
border-radius: 8px;
|
|
180
181
|
}
|
|
181
182
|
|
|
@@ -218,7 +219,7 @@
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
.tt-footnote a {
|
|
221
|
-
color: var(--sia-
|
|
222
|
+
color: var(--sia-brand-color);
|
|
222
223
|
text-decoration: none;
|
|
223
224
|
border-bottom: 1px solid var(--sia-tt-line);
|
|
224
225
|
}
|
package/dist/super.d.ts
CHANGED
|
@@ -1365,7 +1365,7 @@ declare function getTermsForKey(combo: string, settings: keysSettings): {
|
|
|
1365
1365
|
*/
|
|
1366
1366
|
declare function keyEventAllowed(e: KeyboardEvent, settings: keysSettings): false | string;
|
|
1367
1367
|
/**
|
|
1368
|
-
* Formats one or many combos for human-readable UI labels.
|
|
1368
|
+
* Formats one or many combos for human-readable UI labels, prepends " " for fluid appending.
|
|
1369
1369
|
* @param combo Combo or combo list.
|
|
1370
1370
|
* @returns Display label (for example: `" (ctrl+z) or (meta+z)"`).
|
|
1371
1371
|
*/
|
|
@@ -1394,10 +1394,30 @@ declare function parseForARIAKS(s: string | string[], formatted?: boolean): stri
|
|
|
1394
1394
|
|
|
1395
1395
|
type Dataset = Record<string, string | number>;
|
|
1396
1396
|
type Style = Partial<CSSStyleDeclaration>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Creates an HTML element with the specified tag and properties.
|
|
1399
|
+
* @param tag The tag name of the element to create.
|
|
1400
|
+
* @param props Optional properties to set on the element.
|
|
1401
|
+
* @param dataset Optional dataset attributes for the element.
|
|
1402
|
+
* @param styles Optional CSS styles for the element.
|
|
1403
|
+
* @returns The created HTML element.
|
|
1404
|
+
*/
|
|
1397
1405
|
declare function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): HTMLElementTagNameMap[K];
|
|
1398
1406
|
declare function createEl(tag: string, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): HTMLElement | null;
|
|
1407
|
+
/**
|
|
1408
|
+
* Assigns properties, dataset attributes, and styles to an HTML element.
|
|
1409
|
+
* @param el The HTML element to assign properties to.
|
|
1410
|
+
* @param props Optional properties to set on the element.
|
|
1411
|
+
* @param dataset Optional dataset attributes for the element.
|
|
1412
|
+
* @param styles Optional CSS styles for the element.
|
|
1413
|
+
*/
|
|
1399
1414
|
declare function assignEl<K extends keyof HTMLElementTagNameMap>(el?: HTMLElementTagNameMap[K], props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): void;
|
|
1400
1415
|
declare function assignEl(el?: HTMLElement | null, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
|
|
1416
|
+
/** Get the currently active element, traversing into shadow roots if necessary.
|
|
1417
|
+
* @param root Root node to start searching from, defaults to the main document.
|
|
1418
|
+
* @returns The active element or null if none found.
|
|
1419
|
+
*/
|
|
1420
|
+
declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
|
|
1401
1421
|
|
|
1402
1422
|
type utils_FanoutTuple = FanoutTuple;
|
|
1403
1423
|
type utils_KeyStruct = KeyStruct;
|
|
@@ -1414,6 +1434,7 @@ declare const utils_fanout: typeof fanout;
|
|
|
1414
1434
|
declare const utils_fanoutOptsArr: typeof fanoutOptsArr;
|
|
1415
1435
|
declare const utils_formatKeyForDisplay: typeof formatKeyForDisplay;
|
|
1416
1436
|
declare const utils_formatKeyShortcutsForDisplay: typeof formatKeyShortcutsForDisplay;
|
|
1437
|
+
declare const utils_getActiveEl: typeof getActiveEl;
|
|
1417
1438
|
declare const utils_getAny: typeof getAny;
|
|
1418
1439
|
declare const utils_getTermsForKey: typeof getTermsForKey;
|
|
1419
1440
|
declare const utils_getTrailRecords: typeof getTrailRecords;
|
|
@@ -1438,7 +1459,7 @@ declare const utils_setInterval: typeof setInterval;
|
|
|
1438
1459
|
declare const utils_setTimeout: typeof setTimeout;
|
|
1439
1460
|
declare const utils_stringifyKeyEvent: typeof stringifyKeyEvent;
|
|
1440
1461
|
declare namespace utils {
|
|
1441
|
-
export { type utils_FanoutTuple as FanoutTuple, type utils_KeyStruct as KeyStruct, utils_arrRegex as arrRegex, utils_assignEl as assignEl, utils_bindAllMethods as bindAllMethods, utils_canHandle as canHandle, utils_clamp as clamp, utils_cleanKeyCombo as cleanKeyCombo, utils_createEl as createEl, utils_deepClone as deepClone, utils_deleteAny as deleteAny, utils_fanout as fanout, utils_fanoutOptsArr as fanoutOptsArr, utils_formatKeyForDisplay as formatKeyForDisplay, utils_formatKeyShortcutsForDisplay as formatKeyShortcutsForDisplay, utils_getAny as getAny, utils_getTermsForKey as getTermsForKey, utils_getTrailRecords as getTrailRecords, utils_guardAllMethods as guardAllMethods, utils_guardMethod as guardMethod, utils_inAny as inAny, utils_isObj as isObj, utils_isPOJO as isPOJO, utils_keyEventAllowed as keyEventAllowed, type utils_keysSettings as keysSettings, utils_matchKeys as matchKeys, utils_mergeObjs as mergeObjs, utils_nuke as nuke, utils_onAllMethods as onAllMethods, utils_parseAnyObj as parseAnyObj, utils_parseEvtOpts as parseEvtOpts, utils_parseForARIAKS as parseForARIAKS, utils_parseKeyCombo as parseKeyCombo, utils_requestAnimationFrame as requestAnimationFrame, utils_setAny as setAny, utils_setInterval as setInterval, utils_setTimeout as setTimeout, utils_stringifyKeyEvent as stringifyKeyEvent };
|
|
1462
|
+
export { type utils_FanoutTuple as FanoutTuple, type utils_KeyStruct as KeyStruct, utils_arrRegex as arrRegex, utils_assignEl as assignEl, utils_bindAllMethods as bindAllMethods, utils_canHandle as canHandle, utils_clamp as clamp, utils_cleanKeyCombo as cleanKeyCombo, utils_createEl as createEl, utils_deepClone as deepClone, utils_deleteAny as deleteAny, utils_fanout as fanout, utils_fanoutOptsArr as fanoutOptsArr, utils_formatKeyForDisplay as formatKeyForDisplay, utils_formatKeyShortcutsForDisplay as formatKeyShortcutsForDisplay, utils_getActiveEl as getActiveEl, utils_getAny as getAny, utils_getTermsForKey as getTermsForKey, utils_getTrailRecords as getTrailRecords, utils_guardAllMethods as guardAllMethods, utils_guardMethod as guardMethod, utils_inAny as inAny, utils_isObj as isObj, utils_isPOJO as isPOJO, utils_keyEventAllowed as keyEventAllowed, type utils_keysSettings as keysSettings, utils_matchKeys as matchKeys, utils_mergeObjs as mergeObjs, utils_nuke as nuke, utils_onAllMethods as onAllMethods, utils_parseAnyObj as parseAnyObj, utils_parseEvtOpts as parseEvtOpts, utils_parseForARIAKS as parseForARIAKS, utils_parseKeyCombo as parseKeyCombo, utils_requestAnimationFrame as requestAnimationFrame, utils_setAny as setAny, utils_setInterval as setInterval, utils_setTimeout as setTimeout, utils_stringifyKeyEvent as stringifyKeyEvent };
|
|
1442
1463
|
}
|
|
1443
1464
|
|
|
1444
1465
|
type JSONReplacer = ((this: any, key: string, value: any) => any) | (number | string)[] | null;
|
package/dist/super.global.js
CHANGED
|
@@ -743,9 +743,8 @@ var sia = (() => {
|
|
|
743
743
|
if (cord) return cord.clup;
|
|
744
744
|
let task;
|
|
745
745
|
cord = { cb, once, clup: () => (lazy && this.nostall(task), this[`no${key}`](path, cb)) };
|
|
746
|
-
immediate && onImmediate(immediate);
|
|
747
746
|
task = () => (cords ?? (store.set(path, cords = []), cords)).push(cord);
|
|
748
|
-
lazy ? this.stall(task) : task();
|
|
747
|
+
immediate && onImmediate(immediate), lazy ? this.stall(task) : task();
|
|
749
748
|
return this.bindSignal(cord, signal);
|
|
750
749
|
}
|
|
751
750
|
dropSync(store, path, cb) {
|
|
@@ -843,7 +842,7 @@ var sia = (() => {
|
|
|
843
842
|
* const cleanup = rtr.watch("user.name", (value) => console.log(value));
|
|
844
843
|
*/
|
|
845
844
|
watch(path, callback, options) {
|
|
846
|
-
return this.addSync("watch", path, callback, options, (imm) => imm !== "auto"
|
|
845
|
+
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
846
|
}
|
|
848
847
|
/** Registers a watcher for a path that only triggers once. */
|
|
849
848
|
wonce(path, callback, options) {
|
|
@@ -1019,6 +1018,7 @@ var sia = (() => {
|
|
|
1019
1018
|
fanoutOptsArr: () => fanoutOptsArr,
|
|
1020
1019
|
formatKeyForDisplay: () => formatKeyForDisplay,
|
|
1021
1020
|
formatKeyShortcutsForDisplay: () => formatKeyShortcutsForDisplay,
|
|
1021
|
+
getActiveEl: () => getActiveEl,
|
|
1022
1022
|
getAny: () => getAny,
|
|
1023
1023
|
getTermsForKey: () => getTermsForKey,
|
|
1024
1024
|
getTrailRecords: () => getTrailRecords,
|
|
@@ -1103,6 +1103,27 @@ var sia = (() => {
|
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
|
+
// src/ts/utils/dom.ts
|
|
1107
|
+
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
1108
|
+
return assignEl(el, props, dataset, styles), el;
|
|
1109
|
+
}
|
|
1110
|
+
function assignEl(el, props, dataset, styles) {
|
|
1111
|
+
if (!el) return;
|
|
1112
|
+
if (props) {
|
|
1113
|
+
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
1114
|
+
}
|
|
1115
|
+
if (dataset) {
|
|
1116
|
+
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
1117
|
+
}
|
|
1118
|
+
if (styles) {
|
|
1119
|
+
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
function getActiveEl(root) {
|
|
1123
|
+
const activeEl = (root ?? document).activeElement;
|
|
1124
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1106
1127
|
// src/ts/utils/keys.ts
|
|
1107
1128
|
function parseKeyCombo(combo) {
|
|
1108
1129
|
const parts = cleanKeyCombo(combo).toLowerCase().split("+");
|
|
@@ -1147,7 +1168,7 @@ var sia = (() => {
|
|
|
1147
1168
|
return terms;
|
|
1148
1169
|
}
|
|
1149
1170
|
function keyEventAllowed(e, settings) {
|
|
1150
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
1171
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
1151
1172
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
1152
1173
|
if (block) return false;
|
|
1153
1174
|
if (override) e.preventDefault();
|
|
@@ -1166,23 +1187,6 @@ var sia = (() => {
|
|
|
1166
1187
|
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();
|
|
1167
1188
|
}
|
|
1168
1189
|
|
|
1169
|
-
// src/ts/utils/dom.ts
|
|
1170
|
-
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
1171
|
-
return assignEl(el, props, dataset, styles), el;
|
|
1172
|
-
}
|
|
1173
|
-
function assignEl(el, props, dataset, styles) {
|
|
1174
|
-
if (!el) return;
|
|
1175
|
-
if (props) {
|
|
1176
|
-
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
1177
|
-
}
|
|
1178
|
-
if (dataset) {
|
|
1179
|
-
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
1180
|
-
}
|
|
1181
|
-
if (styles) {
|
|
1182
|
-
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
1190
|
// src/ts/modules.ts
|
|
1187
1191
|
var modules_exports = {};
|
|
1188
1192
|
__export(modules_exports, {
|
package/dist/utils.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(utils_exports, {
|
|
|
33
33
|
fanoutOptsArr: () => fanoutOptsArr,
|
|
34
34
|
formatKeyForDisplay: () => formatKeyForDisplay,
|
|
35
35
|
formatKeyShortcutsForDisplay: () => formatKeyShortcutsForDisplay,
|
|
36
|
+
getActiveEl: () => getActiveEl,
|
|
36
37
|
getAny: () => getAny,
|
|
37
38
|
getTermsForKey: () => getTermsForKey,
|
|
38
39
|
getTrailRecords: () => getTrailRecords,
|
|
@@ -309,6 +310,27 @@ function guardMethod(fn, onError = (e) => console.error(e)) {
|
|
|
309
310
|
});
|
|
310
311
|
}
|
|
311
312
|
|
|
313
|
+
// src/ts/utils/dom.ts
|
|
314
|
+
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
315
|
+
return assignEl(el, props, dataset, styles), el;
|
|
316
|
+
}
|
|
317
|
+
function assignEl(el, props, dataset, styles) {
|
|
318
|
+
if (!el) return;
|
|
319
|
+
if (props) {
|
|
320
|
+
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
321
|
+
}
|
|
322
|
+
if (dataset) {
|
|
323
|
+
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
324
|
+
}
|
|
325
|
+
if (styles) {
|
|
326
|
+
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function getActiveEl(root) {
|
|
330
|
+
const activeEl = (root ?? document).activeElement;
|
|
331
|
+
return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
|
|
332
|
+
}
|
|
333
|
+
|
|
312
334
|
// src/ts/utils/keys.ts
|
|
313
335
|
function parseKeyCombo(combo) {
|
|
314
336
|
const parts = cleanKeyCombo(combo).toLowerCase().split("+");
|
|
@@ -353,7 +375,7 @@ function getTermsForKey(combo, settings) {
|
|
|
353
375
|
return terms;
|
|
354
376
|
}
|
|
355
377
|
function keyEventAllowed(e, settings) {
|
|
356
|
-
if (settings.disabled || (e.key === " " || e.key === "Enter") && (e.target?.ownerDocument
|
|
378
|
+
if (settings.disabled || (e.key === " " || e.key === "Enter") && getActiveEl(e.target?.ownerDocument)?.matches("button,input,textarea,[contenteditable='true']")) return false;
|
|
357
379
|
const combo = stringifyKeyEvent(e), { override, block, action, whitelisted } = getTermsForKey(combo, settings);
|
|
358
380
|
if (block) return false;
|
|
359
381
|
if (override) e.preventDefault();
|
|
@@ -371,23 +393,6 @@ function parseForARIAKS(s, formatted = true) {
|
|
|
371
393
|
const m = { ctrl: "Control", cmd: "Meta", space: "Space", plus: "+" };
|
|
372
394
|
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();
|
|
373
395
|
}
|
|
374
|
-
|
|
375
|
-
// src/ts/utils/dom.ts
|
|
376
|
-
function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
|
|
377
|
-
return assignEl(el, props, dataset, styles), el;
|
|
378
|
-
}
|
|
379
|
-
function assignEl(el, props, dataset, styles) {
|
|
380
|
-
if (!el) return;
|
|
381
|
-
if (props) {
|
|
382
|
-
for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
|
|
383
|
-
}
|
|
384
|
-
if (dataset) {
|
|
385
|
-
for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
|
|
386
|
-
}
|
|
387
|
-
if (styles) {
|
|
388
|
-
for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
396
|
// Annotate the CommonJS export names for ESM import in node:
|
|
392
397
|
0 && (module.exports = {
|
|
393
398
|
arrRegex,
|
|
@@ -403,6 +408,7 @@ function assignEl(el, props, dataset, styles) {
|
|
|
403
408
|
fanoutOptsArr,
|
|
404
409
|
formatKeyForDisplay,
|
|
405
410
|
formatKeyShortcutsForDisplay,
|
|
411
|
+
getActiveEl,
|
|
406
412
|
getAny,
|
|
407
413
|
getTermsForKey,
|
|
408
414
|
getTrailRecords,
|
package/dist/utils.d.cts
CHANGED
|
@@ -141,7 +141,7 @@ declare function getTermsForKey(combo: string, settings: keysSettings): {
|
|
|
141
141
|
*/
|
|
142
142
|
declare function keyEventAllowed(e: KeyboardEvent, settings: keysSettings): false | string;
|
|
143
143
|
/**
|
|
144
|
-
* Formats one or many combos for human-readable UI labels.
|
|
144
|
+
* Formats one or many combos for human-readable UI labels, prepends " " for fluid appending.
|
|
145
145
|
* @param combo Combo or combo list.
|
|
146
146
|
* @returns Display label (for example: `" (ctrl+z) or (meta+z)"`).
|
|
147
147
|
*/
|
|
@@ -170,9 +170,29 @@ declare function parseForARIAKS(s: string | string[], formatted?: boolean): stri
|
|
|
170
170
|
|
|
171
171
|
type Dataset = Record<string, string | number>;
|
|
172
172
|
type Style = Partial<CSSStyleDeclaration>;
|
|
173
|
+
/**
|
|
174
|
+
* Creates an HTML element with the specified tag and properties.
|
|
175
|
+
* @param tag The tag name of the element to create.
|
|
176
|
+
* @param props Optional properties to set on the element.
|
|
177
|
+
* @param dataset Optional dataset attributes for the element.
|
|
178
|
+
* @param styles Optional CSS styles for the element.
|
|
179
|
+
* @returns The created HTML element.
|
|
180
|
+
*/
|
|
173
181
|
declare function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): HTMLElementTagNameMap[K];
|
|
174
182
|
declare function createEl(tag: string, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): HTMLElement | null;
|
|
183
|
+
/**
|
|
184
|
+
* Assigns properties, dataset attributes, and styles to an HTML element.
|
|
185
|
+
* @param el The HTML element to assign properties to.
|
|
186
|
+
* @param props Optional properties to set on the element.
|
|
187
|
+
* @param dataset Optional dataset attributes for the element.
|
|
188
|
+
* @param styles Optional CSS styles for the element.
|
|
189
|
+
*/
|
|
175
190
|
declare function assignEl<K extends keyof HTMLElementTagNameMap>(el?: HTMLElementTagNameMap[K], props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): void;
|
|
176
191
|
declare function assignEl(el?: HTMLElement | null, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
|
|
192
|
+
/** Get the currently active element, traversing into shadow roots if necessary.
|
|
193
|
+
* @param root Root node to start searching from, defaults to the main document.
|
|
194
|
+
* @returns The active element or null if none found.
|
|
195
|
+
*/
|
|
196
|
+
declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
|
|
177
197
|
|
|
178
|
-
export { type KeyStruct, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, type keysSettings, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
|
|
198
|
+
export { type KeyStruct, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, type keysSettings, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
|
package/dist/utils.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ declare function getTermsForKey(combo: string, settings: keysSettings): {
|
|
|
141
141
|
*/
|
|
142
142
|
declare function keyEventAllowed(e: KeyboardEvent, settings: keysSettings): false | string;
|
|
143
143
|
/**
|
|
144
|
-
* Formats one or many combos for human-readable UI labels.
|
|
144
|
+
* Formats one or many combos for human-readable UI labels, prepends " " for fluid appending.
|
|
145
145
|
* @param combo Combo or combo list.
|
|
146
146
|
* @returns Display label (for example: `" (ctrl+z) or (meta+z)"`).
|
|
147
147
|
*/
|
|
@@ -170,9 +170,29 @@ declare function parseForARIAKS(s: string | string[], formatted?: boolean): stri
|
|
|
170
170
|
|
|
171
171
|
type Dataset = Record<string, string | number>;
|
|
172
172
|
type Style = Partial<CSSStyleDeclaration>;
|
|
173
|
+
/**
|
|
174
|
+
* Creates an HTML element with the specified tag and properties.
|
|
175
|
+
* @param tag The tag name of the element to create.
|
|
176
|
+
* @param props Optional properties to set on the element.
|
|
177
|
+
* @param dataset Optional dataset attributes for the element.
|
|
178
|
+
* @param styles Optional CSS styles for the element.
|
|
179
|
+
* @returns The created HTML element.
|
|
180
|
+
*/
|
|
173
181
|
declare function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): HTMLElementTagNameMap[K];
|
|
174
182
|
declare function createEl(tag: string, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): HTMLElement | null;
|
|
183
|
+
/**
|
|
184
|
+
* Assigns properties, dataset attributes, and styles to an HTML element.
|
|
185
|
+
* @param el The HTML element to assign properties to.
|
|
186
|
+
* @param props Optional properties to set on the element.
|
|
187
|
+
* @param dataset Optional dataset attributes for the element.
|
|
188
|
+
* @param styles Optional CSS styles for the element.
|
|
189
|
+
*/
|
|
175
190
|
declare function assignEl<K extends keyof HTMLElementTagNameMap>(el?: HTMLElementTagNameMap[K], props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): void;
|
|
176
191
|
declare function assignEl(el?: HTMLElement | null, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
|
|
192
|
+
/** Get the currently active element, traversing into shadow roots if necessary.
|
|
193
|
+
* @param root Root node to start searching from, defaults to the main document.
|
|
194
|
+
* @returns The active element or null if none found.
|
|
195
|
+
*/
|
|
196
|
+
declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
|
|
177
197
|
|
|
178
|
-
export { type KeyStruct, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, type keysSettings, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
|
|
198
|
+
export { type KeyStruct, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, type keysSettings, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
|
package/dist/utils.js
CHANGED
|
@@ -10,13 +10,14 @@ import {
|
|
|
10
10
|
createEl,
|
|
11
11
|
formatKeyForDisplay,
|
|
12
12
|
formatKeyShortcutsForDisplay,
|
|
13
|
+
getActiveEl,
|
|
13
14
|
getTermsForKey,
|
|
14
15
|
keyEventAllowed,
|
|
15
16
|
matchKeys,
|
|
16
17
|
parseForARIAKS,
|
|
17
18
|
parseKeyCombo,
|
|
18
19
|
stringifyKeyEvent
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RI45W4O6.js";
|
|
20
21
|
import {
|
|
21
22
|
bindAllMethods,
|
|
22
23
|
guardAllMethods,
|
|
@@ -55,6 +56,7 @@ export {
|
|
|
55
56
|
fanoutOptsArr,
|
|
56
57
|
formatKeyForDisplay,
|
|
57
58
|
formatKeyShortcutsForDisplay,
|
|
59
|
+
getActiveEl,
|
|
58
60
|
getAny,
|
|
59
61
|
getTermsForKey,
|
|
60
62
|
getTrailRecords,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sia-reactor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
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",
|