@vinena/knobs 0.5.0 → 0.5.2
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/CHANGELOG.md +21 -0
- package/README.md +7 -0
- package/dist/early.global.js +6 -6
- package/dist/{elementsview-6g274ptr.js → elementsview-2z4pkrdz.js} +4 -4
- package/dist/{elementsview-pkzp9kc6.js → elementsview-qn8qyksa.js} +4 -4
- package/dist/engine/browserdraw.d.ts +24 -2
- package/dist/engine/browserkit.d.ts +18 -1
- package/dist/engine/browserui.d.ts +162 -22
- package/dist/engine/devicon.d.ts +59 -0
- package/dist/engine/fit.d.ts +4 -3
- package/dist/engine/foldflip.d.ts +40 -0
- package/dist/engine/identity.d.ts +7 -4
- package/dist/engine/mock.d.ts +16 -0
- package/dist/engine/mockdata.d.ts +4 -1
- package/dist/engine/mockdraw.d.ts +14 -2
- package/dist/engine/pageshot.d.ts +5 -2
- package/dist/engine/safaridraw.d.ts +162 -10
- package/dist/engine/screen.d.ts +24 -0
- package/dist/engine/store.d.ts +2 -1
- package/dist/engine/tabicon.d.ts +43 -0
- package/dist/engine/toplayer.d.ts +62 -0
- package/dist/engine/touchpointer.d.ts +0 -21
- package/dist/engine/underbar.d.ts +61 -0
- package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
- package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
- package/dist/host.d.ts +51 -0
- package/dist/{index-64rd634h.js → index-30fc6php.js} +1 -1
- package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
- package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
- package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
- package/dist/{index-kzsb9drs.js → index-hv02xka3.js} +20 -8
- package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
- package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
- package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
- package/dist/{index-5d6qzte3.js → index-trx7bxdk.js} +4 -4
- package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +270 -176
- package/dist/index.js +398 -124
- package/dist/instance.d.ts +23 -4
- package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
- package/dist/{react-4kbj1t4h.js → react-16spgn0h.js} +1 -1
- package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
- package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
- package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
- package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
- package/dist/{react-mv9y20jy.js → react-sw8d8c94.js} +4 -4
- package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
- package/dist/react.js +394 -123
- package/dist/{storageview-vdkbp6rt.js → storageview-r595qpt9.js} +4 -4
- package/dist/{storageview-j9d44f99.js → storageview-s7heg93p.js} +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/ui/footer.d.ts +9 -2
- package/dist/ui/panel.d.ts +16 -2
- package/dist/ui/settings.d.ts +17 -1
- package/dist/version.d.ts +2 -0
- package/package.json +3 -2
- package/skills/devknobs/SKILL.md +1 -1
- package/dist/elementsview-jnkbhzkj.js +0 -2873
- package/dist/elementsview-tf4qzmtw.js +0 -2874
- package/dist/engine/endroom.d.ts +0 -21
- package/dist/framekit-095qevka.js +0 -8838
- package/dist/framekit-q5aad770.js +0 -8839
- package/dist/index-hw56t3zy.js +0 -4800
- package/dist/index-k015tb6c.js +0 -357
- package/dist/index-ke6v7919.js +0 -4801
- package/dist/index-qxye1j73.js +0 -528
- package/dist/index-z5ytnj01.js +0 -4563
- package/dist/index-zvze25nf.js +0 -686
- package/dist/react-eygws6cx.js +0 -358
- package/dist/react-sq9pkw4k.js +0 -687
- package/dist/react-vjm88w4t.js +0 -4564
- package/dist/react-znfrjqk8.js +0 -529
- package/dist/storageview-sb23henh.js +0 -2729
- package/dist/storageview-vf8v8q8j.js +0 -2728
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
apply3 as apply4,
|
|
17
17
|
apply4 as apply5,
|
|
18
18
|
apply5 as apply6,
|
|
19
|
+
apply6 as apply7,
|
|
19
20
|
clockOn,
|
|
20
21
|
destroy,
|
|
21
22
|
drive,
|
|
@@ -52,10 +53,12 @@ import {
|
|
|
52
53
|
reset2 as reset3,
|
|
53
54
|
reset3 as reset4,
|
|
54
55
|
reset4 as reset5,
|
|
56
|
+
reset5 as reset6,
|
|
55
57
|
resetState,
|
|
56
58
|
resolveGeo,
|
|
57
59
|
resume,
|
|
58
60
|
save,
|
|
61
|
+
screenSizeOf,
|
|
59
62
|
setClock,
|
|
60
63
|
share,
|
|
61
64
|
shared,
|
|
@@ -66,7 +69,7 @@ import {
|
|
|
66
69
|
uaPreset,
|
|
67
70
|
webStorage,
|
|
68
71
|
wrapDate
|
|
69
|
-
} from "./index-
|
|
72
|
+
} from "./index-xjhwp5cj.js";
|
|
70
73
|
|
|
71
74
|
// src/engine/intl.ts
|
|
72
75
|
var SERVICES = [
|
|
@@ -545,14 +548,14 @@ function restoreNavigator() {
|
|
|
545
548
|
Reflect.deleteProperty(Navigator.prototype, "languages");
|
|
546
549
|
navigatorPatched = false;
|
|
547
550
|
}
|
|
548
|
-
function
|
|
551
|
+
function apply8(value) {
|
|
549
552
|
if (!captured) {
|
|
550
553
|
originalLang = document.documentElement.getAttribute("lang");
|
|
551
554
|
originalDir = document.documentElement.getAttribute("dir");
|
|
552
555
|
captured = true;
|
|
553
556
|
}
|
|
554
557
|
if (!value.lang || value.lang === "system") {
|
|
555
|
-
|
|
558
|
+
reset7();
|
|
556
559
|
if (value.dir !== "system") {
|
|
557
560
|
captured = true;
|
|
558
561
|
setAttribute("dir", value.dir);
|
|
@@ -575,7 +578,7 @@ function apply7(value) {
|
|
|
575
578
|
}
|
|
576
579
|
appliedLang = value.lang;
|
|
577
580
|
}
|
|
578
|
-
function
|
|
581
|
+
function reset7() {
|
|
579
582
|
cancelRetry();
|
|
580
583
|
appliedLang = null;
|
|
581
584
|
hold(null, null);
|
|
@@ -911,7 +914,7 @@ function restoreTime() {
|
|
|
911
914
|
installed = [];
|
|
912
915
|
timePatched = false;
|
|
913
916
|
}
|
|
914
|
-
function
|
|
917
|
+
function apply9(value, clock2) {
|
|
915
918
|
takeOver();
|
|
916
919
|
const next = value ? canonicalZone(value) : null;
|
|
917
920
|
if (next !== zone)
|
|
@@ -924,13 +927,199 @@ function apply8(value, clock2) {
|
|
|
924
927
|
}
|
|
925
928
|
patchTime();
|
|
926
929
|
}
|
|
927
|
-
function
|
|
930
|
+
function reset8() {
|
|
928
931
|
zone = null;
|
|
929
932
|
setClock(null);
|
|
930
933
|
offsetCache.clear();
|
|
931
934
|
restoreTime();
|
|
932
935
|
}
|
|
933
936
|
|
|
937
|
+
// src/engine/toplayer.ts
|
|
938
|
+
var LAYER = { overlay: 0, panel: 1, guide: 2, touch: 3 };
|
|
939
|
+
var HOST_RESET = `
|
|
940
|
+
:host([popover]) {
|
|
941
|
+
display: block !important;
|
|
942
|
+
position: fixed !important;
|
|
943
|
+
margin: 0 !important;
|
|
944
|
+
padding: 0 !important;
|
|
945
|
+
border: 0 !important;
|
|
946
|
+
background: none !important;
|
|
947
|
+
color: inherit !important;
|
|
948
|
+
overflow: visible !important;
|
|
949
|
+
max-width: none !important;
|
|
950
|
+
max-height: none !important;
|
|
951
|
+
box-shadow: none !important;
|
|
952
|
+
outline: none !important;
|
|
953
|
+
opacity: 1 !important;
|
|
954
|
+
transform: none !important;
|
|
955
|
+
translate: none !important;
|
|
956
|
+
scale: none !important;
|
|
957
|
+
rotate: none !important;
|
|
958
|
+
filter: none !important;
|
|
959
|
+
backdrop-filter: none !important;
|
|
960
|
+
clip-path: none !important;
|
|
961
|
+
mask: none !important;
|
|
962
|
+
contain: none !important;
|
|
963
|
+
container-type: normal !important;
|
|
964
|
+
content-visibility: visible !important;
|
|
965
|
+
visibility: visible !important;
|
|
966
|
+
perspective: none !important;
|
|
967
|
+
will-change: auto !important;
|
|
968
|
+
zoom: 1 !important;
|
|
969
|
+
min-width: 0 !important;
|
|
970
|
+
min-height: 0 !important;
|
|
971
|
+
position-anchor: auto !important;
|
|
972
|
+
position-area: none !important;
|
|
973
|
+
transition: none !important;
|
|
974
|
+
animation: none !important;
|
|
975
|
+
}`;
|
|
976
|
+
var BACKDROP_CSS = "[data-devknobs][popover]::backdrop{display:none!important}";
|
|
977
|
+
var TOP_LAYER = [":popover-open", ":modal", ":fullscreen"];
|
|
978
|
+
var POINTER = ["pointerover", "pointermove", "pointerdown"];
|
|
979
|
+
var held2 = [];
|
|
980
|
+
var dialogs = null;
|
|
981
|
+
var over = null;
|
|
982
|
+
function raises(change) {
|
|
983
|
+
return !change.own && change.newState === "open" && change.tag.toLowerCase() !== "details";
|
|
984
|
+
}
|
|
985
|
+
function dialogOpened(change) {
|
|
986
|
+
return change.tag.toLowerCase() === "dialog" && change.was === null && change.open;
|
|
987
|
+
}
|
|
988
|
+
function topLayerOf(path, inTopLayer) {
|
|
989
|
+
return path.find(inTopLayer) ?? null;
|
|
990
|
+
}
|
|
991
|
+
function placeOf(ranks, rank) {
|
|
992
|
+
const index = ranks.findIndex((other) => other > rank);
|
|
993
|
+
return index === -1 ? ranks.length : index;
|
|
994
|
+
}
|
|
995
|
+
function layered() {
|
|
996
|
+
return typeof HTMLElement === "function" && typeof HTMLElement.prototype.showPopover === "function";
|
|
997
|
+
}
|
|
998
|
+
function isOwn(node) {
|
|
999
|
+
return held2.some((entry) => entry.host === node);
|
|
1000
|
+
}
|
|
1001
|
+
function inTopLayer(node) {
|
|
1002
|
+
if (!(node instanceof Element) || isOwn(node))
|
|
1003
|
+
return false;
|
|
1004
|
+
for (let index = 0;index < TOP_LAYER.length; index++) {
|
|
1005
|
+
try {
|
|
1006
|
+
if (node.matches(TOP_LAYER[index] ?? ""))
|
|
1007
|
+
return true;
|
|
1008
|
+
} catch {}
|
|
1009
|
+
}
|
|
1010
|
+
return false;
|
|
1011
|
+
}
|
|
1012
|
+
function show(host) {
|
|
1013
|
+
try {
|
|
1014
|
+
if (host.matches(":popover-open"))
|
|
1015
|
+
host.hidePopover();
|
|
1016
|
+
host.showPopover();
|
|
1017
|
+
} catch {}
|
|
1018
|
+
}
|
|
1019
|
+
function raiseFrom(rank) {
|
|
1020
|
+
for (const entry of held2)
|
|
1021
|
+
if (entry.rank >= rank)
|
|
1022
|
+
show(entry.host);
|
|
1023
|
+
}
|
|
1024
|
+
function raiseAll() {
|
|
1025
|
+
raiseFrom(Number.NEGATIVE_INFINITY);
|
|
1026
|
+
}
|
|
1027
|
+
function onPointer(event) {
|
|
1028
|
+
const found = topLayerOf(event.composedPath(), inTopLayer);
|
|
1029
|
+
if (found === over)
|
|
1030
|
+
return;
|
|
1031
|
+
over = found;
|
|
1032
|
+
if (found)
|
|
1033
|
+
raiseAll();
|
|
1034
|
+
}
|
|
1035
|
+
function onToggle(event) {
|
|
1036
|
+
const target = event.composedPath()[0];
|
|
1037
|
+
const own = isOwn(target);
|
|
1038
|
+
if (own)
|
|
1039
|
+
event.stopImmediatePropagation();
|
|
1040
|
+
if (!(target instanceof Element))
|
|
1041
|
+
return;
|
|
1042
|
+
const newState = "newState" in event ? event.newState : undefined;
|
|
1043
|
+
if (!raises({ newState, tag: target.tagName, own }))
|
|
1044
|
+
return;
|
|
1045
|
+
if (event.type === "beforetoggle")
|
|
1046
|
+
queueMicrotask(raiseAll);
|
|
1047
|
+
else
|
|
1048
|
+
raiseAll();
|
|
1049
|
+
}
|
|
1050
|
+
function onFullscreen() {
|
|
1051
|
+
if (document.fullscreenElement)
|
|
1052
|
+
raiseAll();
|
|
1053
|
+
}
|
|
1054
|
+
function onDialogs(records) {
|
|
1055
|
+
const opened = records.some((record) => record.target instanceof Element && dialogOpened({
|
|
1056
|
+
tag: record.target.tagName,
|
|
1057
|
+
was: record.oldValue,
|
|
1058
|
+
open: record.target.hasAttribute("open")
|
|
1059
|
+
}));
|
|
1060
|
+
if (opened)
|
|
1061
|
+
raiseAll();
|
|
1062
|
+
}
|
|
1063
|
+
function watch() {
|
|
1064
|
+
ensureStyle("top-layer").textContent = BACKDROP_CSS;
|
|
1065
|
+
window.addEventListener("beforetoggle", onToggle, true);
|
|
1066
|
+
window.addEventListener("toggle", onToggle, true);
|
|
1067
|
+
window.addEventListener("fullscreenchange", onFullscreen, true);
|
|
1068
|
+
for (const type of POINTER)
|
|
1069
|
+
window.addEventListener(type, onPointer, true);
|
|
1070
|
+
if (typeof MutationObserver !== "function")
|
|
1071
|
+
return;
|
|
1072
|
+
dialogs = new MutationObserver(onDialogs);
|
|
1073
|
+
dialogs.observe(document.documentElement, {
|
|
1074
|
+
subtree: true,
|
|
1075
|
+
attributes: true,
|
|
1076
|
+
attributeFilter: ["open"],
|
|
1077
|
+
attributeOldValue: true
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
function unwatch() {
|
|
1081
|
+
removeStyle("top-layer");
|
|
1082
|
+
window.removeEventListener("beforetoggle", onToggle, true);
|
|
1083
|
+
window.removeEventListener("toggle", onToggle, true);
|
|
1084
|
+
window.removeEventListener("fullscreenchange", onFullscreen, true);
|
|
1085
|
+
for (const type of POINTER)
|
|
1086
|
+
window.removeEventListener(type, onPointer, true);
|
|
1087
|
+
dialogs?.disconnect();
|
|
1088
|
+
dialogs = null;
|
|
1089
|
+
over = null;
|
|
1090
|
+
}
|
|
1091
|
+
function holdInTopLayer(host, rank) {
|
|
1092
|
+
if (!layered())
|
|
1093
|
+
return { raise() {}, release() {} };
|
|
1094
|
+
const entry = { host, rank };
|
|
1095
|
+
const first = held2.length === 0;
|
|
1096
|
+
held2.splice(placeOf(held2.map((other) => other.rank), rank), 0, entry);
|
|
1097
|
+
host.setAttribute("popover", "manual");
|
|
1098
|
+
if (first)
|
|
1099
|
+
watch();
|
|
1100
|
+
raiseFrom(rank);
|
|
1101
|
+
if (!host.matches(":popover-open")) {
|
|
1102
|
+
host.removeAttribute("popover");
|
|
1103
|
+
held2 = held2.filter((other) => other !== entry);
|
|
1104
|
+
if (held2.length === 0)
|
|
1105
|
+
unwatch();
|
|
1106
|
+
return { raise() {}, release() {} };
|
|
1107
|
+
}
|
|
1108
|
+
return {
|
|
1109
|
+
raise() {
|
|
1110
|
+
if (held2.includes(entry))
|
|
1111
|
+
raiseFrom(rank);
|
|
1112
|
+
},
|
|
1113
|
+
release() {
|
|
1114
|
+
if (!held2.includes(entry))
|
|
1115
|
+
return;
|
|
1116
|
+
held2 = held2.filter((other) => other !== entry);
|
|
1117
|
+
if (held2.length === 0)
|
|
1118
|
+
unwatch();
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
|
|
934
1123
|
// src/engine/index.ts
|
|
935
1124
|
var exports_engine = {};
|
|
936
1125
|
__export(exports_engine, {
|
|
@@ -940,7 +1129,7 @@ __export(exports_engine, {
|
|
|
940
1129
|
start: () => start4,
|
|
941
1130
|
setState: () => setState,
|
|
942
1131
|
setNative: () => setNative,
|
|
943
|
-
reset: () =>
|
|
1132
|
+
reset: () => reset19,
|
|
944
1133
|
replay: () => replay2,
|
|
945
1134
|
ready: () => ready,
|
|
946
1135
|
nativeSwitch: () => nativeSwitch,
|
|
@@ -1670,10 +1859,10 @@ function bodyOf(xhr, type, loaded) {
|
|
|
1670
1859
|
return record.size === 0 ? null : record;
|
|
1671
1860
|
}
|
|
1672
1861
|
var FAILS = ["error", "abort", "timeout"];
|
|
1673
|
-
function
|
|
1862
|
+
function watch2(xhr, id, url, log) {
|
|
1674
1863
|
let outcome = null;
|
|
1675
1864
|
let error = null;
|
|
1676
|
-
let
|
|
1865
|
+
let over2 = false;
|
|
1677
1866
|
let loaded = null;
|
|
1678
1867
|
const unlisten = () => {
|
|
1679
1868
|
xhr.removeEventListener("readystatechange", onState, true);
|
|
@@ -1683,7 +1872,7 @@ function watch(xhr, id, url, log) {
|
|
|
1683
1872
|
xhr.removeEventListener("loadend", onEnd, true);
|
|
1684
1873
|
};
|
|
1685
1874
|
function finish() {
|
|
1686
|
-
|
|
1875
|
+
over2 = true;
|
|
1687
1876
|
unlisten();
|
|
1688
1877
|
try {
|
|
1689
1878
|
const answer = head(xhr, url);
|
|
@@ -1726,9 +1915,9 @@ function watch(xhr, id, url, log) {
|
|
|
1726
1915
|
xhr.addEventListener(type, onFail, true);
|
|
1727
1916
|
xhr.addEventListener("loadend", onEnd, true);
|
|
1728
1917
|
return () => {
|
|
1729
|
-
if (
|
|
1918
|
+
if (over2)
|
|
1730
1919
|
return;
|
|
1731
|
-
|
|
1920
|
+
over2 = true;
|
|
1732
1921
|
unlisten();
|
|
1733
1922
|
log.ended(id, { state: "aborted" });
|
|
1734
1923
|
};
|
|
@@ -1765,7 +1954,7 @@ function patchXhr(patches, log) {
|
|
|
1765
1954
|
const body = describeBody(args[0], headerOf(headers, "content-type"));
|
|
1766
1955
|
const initiator = trimStack(new Error().stack, 1);
|
|
1767
1956
|
id = log.start("xhr", { method, url, headers: [...headers], body, initiator });
|
|
1768
|
-
request.drop =
|
|
1957
|
+
request.drop = watch2(this, id, url, log);
|
|
1769
1958
|
} catch {}
|
|
1770
1959
|
try {
|
|
1771
1960
|
return original.apply(this, args);
|
|
@@ -2020,14 +2209,14 @@ function restore2() {
|
|
|
2020
2209
|
}
|
|
2021
2210
|
installed2 = [];
|
|
2022
2211
|
}
|
|
2023
|
-
function
|
|
2212
|
+
function apply10(value) {
|
|
2024
2213
|
on = sends(value);
|
|
2025
2214
|
if (on)
|
|
2026
2215
|
patch();
|
|
2027
2216
|
else
|
|
2028
2217
|
restore2();
|
|
2029
2218
|
}
|
|
2030
|
-
function
|
|
2219
|
+
function reset9() {
|
|
2031
2220
|
on = false;
|
|
2032
2221
|
restore2();
|
|
2033
2222
|
}
|
|
@@ -2059,7 +2248,7 @@ function connection() {
|
|
|
2059
2248
|
function readConnection(target) {
|
|
2060
2249
|
return CONNECTION_KEYS.map((key) => String(Reflect.get(target, key))).join();
|
|
2061
2250
|
}
|
|
2062
|
-
function
|
|
2251
|
+
function apply11(value) {
|
|
2063
2252
|
const wasOnline = navigator.onLine;
|
|
2064
2253
|
if (value.online === "offline")
|
|
2065
2254
|
shadow(navigator, "onLine", false);
|
|
@@ -2087,27 +2276,27 @@ function apply10(value) {
|
|
|
2087
2276
|
if (readConnection(target) !== before)
|
|
2088
2277
|
target.dispatchEvent(new Event("change"));
|
|
2089
2278
|
}
|
|
2090
|
-
function
|
|
2279
|
+
function reset10() {
|
|
2091
2280
|
if (shadowed.size > 0)
|
|
2092
|
-
|
|
2281
|
+
apply11(SYSTEM);
|
|
2093
2282
|
shadowed.clear();
|
|
2094
2283
|
}
|
|
2095
2284
|
|
|
2096
2285
|
// src/engine/outlines.ts
|
|
2097
2286
|
var NAME = "outlines";
|
|
2098
|
-
function
|
|
2287
|
+
function apply12(value) {
|
|
2099
2288
|
if (!value) {
|
|
2100
|
-
|
|
2289
|
+
reset11();
|
|
2101
2290
|
return;
|
|
2102
2291
|
}
|
|
2103
2292
|
ensureStyle(NAME).textContent = "body *:not([data-devknobs],[data-devknobs] *){outline:1px solid rgba(127,127,127,.5)!important}";
|
|
2104
2293
|
}
|
|
2105
|
-
function
|
|
2294
|
+
function reset11() {
|
|
2106
2295
|
removeStyle(NAME);
|
|
2107
2296
|
}
|
|
2108
2297
|
|
|
2109
2298
|
// src/engine/tree.ts
|
|
2110
|
-
function
|
|
2299
|
+
function isOwn2(node) {
|
|
2111
2300
|
let current = node;
|
|
2112
2301
|
while (current) {
|
|
2113
2302
|
if (current instanceof Element && current.closest("[data-devknobs]"))
|
|
@@ -2275,7 +2464,7 @@ function schedule() {
|
|
|
2275
2464
|
});
|
|
2276
2465
|
}
|
|
2277
2466
|
function onMutation(records) {
|
|
2278
|
-
if (timer2 || records.every((record) =>
|
|
2467
|
+
if (timer2 || records.every((record) => isOwn2(record.target)))
|
|
2279
2468
|
return;
|
|
2280
2469
|
timer2 = window.setTimeout(() => {
|
|
2281
2470
|
timer2 = 0;
|
|
@@ -2302,9 +2491,9 @@ function start2() {
|
|
|
2302
2491
|
});
|
|
2303
2492
|
update();
|
|
2304
2493
|
}
|
|
2305
|
-
function
|
|
2494
|
+
function apply13(value) {
|
|
2306
2495
|
if (!value) {
|
|
2307
|
-
|
|
2496
|
+
reset12();
|
|
2308
2497
|
return;
|
|
2309
2498
|
}
|
|
2310
2499
|
if (document.body)
|
|
@@ -2312,7 +2501,7 @@ function apply12(value) {
|
|
|
2312
2501
|
else
|
|
2313
2502
|
document.addEventListener("DOMContentLoaded", start2, { once: true });
|
|
2314
2503
|
}
|
|
2315
|
-
function
|
|
2504
|
+
function reset12() {
|
|
2316
2505
|
document.removeEventListener("DOMContentLoaded", start2);
|
|
2317
2506
|
if (!host)
|
|
2318
2507
|
return;
|
|
@@ -2513,9 +2702,9 @@ function whenIdle(run) {
|
|
|
2513
2702
|
clearTimeout(timer3);
|
|
2514
2703
|
};
|
|
2515
2704
|
}
|
|
2516
|
-
function
|
|
2705
|
+
function apply14(value) {
|
|
2517
2706
|
if (!value) {
|
|
2518
|
-
|
|
2707
|
+
reset13();
|
|
2519
2708
|
return;
|
|
2520
2709
|
}
|
|
2521
2710
|
if (on2 || cancelStart)
|
|
@@ -2525,7 +2714,7 @@ function apply13(value) {
|
|
|
2525
2714
|
function pending() {
|
|
2526
2715
|
return cancelStart !== null;
|
|
2527
2716
|
}
|
|
2528
|
-
function
|
|
2717
|
+
function reset13() {
|
|
2529
2718
|
cancelStart?.();
|
|
2530
2719
|
cancelStart = null;
|
|
2531
2720
|
if (!on2)
|
|
@@ -2603,7 +2792,7 @@ function collect(roots = shadowRoots()) {
|
|
|
2603
2792
|
for (const animation of scope.getAnimations())
|
|
2604
2793
|
found.add(animation);
|
|
2605
2794
|
}
|
|
2606
|
-
return Array.from(found).filter((animation) => !
|
|
2795
|
+
return Array.from(found).filter((animation) => !isOwn2(targetOf(animation)));
|
|
2607
2796
|
}
|
|
2608
2797
|
|
|
2609
2798
|
// src/engine/replay.ts
|
|
@@ -2678,17 +2867,326 @@ function replay() {
|
|
|
2678
2867
|
var NAME2 = "spacing";
|
|
2679
2868
|
var NOT_OURS = ":not([data-devknobs],[data-devknobs] *)";
|
|
2680
2869
|
var CSS2 = `*${NOT_OURS}{line-height:1.5!important;letter-spacing:.12em!important;word-spacing:.16em!important}` + `p${NOT_OURS}{margin-bottom:2em!important}`;
|
|
2681
|
-
function
|
|
2870
|
+
function apply15(value) {
|
|
2682
2871
|
if (!value) {
|
|
2683
|
-
|
|
2872
|
+
reset14();
|
|
2684
2873
|
return;
|
|
2685
2874
|
}
|
|
2686
2875
|
ensureStyle(NAME2).textContent = CSS2;
|
|
2687
2876
|
}
|
|
2688
|
-
function
|
|
2877
|
+
function reset14() {
|
|
2689
2878
|
removeStyle(NAME2);
|
|
2690
2879
|
}
|
|
2691
2880
|
|
|
2881
|
+
// src/engine/devicon.ts
|
|
2882
|
+
var RIBBON_YELLOW = "#ffd60a";
|
|
2883
|
+
var RIBBON_INK = "#111111";
|
|
2884
|
+
var RIBBON_TEXT_MIN = 32;
|
|
2885
|
+
function tileBox(data, size) {
|
|
2886
|
+
let x0 = size;
|
|
2887
|
+
let y0 = size;
|
|
2888
|
+
let x1 = -1;
|
|
2889
|
+
let y1 = -1;
|
|
2890
|
+
for (let y = 0;y < size; y++) {
|
|
2891
|
+
for (let x = 0;x < size; x++) {
|
|
2892
|
+
if ((data[(y * size + x) * 4 + 3] ?? 0) <= 128)
|
|
2893
|
+
continue;
|
|
2894
|
+
if (x < x0)
|
|
2895
|
+
x0 = x;
|
|
2896
|
+
if (x > x1)
|
|
2897
|
+
x1 = x;
|
|
2898
|
+
if (y < y0)
|
|
2899
|
+
y0 = y;
|
|
2900
|
+
if (y > y1)
|
|
2901
|
+
y1 = y;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
if (x1 < 0)
|
|
2905
|
+
return { x: 0, y: 0, s: size };
|
|
2906
|
+
const w = x1 - x0 + 1;
|
|
2907
|
+
const h = y1 - y0 + 1;
|
|
2908
|
+
const s = Math.max(w, h);
|
|
2909
|
+
return { x: x0 - (s - w) / 2, y: y0 - (s - h) / 2, s };
|
|
2910
|
+
}
|
|
2911
|
+
function ribbonGeometry(size, box) {
|
|
2912
|
+
const width = 0.3 * box.s;
|
|
2913
|
+
const distance = (size <= 20 ? 0.2 : 0.22) * box.s;
|
|
2914
|
+
const textSize = 0.62 * width;
|
|
2915
|
+
return {
|
|
2916
|
+
box,
|
|
2917
|
+
radius: 0.225 * box.s,
|
|
2918
|
+
origin: { x: box.x + box.s, y: box.y },
|
|
2919
|
+
angle: Math.PI / 4,
|
|
2920
|
+
width,
|
|
2921
|
+
distance,
|
|
2922
|
+
edge: Math.max(1, box.s / 40),
|
|
2923
|
+
reach: 2 * box.s,
|
|
2924
|
+
text: size >= RIBBON_TEXT_MIN ? { size: textSize, y: distance + width / 2 + 0.04 * textSize } : null
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
function drawDevIcon(context, size, source) {
|
|
2928
|
+
context.clearRect(0, 0, size, size);
|
|
2929
|
+
const w = source.width || size;
|
|
2930
|
+
const h = source.height || size;
|
|
2931
|
+
const scale = size / Math.max(w, h);
|
|
2932
|
+
context.drawImage(source, (size - w * scale) / 2, (size - h * scale) / 2, w * scale, h * scale);
|
|
2933
|
+
const box = tileBox(context.getImageData(0, 0, size, size).data, size);
|
|
2934
|
+
const g = ribbonGeometry(size, box);
|
|
2935
|
+
context.save();
|
|
2936
|
+
context.beginPath();
|
|
2937
|
+
context.roundRect(box.x, box.y, box.s, box.s, g.radius);
|
|
2938
|
+
context.clip();
|
|
2939
|
+
context.translate(g.origin.x, g.origin.y);
|
|
2940
|
+
context.rotate(g.angle);
|
|
2941
|
+
context.fillStyle = RIBBON_INK;
|
|
2942
|
+
context.fillRect(-g.reach, g.distance - g.edge, 2 * g.reach, g.width + 2 * g.edge);
|
|
2943
|
+
context.fillStyle = RIBBON_YELLOW;
|
|
2944
|
+
context.fillRect(-g.reach, g.distance, 2 * g.reach, g.width);
|
|
2945
|
+
if (g.text) {
|
|
2946
|
+
context.fillStyle = RIBBON_INK;
|
|
2947
|
+
context.font = `700 ${g.text.size}px -apple-system, system-ui, sans-serif`;
|
|
2948
|
+
context.textAlign = "center";
|
|
2949
|
+
context.textBaseline = "middle";
|
|
2950
|
+
context.fillText("DEV", 0, g.text.y);
|
|
2951
|
+
}
|
|
2952
|
+
context.restore();
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
// src/engine/tabicon.ts
|
|
2956
|
+
var ORIGINAL_HREF = "data-devknobs-href";
|
|
2957
|
+
var ADDED_ICON = "data-devknobs-icon";
|
|
2958
|
+
var FALLBACK = "/favicon.ico";
|
|
2959
|
+
var TOUCH_RELS = ["apple-touch-icon", "apple-touch-icon-precomposed"];
|
|
2960
|
+
function localHost(hostname) {
|
|
2961
|
+
const host2 = hostname.toLowerCase().replace(/\.$/, "");
|
|
2962
|
+
if (host2 === "localhost" || host2.endsWith(".localhost") || host2.endsWith(".local"))
|
|
2963
|
+
return true;
|
|
2964
|
+
if (host2 === "[::1]" || host2 === "::1" || host2 === "0.0.0.0")
|
|
2965
|
+
return true;
|
|
2966
|
+
if (/^\[?(f[cd][0-9a-f]{2}|fe[89ab][0-9a-f]):/.test(host2))
|
|
2967
|
+
return true;
|
|
2968
|
+
const ip = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host2);
|
|
2969
|
+
if (!ip)
|
|
2970
|
+
return false;
|
|
2971
|
+
const [a = 0, b = 0, ...rest] = ip.slice(1).map(Number);
|
|
2972
|
+
if ([a, b, ...rest].some((part) => part > 255))
|
|
2973
|
+
return false;
|
|
2974
|
+
return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
2975
|
+
}
|
|
2976
|
+
function devIconShown(value, hostname) {
|
|
2977
|
+
return value === "on" || value === "auto" && localHost(hostname);
|
|
2978
|
+
}
|
|
2979
|
+
function devIconFor(on3, hostname) {
|
|
2980
|
+
if (on3 === localHost(hostname))
|
|
2981
|
+
return "auto";
|
|
2982
|
+
return on3 ? "on" : "off";
|
|
2983
|
+
}
|
|
2984
|
+
function shownHere(value) {
|
|
2985
|
+
if (typeof window === "undefined" || typeof document === "undefined")
|
|
2986
|
+
return false;
|
|
2987
|
+
return window.top === window && devIconShown(value, window.location.hostname);
|
|
2988
|
+
}
|
|
2989
|
+
function relTokens(link) {
|
|
2990
|
+
return (link.getAttribute("rel") ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
2991
|
+
}
|
|
2992
|
+
function isIconLink(node) {
|
|
2993
|
+
if (typeof node !== "object" || node === null)
|
|
2994
|
+
return false;
|
|
2995
|
+
const link = node;
|
|
2996
|
+
if (link.nodeType !== 1 || link.localName !== "link")
|
|
2997
|
+
return false;
|
|
2998
|
+
return relTokens(link).some((rel) => rel === "icon" || TOUCH_RELS.includes(rel));
|
|
2999
|
+
}
|
|
3000
|
+
var SIZE_MIN = 16;
|
|
3001
|
+
var SIZE_MAX = 512;
|
|
3002
|
+
function iconSize(link) {
|
|
3003
|
+
const declared = /^(\d+)x(\d+)$/i.exec((link.getAttribute("sizes") ?? "").trim().split(/\s+/)[0] ?? "");
|
|
3004
|
+
const width = declared ? Number(declared[1]) : 0;
|
|
3005
|
+
if (width > 0)
|
|
3006
|
+
return Math.min(SIZE_MAX, Math.max(SIZE_MIN, width));
|
|
3007
|
+
return relTokens(link).some((rel) => TOUCH_RELS.includes(rel)) ? 180 : 32;
|
|
3008
|
+
}
|
|
3009
|
+
function createTabIcon(env) {
|
|
3010
|
+
const doc = env.document;
|
|
3011
|
+
let on3 = false;
|
|
3012
|
+
let observer3 = null;
|
|
3013
|
+
const drawn = new Map;
|
|
3014
|
+
const loading = new Map;
|
|
3015
|
+
let added = null;
|
|
3016
|
+
let told = false;
|
|
3017
|
+
function iconLinks() {
|
|
3018
|
+
return Array.from(doc.querySelectorAll("link")).filter(isIconLink);
|
|
3019
|
+
}
|
|
3020
|
+
function swap(link) {
|
|
3021
|
+
if (!on3 || !isIconLink(link))
|
|
3022
|
+
return;
|
|
3023
|
+
const current = link.getAttribute("href");
|
|
3024
|
+
if (!current)
|
|
3025
|
+
return;
|
|
3026
|
+
const mine = drawn.get(link);
|
|
3027
|
+
const href = mine?.url === current ? mine.original : current;
|
|
3028
|
+
if (loading.get(link) === href)
|
|
3029
|
+
return;
|
|
3030
|
+
loading.set(link, href);
|
|
3031
|
+
env.load(href).then((source) => {
|
|
3032
|
+
if (loading.get(link) !== href)
|
|
3033
|
+
return;
|
|
3034
|
+
loading.delete(link);
|
|
3035
|
+
if (!on3 || link.getAttribute("href") !== current)
|
|
3036
|
+
return;
|
|
3037
|
+
const url = source ? env.render(source, iconSize(link)) : null;
|
|
3038
|
+
if (!url) {
|
|
3039
|
+
if (!told)
|
|
3040
|
+
console.debug(`devknobs: the tab icon ${href} could not be read, so it shows no dev ribbon`);
|
|
3041
|
+
told = true;
|
|
3042
|
+
return;
|
|
3043
|
+
}
|
|
3044
|
+
drawn.set(link, { url, original: href });
|
|
3045
|
+
link.setAttribute(ORIGINAL_HREF, href);
|
|
3046
|
+
link.setAttribute("href", url);
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
function forget(link) {
|
|
3050
|
+
loading.delete(link);
|
|
3051
|
+
const mine = drawn.get(link);
|
|
3052
|
+
if (!mine)
|
|
3053
|
+
return;
|
|
3054
|
+
drawn.delete(link);
|
|
3055
|
+
if (link.getAttribute("href") === mine.url)
|
|
3056
|
+
link.setAttribute("href", mine.original);
|
|
3057
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
3058
|
+
}
|
|
3059
|
+
function linksIn(node) {
|
|
3060
|
+
if (isIconLink(node))
|
|
3061
|
+
return [node];
|
|
3062
|
+
if (node.nodeType !== 1)
|
|
3063
|
+
return [];
|
|
3064
|
+
return Array.from(node.querySelectorAll("link")).filter(isIconLink);
|
|
3065
|
+
}
|
|
3066
|
+
function fallback() {
|
|
3067
|
+
env.load(FALLBACK).then((source) => {
|
|
3068
|
+
if (!on3 || !source || added || iconLinks().length > 0)
|
|
3069
|
+
return;
|
|
3070
|
+
const link = doc.createElement("link");
|
|
3071
|
+
link.setAttribute("rel", "icon");
|
|
3072
|
+
link.setAttribute("href", FALLBACK);
|
|
3073
|
+
link.setAttribute(ADDED_ICON, "");
|
|
3074
|
+
added = link;
|
|
3075
|
+
(doc.head ?? doc.documentElement).append(link);
|
|
3076
|
+
swap(link);
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
function watch3(records) {
|
|
3080
|
+
for (const record of records) {
|
|
3081
|
+
if (record.type === "attributes") {
|
|
3082
|
+
const link = record.target;
|
|
3083
|
+
if (!isIconLink(link)) {
|
|
3084
|
+
forget(link);
|
|
3085
|
+
continue;
|
|
3086
|
+
}
|
|
3087
|
+
if (record.attributeName === "href" && drawn.get(link)?.url === link.getAttribute("href"))
|
|
3088
|
+
continue;
|
|
3089
|
+
swap(link);
|
|
3090
|
+
continue;
|
|
3091
|
+
}
|
|
3092
|
+
for (const node of Array.from(record.removedNodes)) {
|
|
3093
|
+
for (const link of linksIn(node))
|
|
3094
|
+
if (link !== added)
|
|
3095
|
+
forget(link);
|
|
3096
|
+
}
|
|
3097
|
+
for (const node of Array.from(record.addedNodes)) {
|
|
3098
|
+
for (const link of linksIn(node)) {
|
|
3099
|
+
if (link !== added && added) {
|
|
3100
|
+
added.remove();
|
|
3101
|
+
added = null;
|
|
3102
|
+
}
|
|
3103
|
+
swap(link);
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
return {
|
|
3109
|
+
start() {
|
|
3110
|
+
if (on3)
|
|
3111
|
+
return;
|
|
3112
|
+
on3 = true;
|
|
3113
|
+
const links = iconLinks();
|
|
3114
|
+
for (const link of links)
|
|
3115
|
+
swap(link);
|
|
3116
|
+
if (links.length === 0)
|
|
3117
|
+
fallback();
|
|
3118
|
+
if (!env.Observer)
|
|
3119
|
+
return;
|
|
3120
|
+
observer3 = new env.Observer(watch3);
|
|
3121
|
+
observer3.observe(doc.documentElement, {
|
|
3122
|
+
childList: true,
|
|
3123
|
+
subtree: true,
|
|
3124
|
+
attributes: true,
|
|
3125
|
+
attributeFilter: ["href", "rel", "sizes"]
|
|
3126
|
+
});
|
|
3127
|
+
},
|
|
3128
|
+
stop() {
|
|
3129
|
+
if (!on3)
|
|
3130
|
+
return;
|
|
3131
|
+
on3 = false;
|
|
3132
|
+
observer3?.disconnect();
|
|
3133
|
+
observer3 = null;
|
|
3134
|
+
loading.clear();
|
|
3135
|
+
for (const [link, { url, original }] of drawn) {
|
|
3136
|
+
if (link.getAttribute("href") === url)
|
|
3137
|
+
link.setAttribute("href", original);
|
|
3138
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
3139
|
+
}
|
|
3140
|
+
drawn.clear();
|
|
3141
|
+
added?.remove();
|
|
3142
|
+
added = null;
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
}
|
|
3146
|
+
function loadImage(href) {
|
|
3147
|
+
return new Promise((resolve) => {
|
|
3148
|
+
const image = new Image;
|
|
3149
|
+
image.crossOrigin = "anonymous";
|
|
3150
|
+
image.onload = () => resolve(image);
|
|
3151
|
+
image.onerror = () => resolve(null);
|
|
3152
|
+
image.src = href;
|
|
3153
|
+
});
|
|
3154
|
+
}
|
|
3155
|
+
function renderPng(source, size) {
|
|
3156
|
+
try {
|
|
3157
|
+
const canvas = document.createElement("canvas");
|
|
3158
|
+
canvas.width = size;
|
|
3159
|
+
canvas.height = size;
|
|
3160
|
+
const context = canvas.getContext("2d");
|
|
3161
|
+
if (!context)
|
|
3162
|
+
return null;
|
|
3163
|
+
drawDevIcon(context, size, source);
|
|
3164
|
+
return canvas.toDataURL("image/png");
|
|
3165
|
+
} catch {
|
|
3166
|
+
return null;
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
var live = null;
|
|
3170
|
+
function apply16(on3) {
|
|
3171
|
+
if (!on3) {
|
|
3172
|
+
reset15();
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
if (live || typeof document === "undefined")
|
|
3176
|
+
return;
|
|
3177
|
+
live = createTabIcon({
|
|
3178
|
+
document,
|
|
3179
|
+
load: loadImage,
|
|
3180
|
+
render: renderPng,
|
|
3181
|
+
Observer: typeof MutationObserver === "undefined" ? undefined : MutationObserver
|
|
3182
|
+
});
|
|
3183
|
+
live.start();
|
|
3184
|
+
}
|
|
3185
|
+
function reset15() {
|
|
3186
|
+
live?.stop();
|
|
3187
|
+
live = null;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
2692
3190
|
// src/engine/speed.ts
|
|
2693
3191
|
var SPEED_MIN = 0;
|
|
2694
3192
|
var SPEED_MAX = 16;
|
|
@@ -2767,7 +3265,7 @@ function tick(now2) {
|
|
|
2767
3265
|
}
|
|
2768
3266
|
function onStart(event) {
|
|
2769
3267
|
const target = event.target;
|
|
2770
|
-
if (!(target instanceof Element) ||
|
|
3268
|
+
if (!(target instanceof Element) || isOwn2(target))
|
|
2771
3269
|
return;
|
|
2772
3270
|
for (const animation of target.getAnimations({ subtree: event.pseudoElement !== "" })) {
|
|
2773
3271
|
adopt(animation);
|
|
@@ -2780,7 +3278,7 @@ function patchAnimate() {
|
|
|
2780
3278
|
nativeAnimate = native;
|
|
2781
3279
|
patchedAnimate = function animate(...args) {
|
|
2782
3280
|
const animation = native.apply(this, args);
|
|
2783
|
-
if (rate !== 1 && !
|
|
3281
|
+
if (rate !== 1 && !isOwn2(this))
|
|
2784
3282
|
adopt(animation);
|
|
2785
3283
|
return animation;
|
|
2786
3284
|
};
|
|
@@ -2793,10 +3291,10 @@ function restoreAnimate() {
|
|
|
2793
3291
|
nativeAnimate = null;
|
|
2794
3292
|
patchedAnimate = null;
|
|
2795
3293
|
}
|
|
2796
|
-
function
|
|
3294
|
+
function apply17(value) {
|
|
2797
3295
|
const next = Number.isFinite(value) && value >= 0 ? value : 1;
|
|
2798
3296
|
if (next === 1) {
|
|
2799
|
-
|
|
3297
|
+
reset16();
|
|
2800
3298
|
return;
|
|
2801
3299
|
}
|
|
2802
3300
|
if (next === rate && frame2)
|
|
@@ -2815,7 +3313,7 @@ function apply15(value) {
|
|
|
2815
3313
|
if (!frame2)
|
|
2816
3314
|
frame2 = requestAnimationFrame(tick);
|
|
2817
3315
|
}
|
|
2818
|
-
function
|
|
3316
|
+
function reset16() {
|
|
2819
3317
|
rate = 1;
|
|
2820
3318
|
if (frame2) {
|
|
2821
3319
|
cancelAnimationFrame(frame2);
|
|
@@ -3006,7 +3504,7 @@ var EVENTS = [
|
|
|
3006
3504
|
"dragstart",
|
|
3007
3505
|
"selectstart"
|
|
3008
3506
|
];
|
|
3009
|
-
var CURSOR_CSS =
|
|
3507
|
+
var CURSOR_CSS = "*:not([data-devknobs]){cursor:none!important}:where([data-devknobs]){cursor:auto}";
|
|
3010
3508
|
var DRAG_CSS = "*{-webkit-user-select:none!important;user-select:none!important}";
|
|
3011
3509
|
var DOT_CSS = `
|
|
3012
3510
|
:host {
|
|
@@ -3084,15 +3582,6 @@ function inertiaStep(velocity, dt) {
|
|
|
3084
3582
|
done: Math.hypot(next.x, next.y) < STOP_FLING
|
|
3085
3583
|
};
|
|
3086
3584
|
}
|
|
3087
|
-
function raises(change) {
|
|
3088
|
-
return !change.own && change.newState === "open" && change.tag.toLowerCase() !== "details";
|
|
3089
|
-
}
|
|
3090
|
-
function dialogOpened(change) {
|
|
3091
|
-
return change.tag.toLowerCase() === "dialog" && change.was === null && change.open;
|
|
3092
|
-
}
|
|
3093
|
-
function topLayerOf(path, inTopLayer) {
|
|
3094
|
-
return path.find(inTopLayer) ?? null;
|
|
3095
|
-
}
|
|
3096
3585
|
var active = false;
|
|
3097
3586
|
var paused = false;
|
|
3098
3587
|
var native = false;
|
|
@@ -3100,8 +3589,7 @@ var nativeTimer = 0;
|
|
|
3100
3589
|
var mark = { at: null, pressed: false, held: false };
|
|
3101
3590
|
var host2 = null;
|
|
3102
3591
|
var dot = null;
|
|
3103
|
-
var
|
|
3104
|
-
var over = null;
|
|
3592
|
+
var hold2 = null;
|
|
3105
3593
|
var gesture = null;
|
|
3106
3594
|
var nextId = 1;
|
|
3107
3595
|
var finishTimer = 0;
|
|
@@ -3165,89 +3653,6 @@ function pressDot(pressed) {
|
|
|
3165
3653
|
mark = { ...mark, pressed };
|
|
3166
3654
|
render();
|
|
3167
3655
|
}
|
|
3168
|
-
function layered() {
|
|
3169
|
-
return typeof HTMLElement.prototype.showPopover === "function";
|
|
3170
|
-
}
|
|
3171
|
-
function raise() {
|
|
3172
|
-
if (!host2)
|
|
3173
|
-
return;
|
|
3174
|
-
try {
|
|
3175
|
-
if (host2.matches(":popover-open"))
|
|
3176
|
-
host2.hidePopover();
|
|
3177
|
-
host2.showPopover();
|
|
3178
|
-
} catch {}
|
|
3179
|
-
}
|
|
3180
|
-
var TOP_LAYER = [":popover-open", ":modal", ":fullscreen"];
|
|
3181
|
-
function inTopLayer(node) {
|
|
3182
|
-
if (!(node instanceof Element))
|
|
3183
|
-
return false;
|
|
3184
|
-
for (let index = 0;index < TOP_LAYER.length; index++) {
|
|
3185
|
-
try {
|
|
3186
|
-
if (node.matches(TOP_LAYER[index] ?? ""))
|
|
3187
|
-
return true;
|
|
3188
|
-
} catch {}
|
|
3189
|
-
}
|
|
3190
|
-
return false;
|
|
3191
|
-
}
|
|
3192
|
-
function raiseOver(event) {
|
|
3193
|
-
if (!host2 || !layered())
|
|
3194
|
-
return;
|
|
3195
|
-
const found = topLayerOf(event.composedPath(), inTopLayer);
|
|
3196
|
-
if (found === over)
|
|
3197
|
-
return;
|
|
3198
|
-
over = found;
|
|
3199
|
-
if (found)
|
|
3200
|
-
raise();
|
|
3201
|
-
}
|
|
3202
|
-
function onToggle(event) {
|
|
3203
|
-
const target = event.composedPath()[0];
|
|
3204
|
-
const own = target === host2;
|
|
3205
|
-
if (own)
|
|
3206
|
-
event.stopImmediatePropagation();
|
|
3207
|
-
if (!(target instanceof Element))
|
|
3208
|
-
return;
|
|
3209
|
-
const newState = "newState" in event ? event.newState : undefined;
|
|
3210
|
-
if (!raises({ newState, tag: target.tagName, own }))
|
|
3211
|
-
return;
|
|
3212
|
-
if (event.type === "beforetoggle")
|
|
3213
|
-
queueMicrotask(raise);
|
|
3214
|
-
else
|
|
3215
|
-
raise();
|
|
3216
|
-
}
|
|
3217
|
-
function onFullscreen() {
|
|
3218
|
-
if (document.fullscreenElement)
|
|
3219
|
-
raise();
|
|
3220
|
-
}
|
|
3221
|
-
function onDialogs(records) {
|
|
3222
|
-
const opened = records.some((record) => record.target instanceof Element && dialogOpened({
|
|
3223
|
-
tag: record.target.tagName,
|
|
3224
|
-
was: record.oldValue,
|
|
3225
|
-
open: record.target.hasAttribute("open")
|
|
3226
|
-
}));
|
|
3227
|
-
if (opened)
|
|
3228
|
-
raise();
|
|
3229
|
-
}
|
|
3230
|
-
function watchTopLayer() {
|
|
3231
|
-
window.addEventListener("beforetoggle", onToggle, true);
|
|
3232
|
-
window.addEventListener("toggle", onToggle, true);
|
|
3233
|
-
window.addEventListener("fullscreenchange", onFullscreen, true);
|
|
3234
|
-
if (typeof MutationObserver !== "function")
|
|
3235
|
-
return;
|
|
3236
|
-
dialogs = new MutationObserver(onDialogs);
|
|
3237
|
-
dialogs.observe(document.documentElement, {
|
|
3238
|
-
subtree: true,
|
|
3239
|
-
attributes: true,
|
|
3240
|
-
attributeFilter: ["open"],
|
|
3241
|
-
attributeOldValue: true
|
|
3242
|
-
});
|
|
3243
|
-
}
|
|
3244
|
-
function unwatchTopLayer() {
|
|
3245
|
-
window.removeEventListener("beforetoggle", onToggle, true);
|
|
3246
|
-
window.removeEventListener("toggle", onToggle, true);
|
|
3247
|
-
window.removeEventListener("fullscreenchange", onFullscreen, true);
|
|
3248
|
-
dialogs?.disconnect();
|
|
3249
|
-
dialogs = null;
|
|
3250
|
-
}
|
|
3251
3656
|
function mountDot() {
|
|
3252
3657
|
if (host2)
|
|
3253
3658
|
return;
|
|
@@ -3260,18 +3665,14 @@ function mountDot() {
|
|
|
3260
3665
|
dot.hidden = true;
|
|
3261
3666
|
root.append(dot);
|
|
3262
3667
|
document.documentElement.append(host2);
|
|
3263
|
-
|
|
3264
|
-
return;
|
|
3265
|
-
host2.setAttribute("popover", "manual");
|
|
3266
|
-
watchTopLayer();
|
|
3267
|
-
raise();
|
|
3668
|
+
hold2 = holdInTopLayer(host2, LAYER.touch);
|
|
3268
3669
|
}
|
|
3269
3670
|
function unmountDot() {
|
|
3270
|
-
|
|
3671
|
+
hold2?.release();
|
|
3672
|
+
hold2 = null;
|
|
3271
3673
|
host2?.remove();
|
|
3272
3674
|
host2 = null;
|
|
3273
3675
|
dot = null;
|
|
3274
|
-
over = null;
|
|
3275
3676
|
}
|
|
3276
3677
|
function sendTouch(type, current, event, cancelable) {
|
|
3277
3678
|
if (!touchable())
|
|
@@ -3476,6 +3877,19 @@ function patchPointer(event) {
|
|
|
3476
3877
|
Object.defineProperty(event, "pointerType", { configurable: true, get: () => "touch" });
|
|
3477
3878
|
Object.defineProperty(event, "isPrimary", { configurable: true, get: () => true });
|
|
3478
3879
|
}
|
|
3880
|
+
function fingerAt(event) {
|
|
3881
|
+
let origin = { x: 0, y: 0 };
|
|
3882
|
+
try {
|
|
3883
|
+
const host3 = window.frameElement;
|
|
3884
|
+
if (host3 && "offsetWidth" in host3 && typeof host3.offsetWidth === "number" && host3.offsetWidth > 0) {
|
|
3885
|
+
const box = host3.getBoundingClientRect();
|
|
3886
|
+
const scale = box.width / host3.offsetWidth;
|
|
3887
|
+
if (scale > 0)
|
|
3888
|
+
origin = { x: box.left / scale, y: box.top / scale };
|
|
3889
|
+
}
|
|
3890
|
+
} catch {}
|
|
3891
|
+
return { x: event.clientX + origin.x, y: event.clientY + origin.y };
|
|
3892
|
+
}
|
|
3479
3893
|
function onPointerDown(event) {
|
|
3480
3894
|
stopFling();
|
|
3481
3895
|
finish();
|
|
@@ -3484,15 +3898,16 @@ function onPointerDown(event) {
|
|
|
3484
3898
|
native = event.button !== 0 || !(target instanceof Element) || isNative(target) || onScrollbar(target, event);
|
|
3485
3899
|
if (native || !(target instanceof Element))
|
|
3486
3900
|
return;
|
|
3901
|
+
const finger = fingerAt(event);
|
|
3487
3902
|
const current = {
|
|
3488
3903
|
id: nextId++,
|
|
3489
3904
|
pointerId: event.pointerId,
|
|
3490
3905
|
target,
|
|
3491
|
-
startX:
|
|
3492
|
-
startY:
|
|
3493
|
-
lastX:
|
|
3494
|
-
lastY:
|
|
3495
|
-
samples: [{ t: performance.now(), x:
|
|
3906
|
+
startX: finger.x,
|
|
3907
|
+
startY: finger.y,
|
|
3908
|
+
lastX: finger.x,
|
|
3909
|
+
lastY: finger.y,
|
|
3910
|
+
samples: [{ t: performance.now(), x: finger.x, y: finger.y }],
|
|
3496
3911
|
dragged: false,
|
|
3497
3912
|
claimed: false,
|
|
3498
3913
|
quiet: false,
|
|
@@ -3510,15 +3925,16 @@ function onPointerMove(event) {
|
|
|
3510
3925
|
if (!current || current.ended || event.pointerId !== current.pointerId)
|
|
3511
3926
|
return;
|
|
3512
3927
|
const now2 = performance.now();
|
|
3513
|
-
const
|
|
3514
|
-
const
|
|
3515
|
-
|
|
3516
|
-
current.
|
|
3517
|
-
current.
|
|
3928
|
+
const finger = fingerAt(event);
|
|
3929
|
+
const stepX = finger.x - current.lastX;
|
|
3930
|
+
const stepY = finger.y - current.lastY;
|
|
3931
|
+
current.lastX = finger.x;
|
|
3932
|
+
current.lastY = finger.y;
|
|
3933
|
+
current.samples.push({ t: now2, x: finger.x, y: finger.y });
|
|
3518
3934
|
while ((current.samples[0]?.t ?? now2) < now2 - VELOCITY_WINDOW * 2)
|
|
3519
3935
|
current.samples.shift();
|
|
3520
|
-
const dx =
|
|
3521
|
-
const dy =
|
|
3936
|
+
const dx = finger.x - current.startX;
|
|
3937
|
+
const dy = finger.y - current.startY;
|
|
3522
3938
|
if (!current.dragged && passedSlop(dx, dy)) {
|
|
3523
3939
|
current.dragged = true;
|
|
3524
3940
|
ensureStyle("touch-drag").textContent = DRAG_CSS;
|
|
@@ -3570,8 +3986,6 @@ function onEvent(event) {
|
|
|
3570
3986
|
hideDot();
|
|
3571
3987
|
else if (type !== "pointerleave" && type !== "pointerout")
|
|
3572
3988
|
showDot(event);
|
|
3573
|
-
if (type === "pointerover" || type === "pointermove" || type === "pointerdown")
|
|
3574
|
-
raiseOver(event);
|
|
3575
3989
|
if (type === "pointerdown")
|
|
3576
3990
|
pressDot(true);
|
|
3577
3991
|
else if (type === "pointerup" || type === "pointercancel")
|
|
@@ -3658,7 +4072,7 @@ function hideCursor() {
|
|
|
3658
4072
|
handUp(mark);
|
|
3659
4073
|
unmountDot();
|
|
3660
4074
|
}
|
|
3661
|
-
function
|
|
4075
|
+
function apply18(on3) {
|
|
3662
4076
|
if (on3 === active)
|
|
3663
4077
|
return;
|
|
3664
4078
|
active = on3;
|
|
@@ -3675,8 +4089,8 @@ function apply16(on3) {
|
|
|
3675
4089
|
stopFling();
|
|
3676
4090
|
hideCursor();
|
|
3677
4091
|
}
|
|
3678
|
-
function
|
|
3679
|
-
|
|
4092
|
+
function reset17() {
|
|
4093
|
+
apply18(false);
|
|
3680
4094
|
}
|
|
3681
4095
|
function pause(on3) {
|
|
3682
4096
|
if (on3 === paused)
|
|
@@ -3694,7 +4108,7 @@ function pause(on3) {
|
|
|
3694
4108
|
|
|
3695
4109
|
// src/engine/frames.ts
|
|
3696
4110
|
var kit = null;
|
|
3697
|
-
var load2 = () => import("./framekit-
|
|
4111
|
+
var load2 = () => import("./framekit-te90cjs0.js");
|
|
3698
4112
|
var loading = null;
|
|
3699
4113
|
var down = false;
|
|
3700
4114
|
var waiting = [];
|
|
@@ -3733,12 +4147,12 @@ function failed(error) {
|
|
|
3733
4147
|
dropEarly();
|
|
3734
4148
|
exit?.();
|
|
3735
4149
|
}
|
|
3736
|
-
function whenIn(
|
|
4150
|
+
function whenIn(watch3) {
|
|
3737
4151
|
if (kit)
|
|
3738
|
-
return
|
|
4152
|
+
return watch3(kit);
|
|
3739
4153
|
let stop2 = null;
|
|
3740
4154
|
const run = (loaded) => {
|
|
3741
|
-
stop2 =
|
|
4155
|
+
stop2 = watch3(loaded);
|
|
3742
4156
|
};
|
|
3743
4157
|
waiting.push(run);
|
|
3744
4158
|
return () => {
|
|
@@ -3748,7 +4162,7 @@ function whenIn(watch2) {
|
|
|
3748
4162
|
stop2?.();
|
|
3749
4163
|
};
|
|
3750
4164
|
}
|
|
3751
|
-
function
|
|
4165
|
+
function apply19(state) {
|
|
3752
4166
|
if (kit) {
|
|
3753
4167
|
kit.width.apply(state);
|
|
3754
4168
|
return;
|
|
@@ -3769,7 +4183,7 @@ function apply17(state) {
|
|
|
3769
4183
|
function sync(state) {
|
|
3770
4184
|
kit?.width.sync(state);
|
|
3771
4185
|
}
|
|
3772
|
-
function
|
|
4186
|
+
function reset18() {
|
|
3773
4187
|
kit?.width.reset();
|
|
3774
4188
|
before = null;
|
|
3775
4189
|
latest = null;
|
|
@@ -3865,30 +4279,32 @@ function applyState(next) {
|
|
|
3865
4279
|
transparency: page.transparency,
|
|
3866
4280
|
touch: touchScreen
|
|
3867
4281
|
});
|
|
3868
|
-
|
|
4282
|
+
apply7({
|
|
3869
4283
|
on: touchScreen || nativeTouch,
|
|
3870
4284
|
points: !nativeTouch && uaPreset(state.ua.preset) === undefined
|
|
3871
4285
|
});
|
|
3872
|
-
|
|
3873
|
-
apply5(
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
4286
|
+
apply18(touchScreen && state.touchPointer);
|
|
4287
|
+
apply5(inFrame ? screenSizeOf(state) : null);
|
|
4288
|
+
apply6(touchScreen);
|
|
4289
|
+
apply17(state.speed);
|
|
4290
|
+
apply8(state.locale);
|
|
4291
|
+
apply14(state.pseudo);
|
|
3877
4292
|
apply(state.geo);
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
4293
|
+
apply9(resolveTimeZone(state.timeZone, state.geo), state.clock);
|
|
4294
|
+
apply10(state.clock);
|
|
4295
|
+
apply11(page.network);
|
|
3881
4296
|
apply2(page.text);
|
|
3882
4297
|
if (active2 && !inFrame)
|
|
3883
4298
|
drive(active2, state);
|
|
3884
4299
|
else if (native2 && !inFrame)
|
|
3885
4300
|
driveUa(native2, state);
|
|
3886
|
-
|
|
4301
|
+
apply15(state.spacing);
|
|
3887
4302
|
apply4(state.ua);
|
|
3888
4303
|
const sized2 = inFrame ? state : framing(state, active2);
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
4304
|
+
apply19(sized2);
|
|
4305
|
+
apply13(state.overflow && !needsFrame(sized2));
|
|
4306
|
+
apply12(state.outlines);
|
|
4307
|
+
apply16(!inFrame && shownHere(state.panel.devIcon));
|
|
3892
4308
|
if (persist)
|
|
3893
4309
|
save(state);
|
|
3894
4310
|
sync(sized2);
|
|
@@ -3928,7 +4344,7 @@ function keepPlace2() {
|
|
|
3928
4344
|
if (persist)
|
|
3929
4345
|
keepPlace(state);
|
|
3930
4346
|
}
|
|
3931
|
-
function
|
|
4347
|
+
function reset19() {
|
|
3932
4348
|
applyState(resetState(state));
|
|
3933
4349
|
}
|
|
3934
4350
|
function onMessage(event) {
|
|
@@ -3994,22 +4410,24 @@ function stop2() {
|
|
|
3994
4410
|
onRefused(null);
|
|
3995
4411
|
onFramed(null);
|
|
3996
4412
|
destroy();
|
|
3997
|
-
reset5();
|
|
3998
|
-
reset15();
|
|
3999
|
-
reset4();
|
|
4000
|
-
reset14();
|
|
4001
4413
|
reset6();
|
|
4002
|
-
|
|
4003
|
-
|
|
4414
|
+
reset17();
|
|
4415
|
+
reset4();
|
|
4416
|
+
reset5();
|
|
4417
|
+
reset16();
|
|
4004
4418
|
reset7();
|
|
4419
|
+
reset13();
|
|
4420
|
+
reset();
|
|
4005
4421
|
reset8();
|
|
4006
4422
|
reset9();
|
|
4423
|
+
reset10();
|
|
4007
4424
|
reset2();
|
|
4008
|
-
|
|
4425
|
+
reset14();
|
|
4009
4426
|
reset3();
|
|
4010
|
-
|
|
4427
|
+
reset18();
|
|
4428
|
+
reset12();
|
|
4011
4429
|
reset11();
|
|
4012
|
-
|
|
4430
|
+
reset15();
|
|
4013
4431
|
if (native2)
|
|
4014
4432
|
release(native2);
|
|
4015
4433
|
native2 = null;
|
|
@@ -4560,4 +4978,4 @@ function glyph(name, size = 14) {
|
|
|
4560
4978
|
return isBrand(name) ? brand(name, size) : icon(name, size);
|
|
4561
4979
|
}
|
|
4562
4980
|
|
|
4563
|
-
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace,
|
|
4981
|
+
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, devIconShown, devIconFor, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, LAYER, HOST_RESET, holdInTopLayer, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace, reset19 as reset, start4 as start, stop2 as stop, replay2 as replay, exports_engine, parseCombo, comboText, withShift, isFunctionKey, comboLabel, comboSpoken, defaultKeys, KEYS_FIELD, typesInField, lowerKey, keyIs, keyAction, isSearchKey, typeAhead, zoomAction, escapeStep, highlightAt, paletteMove, radioMove, forwardKeys, ROW_ICONS, rowIcon, BINDING_ICONS, icon, glyph };
|