@vinena/knobs 0.5.1 → 0.5.3
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 +29 -0
- package/README.md +7 -0
- package/dist/early.global.js +6 -6
- package/dist/{elementsview-tf4qzmtw.js → elementsview-1wsxcdtj.js} +4 -4
- package/dist/{elementsview-jnkbhzkj.js → elementsview-3kv34jfx.js} +4 -4
- package/dist/engine/browserdraw.d.ts +29 -2
- package/dist/engine/browserkit.d.ts +20 -1
- package/dist/engine/browserui.d.ts +162 -22
- package/dist/engine/devices.d.ts +3 -2
- 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/frames.d.ts +1 -0
- package/dist/engine/identity.d.ts +12 -5
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/mock.d.ts +14 -0
- package/dist/engine/mockdata.d.ts +5 -1
- package/dist/engine/morphrun.d.ts +4 -0
- package/dist/engine/native.d.ts +31 -3
- package/dist/engine/notice.d.ts +1 -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/engine/width.d.ts +3 -0
- package/dist/{framekit-3n7p79ht.js → framekit-cjz0e4y8.js} +2492 -1587
- package/dist/{framekit-g96t6nmq.js → framekit-yk1jxjv7.js} +2492 -1587
- package/dist/host.d.ts +51 -0
- package/dist/{index-33x9hxe3.js → index-6wbgqkdz.js} +626 -189
- package/dist/{index-2d6wvs8h.js → index-9jhatmky.js} +4 -4
- package/dist/{index-zvze25nf.js → index-begsqdm0.js} +1 -1
- package/dist/{index-peh33xjv.js → index-j1h13ahg.js} +1 -1
- package/dist/{index-5baxvd3v.js → index-p57fdttx.js} +307 -129
- package/dist/{index-dvr4x91q.js → index-prjpx67p.js} +20 -8
- package/dist/{index-d0cjxjsm.js → index-q73py563.js} +1 -1
- package/dist/{index-ke6v7919.js → index-sn2y6j09.js} +20 -8
- package/dist/{index-0casarhy.js → index-vgfn2n1h.js} +1 -1
- package/dist/{index-k015tb6c.js → index-zt3rheck.js} +4 -4
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +299 -176
- package/dist/index.js +424 -124
- package/dist/instance.d.ts +23 -4
- package/dist/{react-qv0nykcv.js → react-3rhdj2k1.js} +623 -186
- package/dist/{react-carf84xv.js → react-6tss0r9f.js} +307 -129
- package/dist/{react-eygws6cx.js → react-7vjfsh40.js} +4 -4
- package/dist/{react-71a9ypex.js → react-806qmkyz.js} +4 -4
- package/dist/{react-65tgdbs8.js → react-gefkdkdz.js} +1 -1
- package/dist/{react-sq9pkw4k.js → react-mmq2zya3.js} +1 -1
- package/dist/{react-xxfpfddf.js → react-qfpg79hs.js} +1 -1
- package/dist/{react-pdvseef0.js → react-qgz9afa2.js} +1 -1
- package/dist/react.js +420 -123
- package/dist/{storageview-sb23henh.js → storageview-7cv0vpdm.js} +4 -4
- package/dist/{storageview-vf8v8q8j.js → storageview-dyhpgt8f.js} +4 -4
- package/dist/types.d.ts +14 -0
- package/dist/ui/footer.d.ts +9 -2
- package/dist/ui/panel.d.ts +16 -2
- package/dist/ui/settings.d.ts +25 -1
- package/dist/version.d.ts +2 -0
- package/package.json +3 -2
- package/skills/devknobs/SKILL.md +1 -1
- package/dist/engine/endroom.d.ts +0 -21
|
@@ -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-p57fdttx.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,11 +1129,12 @@ __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,
|
|
947
1136
|
keepPlace: () => keepPlace2,
|
|
1137
|
+
hostSendsUa: () => hostSendsUa,
|
|
948
1138
|
getState: () => getState,
|
|
949
1139
|
applyState: () => applyState
|
|
950
1140
|
});
|
|
@@ -1670,10 +1860,10 @@ function bodyOf(xhr, type, loaded) {
|
|
|
1670
1860
|
return record.size === 0 ? null : record;
|
|
1671
1861
|
}
|
|
1672
1862
|
var FAILS = ["error", "abort", "timeout"];
|
|
1673
|
-
function
|
|
1863
|
+
function watch2(xhr, id, url, log) {
|
|
1674
1864
|
let outcome = null;
|
|
1675
1865
|
let error = null;
|
|
1676
|
-
let
|
|
1866
|
+
let over2 = false;
|
|
1677
1867
|
let loaded = null;
|
|
1678
1868
|
const unlisten = () => {
|
|
1679
1869
|
xhr.removeEventListener("readystatechange", onState, true);
|
|
@@ -1683,7 +1873,7 @@ function watch(xhr, id, url, log) {
|
|
|
1683
1873
|
xhr.removeEventListener("loadend", onEnd, true);
|
|
1684
1874
|
};
|
|
1685
1875
|
function finish() {
|
|
1686
|
-
|
|
1876
|
+
over2 = true;
|
|
1687
1877
|
unlisten();
|
|
1688
1878
|
try {
|
|
1689
1879
|
const answer = head(xhr, url);
|
|
@@ -1726,9 +1916,9 @@ function watch(xhr, id, url, log) {
|
|
|
1726
1916
|
xhr.addEventListener(type, onFail, true);
|
|
1727
1917
|
xhr.addEventListener("loadend", onEnd, true);
|
|
1728
1918
|
return () => {
|
|
1729
|
-
if (
|
|
1919
|
+
if (over2)
|
|
1730
1920
|
return;
|
|
1731
|
-
|
|
1921
|
+
over2 = true;
|
|
1732
1922
|
unlisten();
|
|
1733
1923
|
log.ended(id, { state: "aborted" });
|
|
1734
1924
|
};
|
|
@@ -1765,7 +1955,7 @@ function patchXhr(patches, log) {
|
|
|
1765
1955
|
const body = describeBody(args[0], headerOf(headers, "content-type"));
|
|
1766
1956
|
const initiator = trimStack(new Error().stack, 1);
|
|
1767
1957
|
id = log.start("xhr", { method, url, headers: [...headers], body, initiator });
|
|
1768
|
-
request.drop =
|
|
1958
|
+
request.drop = watch2(this, id, url, log);
|
|
1769
1959
|
} catch {}
|
|
1770
1960
|
try {
|
|
1771
1961
|
return original.apply(this, args);
|
|
@@ -2020,14 +2210,14 @@ function restore2() {
|
|
|
2020
2210
|
}
|
|
2021
2211
|
installed2 = [];
|
|
2022
2212
|
}
|
|
2023
|
-
function
|
|
2213
|
+
function apply10(value) {
|
|
2024
2214
|
on = sends(value);
|
|
2025
2215
|
if (on)
|
|
2026
2216
|
patch();
|
|
2027
2217
|
else
|
|
2028
2218
|
restore2();
|
|
2029
2219
|
}
|
|
2030
|
-
function
|
|
2220
|
+
function reset9() {
|
|
2031
2221
|
on = false;
|
|
2032
2222
|
restore2();
|
|
2033
2223
|
}
|
|
@@ -2059,7 +2249,7 @@ function connection() {
|
|
|
2059
2249
|
function readConnection(target) {
|
|
2060
2250
|
return CONNECTION_KEYS.map((key) => String(Reflect.get(target, key))).join();
|
|
2061
2251
|
}
|
|
2062
|
-
function
|
|
2252
|
+
function apply11(value) {
|
|
2063
2253
|
const wasOnline = navigator.onLine;
|
|
2064
2254
|
if (value.online === "offline")
|
|
2065
2255
|
shadow(navigator, "onLine", false);
|
|
@@ -2087,27 +2277,27 @@ function apply10(value) {
|
|
|
2087
2277
|
if (readConnection(target) !== before)
|
|
2088
2278
|
target.dispatchEvent(new Event("change"));
|
|
2089
2279
|
}
|
|
2090
|
-
function
|
|
2280
|
+
function reset10() {
|
|
2091
2281
|
if (shadowed.size > 0)
|
|
2092
|
-
|
|
2282
|
+
apply11(SYSTEM);
|
|
2093
2283
|
shadowed.clear();
|
|
2094
2284
|
}
|
|
2095
2285
|
|
|
2096
2286
|
// src/engine/outlines.ts
|
|
2097
2287
|
var NAME = "outlines";
|
|
2098
|
-
function
|
|
2288
|
+
function apply12(value) {
|
|
2099
2289
|
if (!value) {
|
|
2100
|
-
|
|
2290
|
+
reset11();
|
|
2101
2291
|
return;
|
|
2102
2292
|
}
|
|
2103
2293
|
ensureStyle(NAME).textContent = "body *:not([data-devknobs],[data-devknobs] *){outline:1px solid rgba(127,127,127,.5)!important}";
|
|
2104
2294
|
}
|
|
2105
|
-
function
|
|
2295
|
+
function reset11() {
|
|
2106
2296
|
removeStyle(NAME);
|
|
2107
2297
|
}
|
|
2108
2298
|
|
|
2109
2299
|
// src/engine/tree.ts
|
|
2110
|
-
function
|
|
2300
|
+
function isOwn2(node) {
|
|
2111
2301
|
let current = node;
|
|
2112
2302
|
while (current) {
|
|
2113
2303
|
if (current instanceof Element && current.closest("[data-devknobs]"))
|
|
@@ -2275,7 +2465,7 @@ function schedule() {
|
|
|
2275
2465
|
});
|
|
2276
2466
|
}
|
|
2277
2467
|
function onMutation(records) {
|
|
2278
|
-
if (timer2 || records.every((record) =>
|
|
2468
|
+
if (timer2 || records.every((record) => isOwn2(record.target)))
|
|
2279
2469
|
return;
|
|
2280
2470
|
timer2 = window.setTimeout(() => {
|
|
2281
2471
|
timer2 = 0;
|
|
@@ -2302,9 +2492,9 @@ function start2() {
|
|
|
2302
2492
|
});
|
|
2303
2493
|
update();
|
|
2304
2494
|
}
|
|
2305
|
-
function
|
|
2495
|
+
function apply13(value) {
|
|
2306
2496
|
if (!value) {
|
|
2307
|
-
|
|
2497
|
+
reset12();
|
|
2308
2498
|
return;
|
|
2309
2499
|
}
|
|
2310
2500
|
if (document.body)
|
|
@@ -2312,7 +2502,7 @@ function apply12(value) {
|
|
|
2312
2502
|
else
|
|
2313
2503
|
document.addEventListener("DOMContentLoaded", start2, { once: true });
|
|
2314
2504
|
}
|
|
2315
|
-
function
|
|
2505
|
+
function reset12() {
|
|
2316
2506
|
document.removeEventListener("DOMContentLoaded", start2);
|
|
2317
2507
|
if (!host)
|
|
2318
2508
|
return;
|
|
@@ -2513,9 +2703,9 @@ function whenIdle(run) {
|
|
|
2513
2703
|
clearTimeout(timer3);
|
|
2514
2704
|
};
|
|
2515
2705
|
}
|
|
2516
|
-
function
|
|
2706
|
+
function apply14(value) {
|
|
2517
2707
|
if (!value) {
|
|
2518
|
-
|
|
2708
|
+
reset13();
|
|
2519
2709
|
return;
|
|
2520
2710
|
}
|
|
2521
2711
|
if (on2 || cancelStart)
|
|
@@ -2525,7 +2715,7 @@ function apply13(value) {
|
|
|
2525
2715
|
function pending() {
|
|
2526
2716
|
return cancelStart !== null;
|
|
2527
2717
|
}
|
|
2528
|
-
function
|
|
2718
|
+
function reset13() {
|
|
2529
2719
|
cancelStart?.();
|
|
2530
2720
|
cancelStart = null;
|
|
2531
2721
|
if (!on2)
|
|
@@ -2603,7 +2793,7 @@ function collect(roots = shadowRoots()) {
|
|
|
2603
2793
|
for (const animation of scope.getAnimations())
|
|
2604
2794
|
found.add(animation);
|
|
2605
2795
|
}
|
|
2606
|
-
return Array.from(found).filter((animation) => !
|
|
2796
|
+
return Array.from(found).filter((animation) => !isOwn2(targetOf(animation)));
|
|
2607
2797
|
}
|
|
2608
2798
|
|
|
2609
2799
|
// src/engine/replay.ts
|
|
@@ -2678,17 +2868,326 @@ function replay() {
|
|
|
2678
2868
|
var NAME2 = "spacing";
|
|
2679
2869
|
var NOT_OURS = ":not([data-devknobs],[data-devknobs] *)";
|
|
2680
2870
|
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
|
|
2871
|
+
function apply15(value) {
|
|
2682
2872
|
if (!value) {
|
|
2683
|
-
|
|
2873
|
+
reset14();
|
|
2684
2874
|
return;
|
|
2685
2875
|
}
|
|
2686
2876
|
ensureStyle(NAME2).textContent = CSS2;
|
|
2687
2877
|
}
|
|
2688
|
-
function
|
|
2878
|
+
function reset14() {
|
|
2689
2879
|
removeStyle(NAME2);
|
|
2690
2880
|
}
|
|
2691
2881
|
|
|
2882
|
+
// src/engine/devicon.ts
|
|
2883
|
+
var RIBBON_YELLOW = "#ffd60a";
|
|
2884
|
+
var RIBBON_INK = "#111111";
|
|
2885
|
+
var RIBBON_TEXT_MIN = 32;
|
|
2886
|
+
function tileBox(data, size) {
|
|
2887
|
+
let x0 = size;
|
|
2888
|
+
let y0 = size;
|
|
2889
|
+
let x1 = -1;
|
|
2890
|
+
let y1 = -1;
|
|
2891
|
+
for (let y = 0;y < size; y++) {
|
|
2892
|
+
for (let x = 0;x < size; x++) {
|
|
2893
|
+
if ((data[(y * size + x) * 4 + 3] ?? 0) <= 128)
|
|
2894
|
+
continue;
|
|
2895
|
+
if (x < x0)
|
|
2896
|
+
x0 = x;
|
|
2897
|
+
if (x > x1)
|
|
2898
|
+
x1 = x;
|
|
2899
|
+
if (y < y0)
|
|
2900
|
+
y0 = y;
|
|
2901
|
+
if (y > y1)
|
|
2902
|
+
y1 = y;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
if (x1 < 0)
|
|
2906
|
+
return { x: 0, y: 0, s: size };
|
|
2907
|
+
const w = x1 - x0 + 1;
|
|
2908
|
+
const h = y1 - y0 + 1;
|
|
2909
|
+
const s = Math.max(w, h);
|
|
2910
|
+
return { x: x0 - (s - w) / 2, y: y0 - (s - h) / 2, s };
|
|
2911
|
+
}
|
|
2912
|
+
function ribbonGeometry(size, box) {
|
|
2913
|
+
const width = 0.3 * box.s;
|
|
2914
|
+
const distance = (size <= 20 ? 0.2 : 0.22) * box.s;
|
|
2915
|
+
const textSize = 0.62 * width;
|
|
2916
|
+
return {
|
|
2917
|
+
box,
|
|
2918
|
+
radius: 0.225 * box.s,
|
|
2919
|
+
origin: { x: box.x + box.s, y: box.y },
|
|
2920
|
+
angle: Math.PI / 4,
|
|
2921
|
+
width,
|
|
2922
|
+
distance,
|
|
2923
|
+
edge: Math.max(1, box.s / 40),
|
|
2924
|
+
reach: 2 * box.s,
|
|
2925
|
+
text: size >= RIBBON_TEXT_MIN ? { size: textSize, y: distance + width / 2 + 0.04 * textSize } : null
|
|
2926
|
+
};
|
|
2927
|
+
}
|
|
2928
|
+
function drawDevIcon(context, size, source) {
|
|
2929
|
+
context.clearRect(0, 0, size, size);
|
|
2930
|
+
const w = source.width || size;
|
|
2931
|
+
const h = source.height || size;
|
|
2932
|
+
const scale = size / Math.max(w, h);
|
|
2933
|
+
context.drawImage(source, (size - w * scale) / 2, (size - h * scale) / 2, w * scale, h * scale);
|
|
2934
|
+
const box = tileBox(context.getImageData(0, 0, size, size).data, size);
|
|
2935
|
+
const g = ribbonGeometry(size, box);
|
|
2936
|
+
context.save();
|
|
2937
|
+
context.beginPath();
|
|
2938
|
+
context.roundRect(box.x, box.y, box.s, box.s, g.radius);
|
|
2939
|
+
context.clip();
|
|
2940
|
+
context.translate(g.origin.x, g.origin.y);
|
|
2941
|
+
context.rotate(g.angle);
|
|
2942
|
+
context.fillStyle = RIBBON_INK;
|
|
2943
|
+
context.fillRect(-g.reach, g.distance - g.edge, 2 * g.reach, g.width + 2 * g.edge);
|
|
2944
|
+
context.fillStyle = RIBBON_YELLOW;
|
|
2945
|
+
context.fillRect(-g.reach, g.distance, 2 * g.reach, g.width);
|
|
2946
|
+
if (g.text) {
|
|
2947
|
+
context.fillStyle = RIBBON_INK;
|
|
2948
|
+
context.font = `700 ${g.text.size}px -apple-system, system-ui, sans-serif`;
|
|
2949
|
+
context.textAlign = "center";
|
|
2950
|
+
context.textBaseline = "middle";
|
|
2951
|
+
context.fillText("DEV", 0, g.text.y);
|
|
2952
|
+
}
|
|
2953
|
+
context.restore();
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
// src/engine/tabicon.ts
|
|
2957
|
+
var ORIGINAL_HREF = "data-devknobs-href";
|
|
2958
|
+
var ADDED_ICON = "data-devknobs-icon";
|
|
2959
|
+
var FALLBACK = "/favicon.ico";
|
|
2960
|
+
var TOUCH_RELS = ["apple-touch-icon", "apple-touch-icon-precomposed"];
|
|
2961
|
+
function localHost(hostname) {
|
|
2962
|
+
const host2 = hostname.toLowerCase().replace(/\.$/, "");
|
|
2963
|
+
if (host2 === "localhost" || host2.endsWith(".localhost") || host2.endsWith(".local"))
|
|
2964
|
+
return true;
|
|
2965
|
+
if (host2 === "[::1]" || host2 === "::1" || host2 === "0.0.0.0")
|
|
2966
|
+
return true;
|
|
2967
|
+
if (/^\[?(f[cd][0-9a-f]{2}|fe[89ab][0-9a-f]):/.test(host2))
|
|
2968
|
+
return true;
|
|
2969
|
+
const ip = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host2);
|
|
2970
|
+
if (!ip)
|
|
2971
|
+
return false;
|
|
2972
|
+
const [a = 0, b = 0, ...rest] = ip.slice(1).map(Number);
|
|
2973
|
+
if ([a, b, ...rest].some((part) => part > 255))
|
|
2974
|
+
return false;
|
|
2975
|
+
return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
2976
|
+
}
|
|
2977
|
+
function devIconShown(value, hostname) {
|
|
2978
|
+
return value === "on" || value === "auto" && localHost(hostname);
|
|
2979
|
+
}
|
|
2980
|
+
function devIconFor(on3, hostname) {
|
|
2981
|
+
if (on3 === localHost(hostname))
|
|
2982
|
+
return "auto";
|
|
2983
|
+
return on3 ? "on" : "off";
|
|
2984
|
+
}
|
|
2985
|
+
function shownHere(value) {
|
|
2986
|
+
if (typeof window === "undefined" || typeof document === "undefined")
|
|
2987
|
+
return false;
|
|
2988
|
+
return window.top === window && devIconShown(value, window.location.hostname);
|
|
2989
|
+
}
|
|
2990
|
+
function relTokens(link) {
|
|
2991
|
+
return (link.getAttribute("rel") ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
2992
|
+
}
|
|
2993
|
+
function isIconLink(node) {
|
|
2994
|
+
if (typeof node !== "object" || node === null)
|
|
2995
|
+
return false;
|
|
2996
|
+
const link = node;
|
|
2997
|
+
if (link.nodeType !== 1 || link.localName !== "link")
|
|
2998
|
+
return false;
|
|
2999
|
+
return relTokens(link).some((rel) => rel === "icon" || TOUCH_RELS.includes(rel));
|
|
3000
|
+
}
|
|
3001
|
+
var SIZE_MIN = 16;
|
|
3002
|
+
var SIZE_MAX = 512;
|
|
3003
|
+
function iconSize(link) {
|
|
3004
|
+
const declared = /^(\d+)x(\d+)$/i.exec((link.getAttribute("sizes") ?? "").trim().split(/\s+/)[0] ?? "");
|
|
3005
|
+
const width = declared ? Number(declared[1]) : 0;
|
|
3006
|
+
if (width > 0)
|
|
3007
|
+
return Math.min(SIZE_MAX, Math.max(SIZE_MIN, width));
|
|
3008
|
+
return relTokens(link).some((rel) => TOUCH_RELS.includes(rel)) ? 180 : 32;
|
|
3009
|
+
}
|
|
3010
|
+
function createTabIcon(env) {
|
|
3011
|
+
const doc = env.document;
|
|
3012
|
+
let on3 = false;
|
|
3013
|
+
let observer3 = null;
|
|
3014
|
+
const drawn = new Map;
|
|
3015
|
+
const loading = new Map;
|
|
3016
|
+
let added = null;
|
|
3017
|
+
let told = false;
|
|
3018
|
+
function iconLinks() {
|
|
3019
|
+
return Array.from(doc.querySelectorAll("link")).filter(isIconLink);
|
|
3020
|
+
}
|
|
3021
|
+
function swap(link) {
|
|
3022
|
+
if (!on3 || !isIconLink(link))
|
|
3023
|
+
return;
|
|
3024
|
+
const current = link.getAttribute("href");
|
|
3025
|
+
if (!current)
|
|
3026
|
+
return;
|
|
3027
|
+
const mine = drawn.get(link);
|
|
3028
|
+
const href = mine?.url === current ? mine.original : current;
|
|
3029
|
+
if (loading.get(link) === href)
|
|
3030
|
+
return;
|
|
3031
|
+
loading.set(link, href);
|
|
3032
|
+
env.load(href).then((source) => {
|
|
3033
|
+
if (loading.get(link) !== href)
|
|
3034
|
+
return;
|
|
3035
|
+
loading.delete(link);
|
|
3036
|
+
if (!on3 || link.getAttribute("href") !== current)
|
|
3037
|
+
return;
|
|
3038
|
+
const url = source ? env.render(source, iconSize(link)) : null;
|
|
3039
|
+
if (!url) {
|
|
3040
|
+
if (!told)
|
|
3041
|
+
console.debug(`devknobs: the tab icon ${href} could not be read, so it shows no dev ribbon`);
|
|
3042
|
+
told = true;
|
|
3043
|
+
return;
|
|
3044
|
+
}
|
|
3045
|
+
drawn.set(link, { url, original: href });
|
|
3046
|
+
link.setAttribute(ORIGINAL_HREF, href);
|
|
3047
|
+
link.setAttribute("href", url);
|
|
3048
|
+
});
|
|
3049
|
+
}
|
|
3050
|
+
function forget(link) {
|
|
3051
|
+
loading.delete(link);
|
|
3052
|
+
const mine = drawn.get(link);
|
|
3053
|
+
if (!mine)
|
|
3054
|
+
return;
|
|
3055
|
+
drawn.delete(link);
|
|
3056
|
+
if (link.getAttribute("href") === mine.url)
|
|
3057
|
+
link.setAttribute("href", mine.original);
|
|
3058
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
3059
|
+
}
|
|
3060
|
+
function linksIn(node) {
|
|
3061
|
+
if (isIconLink(node))
|
|
3062
|
+
return [node];
|
|
3063
|
+
if (node.nodeType !== 1)
|
|
3064
|
+
return [];
|
|
3065
|
+
return Array.from(node.querySelectorAll("link")).filter(isIconLink);
|
|
3066
|
+
}
|
|
3067
|
+
function fallback() {
|
|
3068
|
+
env.load(FALLBACK).then((source) => {
|
|
3069
|
+
if (!on3 || !source || added || iconLinks().length > 0)
|
|
3070
|
+
return;
|
|
3071
|
+
const link = doc.createElement("link");
|
|
3072
|
+
link.setAttribute("rel", "icon");
|
|
3073
|
+
link.setAttribute("href", FALLBACK);
|
|
3074
|
+
link.setAttribute(ADDED_ICON, "");
|
|
3075
|
+
added = link;
|
|
3076
|
+
(doc.head ?? doc.documentElement).append(link);
|
|
3077
|
+
swap(link);
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
function watch3(records) {
|
|
3081
|
+
for (const record of records) {
|
|
3082
|
+
if (record.type === "attributes") {
|
|
3083
|
+
const link = record.target;
|
|
3084
|
+
if (!isIconLink(link)) {
|
|
3085
|
+
forget(link);
|
|
3086
|
+
continue;
|
|
3087
|
+
}
|
|
3088
|
+
if (record.attributeName === "href" && drawn.get(link)?.url === link.getAttribute("href"))
|
|
3089
|
+
continue;
|
|
3090
|
+
swap(link);
|
|
3091
|
+
continue;
|
|
3092
|
+
}
|
|
3093
|
+
for (const node of Array.from(record.removedNodes)) {
|
|
3094
|
+
for (const link of linksIn(node))
|
|
3095
|
+
if (link !== added)
|
|
3096
|
+
forget(link);
|
|
3097
|
+
}
|
|
3098
|
+
for (const node of Array.from(record.addedNodes)) {
|
|
3099
|
+
for (const link of linksIn(node)) {
|
|
3100
|
+
if (link !== added && added) {
|
|
3101
|
+
added.remove();
|
|
3102
|
+
added = null;
|
|
3103
|
+
}
|
|
3104
|
+
swap(link);
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
return {
|
|
3110
|
+
start() {
|
|
3111
|
+
if (on3)
|
|
3112
|
+
return;
|
|
3113
|
+
on3 = true;
|
|
3114
|
+
const links = iconLinks();
|
|
3115
|
+
for (const link of links)
|
|
3116
|
+
swap(link);
|
|
3117
|
+
if (links.length === 0)
|
|
3118
|
+
fallback();
|
|
3119
|
+
if (!env.Observer)
|
|
3120
|
+
return;
|
|
3121
|
+
observer3 = new env.Observer(watch3);
|
|
3122
|
+
observer3.observe(doc.documentElement, {
|
|
3123
|
+
childList: true,
|
|
3124
|
+
subtree: true,
|
|
3125
|
+
attributes: true,
|
|
3126
|
+
attributeFilter: ["href", "rel", "sizes"]
|
|
3127
|
+
});
|
|
3128
|
+
},
|
|
3129
|
+
stop() {
|
|
3130
|
+
if (!on3)
|
|
3131
|
+
return;
|
|
3132
|
+
on3 = false;
|
|
3133
|
+
observer3?.disconnect();
|
|
3134
|
+
observer3 = null;
|
|
3135
|
+
loading.clear();
|
|
3136
|
+
for (const [link, { url, original }] of drawn) {
|
|
3137
|
+
if (link.getAttribute("href") === url)
|
|
3138
|
+
link.setAttribute("href", original);
|
|
3139
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
3140
|
+
}
|
|
3141
|
+
drawn.clear();
|
|
3142
|
+
added?.remove();
|
|
3143
|
+
added = null;
|
|
3144
|
+
}
|
|
3145
|
+
};
|
|
3146
|
+
}
|
|
3147
|
+
function loadImage(href) {
|
|
3148
|
+
return new Promise((resolve) => {
|
|
3149
|
+
const image = new Image;
|
|
3150
|
+
image.crossOrigin = "anonymous";
|
|
3151
|
+
image.onload = () => resolve(image);
|
|
3152
|
+
image.onerror = () => resolve(null);
|
|
3153
|
+
image.src = href;
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
function renderPng(source, size) {
|
|
3157
|
+
try {
|
|
3158
|
+
const canvas = document.createElement("canvas");
|
|
3159
|
+
canvas.width = size;
|
|
3160
|
+
canvas.height = size;
|
|
3161
|
+
const context = canvas.getContext("2d");
|
|
3162
|
+
if (!context)
|
|
3163
|
+
return null;
|
|
3164
|
+
drawDevIcon(context, size, source);
|
|
3165
|
+
return canvas.toDataURL("image/png");
|
|
3166
|
+
} catch {
|
|
3167
|
+
return null;
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
var live = null;
|
|
3171
|
+
function apply16(on3) {
|
|
3172
|
+
if (!on3) {
|
|
3173
|
+
reset15();
|
|
3174
|
+
return;
|
|
3175
|
+
}
|
|
3176
|
+
if (live || typeof document === "undefined")
|
|
3177
|
+
return;
|
|
3178
|
+
live = createTabIcon({
|
|
3179
|
+
document,
|
|
3180
|
+
load: loadImage,
|
|
3181
|
+
render: renderPng,
|
|
3182
|
+
Observer: typeof MutationObserver === "undefined" ? undefined : MutationObserver
|
|
3183
|
+
});
|
|
3184
|
+
live.start();
|
|
3185
|
+
}
|
|
3186
|
+
function reset15() {
|
|
3187
|
+
live?.stop();
|
|
3188
|
+
live = null;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
2692
3191
|
// src/engine/speed.ts
|
|
2693
3192
|
var SPEED_MIN = 0;
|
|
2694
3193
|
var SPEED_MAX = 16;
|
|
@@ -2767,7 +3266,7 @@ function tick(now2) {
|
|
|
2767
3266
|
}
|
|
2768
3267
|
function onStart(event) {
|
|
2769
3268
|
const target = event.target;
|
|
2770
|
-
if (!(target instanceof Element) ||
|
|
3269
|
+
if (!(target instanceof Element) || isOwn2(target))
|
|
2771
3270
|
return;
|
|
2772
3271
|
for (const animation of target.getAnimations({ subtree: event.pseudoElement !== "" })) {
|
|
2773
3272
|
adopt(animation);
|
|
@@ -2780,7 +3279,7 @@ function patchAnimate() {
|
|
|
2780
3279
|
nativeAnimate = native;
|
|
2781
3280
|
patchedAnimate = function animate(...args) {
|
|
2782
3281
|
const animation = native.apply(this, args);
|
|
2783
|
-
if (rate !== 1 && !
|
|
3282
|
+
if (rate !== 1 && !isOwn2(this))
|
|
2784
3283
|
adopt(animation);
|
|
2785
3284
|
return animation;
|
|
2786
3285
|
};
|
|
@@ -2793,10 +3292,10 @@ function restoreAnimate() {
|
|
|
2793
3292
|
nativeAnimate = null;
|
|
2794
3293
|
patchedAnimate = null;
|
|
2795
3294
|
}
|
|
2796
|
-
function
|
|
3295
|
+
function apply17(value) {
|
|
2797
3296
|
const next = Number.isFinite(value) && value >= 0 ? value : 1;
|
|
2798
3297
|
if (next === 1) {
|
|
2799
|
-
|
|
3298
|
+
reset16();
|
|
2800
3299
|
return;
|
|
2801
3300
|
}
|
|
2802
3301
|
if (next === rate && frame2)
|
|
@@ -2815,7 +3314,7 @@ function apply15(value) {
|
|
|
2815
3314
|
if (!frame2)
|
|
2816
3315
|
frame2 = requestAnimationFrame(tick);
|
|
2817
3316
|
}
|
|
2818
|
-
function
|
|
3317
|
+
function reset16() {
|
|
2819
3318
|
rate = 1;
|
|
2820
3319
|
if (frame2) {
|
|
2821
3320
|
cancelAnimationFrame(frame2);
|
|
@@ -3006,7 +3505,7 @@ var EVENTS = [
|
|
|
3006
3505
|
"dragstart",
|
|
3007
3506
|
"selectstart"
|
|
3008
3507
|
];
|
|
3009
|
-
var CURSOR_CSS =
|
|
3508
|
+
var CURSOR_CSS = "*:not([data-devknobs]){cursor:none!important}:where([data-devknobs]){cursor:auto}";
|
|
3010
3509
|
var DRAG_CSS = "*{-webkit-user-select:none!important;user-select:none!important}";
|
|
3011
3510
|
var DOT_CSS = `
|
|
3012
3511
|
:host {
|
|
@@ -3084,15 +3583,6 @@ function inertiaStep(velocity, dt) {
|
|
|
3084
3583
|
done: Math.hypot(next.x, next.y) < STOP_FLING
|
|
3085
3584
|
};
|
|
3086
3585
|
}
|
|
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
3586
|
var active = false;
|
|
3097
3587
|
var paused = false;
|
|
3098
3588
|
var native = false;
|
|
@@ -3100,8 +3590,7 @@ var nativeTimer = 0;
|
|
|
3100
3590
|
var mark = { at: null, pressed: false, held: false };
|
|
3101
3591
|
var host2 = null;
|
|
3102
3592
|
var dot = null;
|
|
3103
|
-
var
|
|
3104
|
-
var over = null;
|
|
3593
|
+
var hold2 = null;
|
|
3105
3594
|
var gesture = null;
|
|
3106
3595
|
var nextId = 1;
|
|
3107
3596
|
var finishTimer = 0;
|
|
@@ -3165,89 +3654,6 @@ function pressDot(pressed) {
|
|
|
3165
3654
|
mark = { ...mark, pressed };
|
|
3166
3655
|
render();
|
|
3167
3656
|
}
|
|
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
3657
|
function mountDot() {
|
|
3252
3658
|
if (host2)
|
|
3253
3659
|
return;
|
|
@@ -3260,18 +3666,14 @@ function mountDot() {
|
|
|
3260
3666
|
dot.hidden = true;
|
|
3261
3667
|
root.append(dot);
|
|
3262
3668
|
document.documentElement.append(host2);
|
|
3263
|
-
|
|
3264
|
-
return;
|
|
3265
|
-
host2.setAttribute("popover", "manual");
|
|
3266
|
-
watchTopLayer();
|
|
3267
|
-
raise();
|
|
3669
|
+
hold2 = holdInTopLayer(host2, LAYER.touch);
|
|
3268
3670
|
}
|
|
3269
3671
|
function unmountDot() {
|
|
3270
|
-
|
|
3672
|
+
hold2?.release();
|
|
3673
|
+
hold2 = null;
|
|
3271
3674
|
host2?.remove();
|
|
3272
3675
|
host2 = null;
|
|
3273
3676
|
dot = null;
|
|
3274
|
-
over = null;
|
|
3275
3677
|
}
|
|
3276
3678
|
function sendTouch(type, current, event, cancelable) {
|
|
3277
3679
|
if (!touchable())
|
|
@@ -3476,6 +3878,19 @@ function patchPointer(event) {
|
|
|
3476
3878
|
Object.defineProperty(event, "pointerType", { configurable: true, get: () => "touch" });
|
|
3477
3879
|
Object.defineProperty(event, "isPrimary", { configurable: true, get: () => true });
|
|
3478
3880
|
}
|
|
3881
|
+
function fingerAt(event) {
|
|
3882
|
+
let origin = { x: 0, y: 0 };
|
|
3883
|
+
try {
|
|
3884
|
+
const host3 = window.frameElement;
|
|
3885
|
+
if (host3 && "offsetWidth" in host3 && typeof host3.offsetWidth === "number" && host3.offsetWidth > 0) {
|
|
3886
|
+
const box = host3.getBoundingClientRect();
|
|
3887
|
+
const scale = box.width / host3.offsetWidth;
|
|
3888
|
+
if (scale > 0)
|
|
3889
|
+
origin = { x: box.left / scale, y: box.top / scale };
|
|
3890
|
+
}
|
|
3891
|
+
} catch {}
|
|
3892
|
+
return { x: event.clientX + origin.x, y: event.clientY + origin.y };
|
|
3893
|
+
}
|
|
3479
3894
|
function onPointerDown(event) {
|
|
3480
3895
|
stopFling();
|
|
3481
3896
|
finish();
|
|
@@ -3484,15 +3899,16 @@ function onPointerDown(event) {
|
|
|
3484
3899
|
native = event.button !== 0 || !(target instanceof Element) || isNative(target) || onScrollbar(target, event);
|
|
3485
3900
|
if (native || !(target instanceof Element))
|
|
3486
3901
|
return;
|
|
3902
|
+
const finger = fingerAt(event);
|
|
3487
3903
|
const current = {
|
|
3488
3904
|
id: nextId++,
|
|
3489
3905
|
pointerId: event.pointerId,
|
|
3490
3906
|
target,
|
|
3491
|
-
startX:
|
|
3492
|
-
startY:
|
|
3493
|
-
lastX:
|
|
3494
|
-
lastY:
|
|
3495
|
-
samples: [{ t: performance.now(), x:
|
|
3907
|
+
startX: finger.x,
|
|
3908
|
+
startY: finger.y,
|
|
3909
|
+
lastX: finger.x,
|
|
3910
|
+
lastY: finger.y,
|
|
3911
|
+
samples: [{ t: performance.now(), x: finger.x, y: finger.y }],
|
|
3496
3912
|
dragged: false,
|
|
3497
3913
|
claimed: false,
|
|
3498
3914
|
quiet: false,
|
|
@@ -3510,15 +3926,16 @@ function onPointerMove(event) {
|
|
|
3510
3926
|
if (!current || current.ended || event.pointerId !== current.pointerId)
|
|
3511
3927
|
return;
|
|
3512
3928
|
const now2 = performance.now();
|
|
3513
|
-
const
|
|
3514
|
-
const
|
|
3515
|
-
|
|
3516
|
-
current.
|
|
3517
|
-
current.
|
|
3929
|
+
const finger = fingerAt(event);
|
|
3930
|
+
const stepX = finger.x - current.lastX;
|
|
3931
|
+
const stepY = finger.y - current.lastY;
|
|
3932
|
+
current.lastX = finger.x;
|
|
3933
|
+
current.lastY = finger.y;
|
|
3934
|
+
current.samples.push({ t: now2, x: finger.x, y: finger.y });
|
|
3518
3935
|
while ((current.samples[0]?.t ?? now2) < now2 - VELOCITY_WINDOW * 2)
|
|
3519
3936
|
current.samples.shift();
|
|
3520
|
-
const dx =
|
|
3521
|
-
const dy =
|
|
3937
|
+
const dx = finger.x - current.startX;
|
|
3938
|
+
const dy = finger.y - current.startY;
|
|
3522
3939
|
if (!current.dragged && passedSlop(dx, dy)) {
|
|
3523
3940
|
current.dragged = true;
|
|
3524
3941
|
ensureStyle("touch-drag").textContent = DRAG_CSS;
|
|
@@ -3570,8 +3987,6 @@ function onEvent(event) {
|
|
|
3570
3987
|
hideDot();
|
|
3571
3988
|
else if (type !== "pointerleave" && type !== "pointerout")
|
|
3572
3989
|
showDot(event);
|
|
3573
|
-
if (type === "pointerover" || type === "pointermove" || type === "pointerdown")
|
|
3574
|
-
raiseOver(event);
|
|
3575
3990
|
if (type === "pointerdown")
|
|
3576
3991
|
pressDot(true);
|
|
3577
3992
|
else if (type === "pointerup" || type === "pointercancel")
|
|
@@ -3658,7 +4073,7 @@ function hideCursor() {
|
|
|
3658
4073
|
handUp(mark);
|
|
3659
4074
|
unmountDot();
|
|
3660
4075
|
}
|
|
3661
|
-
function
|
|
4076
|
+
function apply18(on3) {
|
|
3662
4077
|
if (on3 === active)
|
|
3663
4078
|
return;
|
|
3664
4079
|
active = on3;
|
|
@@ -3675,8 +4090,8 @@ function apply16(on3) {
|
|
|
3675
4090
|
stopFling();
|
|
3676
4091
|
hideCursor();
|
|
3677
4092
|
}
|
|
3678
|
-
function
|
|
3679
|
-
|
|
4093
|
+
function reset17() {
|
|
4094
|
+
apply18(false);
|
|
3680
4095
|
}
|
|
3681
4096
|
function pause(on3) {
|
|
3682
4097
|
if (on3 === paused)
|
|
@@ -3694,7 +4109,7 @@ function pause(on3) {
|
|
|
3694
4109
|
|
|
3695
4110
|
// src/engine/frames.ts
|
|
3696
4111
|
var kit = null;
|
|
3697
|
-
var load2 = () => import("./framekit-
|
|
4112
|
+
var load2 = () => import("./framekit-yk1jxjv7.js");
|
|
3698
4113
|
var loading = null;
|
|
3699
4114
|
var down = false;
|
|
3700
4115
|
var waiting = [];
|
|
@@ -3704,12 +4119,14 @@ var exit = null;
|
|
|
3704
4119
|
var zoomTo = null;
|
|
3705
4120
|
var askWhy = null;
|
|
3706
4121
|
var framed2 = null;
|
|
4122
|
+
var loader = null;
|
|
3707
4123
|
function arrived(loaded) {
|
|
3708
4124
|
kit = loaded;
|
|
3709
4125
|
loaded.width.onExit(exit);
|
|
3710
4126
|
loaded.width.onZoom(zoomTo);
|
|
3711
4127
|
loaded.width.onRefused(askWhy);
|
|
3712
4128
|
loaded.width.onFramed(framed2);
|
|
4129
|
+
loaded.width.onLoader(loader);
|
|
3713
4130
|
for (const run of waiting.splice(0))
|
|
3714
4131
|
run(loaded);
|
|
3715
4132
|
for (const state of [before, latest]) {
|
|
@@ -3733,12 +4150,12 @@ function failed(error) {
|
|
|
3733
4150
|
dropEarly();
|
|
3734
4151
|
exit?.();
|
|
3735
4152
|
}
|
|
3736
|
-
function whenIn(
|
|
4153
|
+
function whenIn(watch3) {
|
|
3737
4154
|
if (kit)
|
|
3738
|
-
return
|
|
4155
|
+
return watch3(kit);
|
|
3739
4156
|
let stop2 = null;
|
|
3740
4157
|
const run = (loaded) => {
|
|
3741
|
-
stop2 =
|
|
4158
|
+
stop2 = watch3(loaded);
|
|
3742
4159
|
};
|
|
3743
4160
|
waiting.push(run);
|
|
3744
4161
|
return () => {
|
|
@@ -3748,7 +4165,7 @@ function whenIn(watch2) {
|
|
|
3748
4165
|
stop2?.();
|
|
3749
4166
|
};
|
|
3750
4167
|
}
|
|
3751
|
-
function
|
|
4168
|
+
function apply19(state) {
|
|
3752
4169
|
if (kit) {
|
|
3753
4170
|
kit.width.apply(state);
|
|
3754
4171
|
return;
|
|
@@ -3769,7 +4186,7 @@ function apply17(state) {
|
|
|
3769
4186
|
function sync(state) {
|
|
3770
4187
|
kit?.width.sync(state);
|
|
3771
4188
|
}
|
|
3772
|
-
function
|
|
4189
|
+
function reset18() {
|
|
3773
4190
|
kit?.width.reset();
|
|
3774
4191
|
before = null;
|
|
3775
4192
|
latest = null;
|
|
@@ -3790,6 +4207,10 @@ function onFramed(handler) {
|
|
|
3790
4207
|
framed2 = handler;
|
|
3791
4208
|
kit?.width.onFramed(handler);
|
|
3792
4209
|
}
|
|
4210
|
+
function onLoader(handler) {
|
|
4211
|
+
loader = handler;
|
|
4212
|
+
kit?.width.onLoader(handler);
|
|
4213
|
+
}
|
|
3793
4214
|
function frameWindow() {
|
|
3794
4215
|
return kit?.width.frameWindow() ?? null;
|
|
3795
4216
|
}
|
|
@@ -3835,6 +4256,7 @@ var persist = true;
|
|
|
3835
4256
|
var running = false;
|
|
3836
4257
|
var native2 = null;
|
|
3837
4258
|
var nativeNote = null;
|
|
4259
|
+
var toldRealPhone = false;
|
|
3838
4260
|
var inFrame = false;
|
|
3839
4261
|
var stopRelay = null;
|
|
3840
4262
|
var panelMoving = null;
|
|
@@ -3853,6 +4275,10 @@ function driver() {
|
|
|
3853
4275
|
}
|
|
3854
4276
|
function applyState(next) {
|
|
3855
4277
|
state = inFrame ? framed(next) : next;
|
|
4278
|
+
if (running && !inFrame && native2?.realPhone && toldRealPhone !== state.panel.realPhone) {
|
|
4279
|
+
toldRealPhone = state.panel.realPhone;
|
|
4280
|
+
native2.realPhone(toldRealPhone);
|
|
4281
|
+
}
|
|
3856
4282
|
const active2 = driver();
|
|
3857
4283
|
const page = inPage(state, active2);
|
|
3858
4284
|
const scheme = inFrame && nativeScheme(page.scheme) ? "system" : page.scheme;
|
|
@@ -3865,30 +4291,32 @@ function applyState(next) {
|
|
|
3865
4291
|
transparency: page.transparency,
|
|
3866
4292
|
touch: touchScreen
|
|
3867
4293
|
});
|
|
3868
|
-
|
|
4294
|
+
apply7({
|
|
3869
4295
|
on: touchScreen || nativeTouch,
|
|
3870
4296
|
points: !nativeTouch && uaPreset(state.ua.preset) === undefined
|
|
3871
4297
|
});
|
|
3872
|
-
|
|
3873
|
-
apply5(
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
4298
|
+
apply18(touchScreen && state.touchPointer);
|
|
4299
|
+
apply5(inFrame ? screenSizeOf(state) : null);
|
|
4300
|
+
apply6(touchScreen);
|
|
4301
|
+
apply17(state.speed);
|
|
4302
|
+
apply8(state.locale);
|
|
4303
|
+
apply14(state.pseudo);
|
|
3877
4304
|
apply(state.geo);
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
4305
|
+
apply9(resolveTimeZone(state.timeZone, state.geo), state.clock);
|
|
4306
|
+
apply10(state.clock);
|
|
4307
|
+
apply11(page.network);
|
|
3881
4308
|
apply2(page.text);
|
|
3882
4309
|
if (active2 && !inFrame)
|
|
3883
4310
|
drive(active2, state);
|
|
3884
4311
|
else if (native2 && !inFrame)
|
|
3885
4312
|
driveUa(native2, state);
|
|
3886
|
-
|
|
3887
|
-
apply4(state.ua);
|
|
4313
|
+
apply15(state.spacing);
|
|
3888
4314
|
const sized2 = inFrame ? state : framing(state, active2);
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
4315
|
+
apply4(!inFrame && needsFrame(sized2) ? DEFAULT_STATE.ua : state.ua);
|
|
4316
|
+
apply19(sized2);
|
|
4317
|
+
apply13(state.overflow && !needsFrame(sized2));
|
|
4318
|
+
apply12(state.outlines);
|
|
4319
|
+
apply16(!inFrame && shownHere(state.panel.devIcon));
|
|
3892
4320
|
if (persist)
|
|
3893
4321
|
save(state);
|
|
3894
4322
|
sync(sized2);
|
|
@@ -3905,6 +4333,9 @@ function setNative(on3, note) {
|
|
|
3905
4333
|
if (running && (changed || note !== undefined))
|
|
3906
4334
|
applyState(state);
|
|
3907
4335
|
}
|
|
4336
|
+
function hostSendsUa() {
|
|
4337
|
+
return native2?.ua !== undefined && native2.realPhone !== undefined;
|
|
4338
|
+
}
|
|
3908
4339
|
function nativeSwitch() {
|
|
3909
4340
|
if (!native2?.setting)
|
|
3910
4341
|
return null;
|
|
@@ -3928,7 +4359,7 @@ function keepPlace2() {
|
|
|
3928
4359
|
if (persist)
|
|
3929
4360
|
keepPlace(state);
|
|
3930
4361
|
}
|
|
3931
|
-
function
|
|
4362
|
+
function reset19() {
|
|
3932
4363
|
applyState(resetState(state));
|
|
3933
4364
|
}
|
|
3934
4365
|
function onMessage(event) {
|
|
@@ -3973,7 +4404,10 @@ function start4(options = {}) {
|
|
|
3973
4404
|
onZoom((zoom) => setState({ zoom }));
|
|
3974
4405
|
onRefused(native2?.refused ?? null);
|
|
3975
4406
|
onFramed(native2?.framed ?? null);
|
|
3976
|
-
|
|
4407
|
+
onLoader(native2?.load ?? null);
|
|
4408
|
+
const first = merge(stored ? load() : { ...DEFAULT_STATE }, options.state ?? {});
|
|
4409
|
+
toldRealPhone = first.panel.realPhone;
|
|
4410
|
+
applyState(first);
|
|
3977
4411
|
if (!inFrame)
|
|
3978
4412
|
return;
|
|
3979
4413
|
relay(overflowCount());
|
|
@@ -3993,23 +4427,26 @@ function stop2() {
|
|
|
3993
4427
|
onZoom(null);
|
|
3994
4428
|
onRefused(null);
|
|
3995
4429
|
onFramed(null);
|
|
4430
|
+
onLoader(null);
|
|
3996
4431
|
destroy();
|
|
3997
|
-
reset5();
|
|
3998
|
-
reset15();
|
|
3999
|
-
reset4();
|
|
4000
|
-
reset14();
|
|
4001
4432
|
reset6();
|
|
4002
|
-
|
|
4003
|
-
|
|
4433
|
+
reset17();
|
|
4434
|
+
reset4();
|
|
4435
|
+
reset5();
|
|
4436
|
+
reset16();
|
|
4004
4437
|
reset7();
|
|
4438
|
+
reset13();
|
|
4439
|
+
reset();
|
|
4005
4440
|
reset8();
|
|
4006
4441
|
reset9();
|
|
4442
|
+
reset10();
|
|
4007
4443
|
reset2();
|
|
4008
|
-
|
|
4444
|
+
reset14();
|
|
4009
4445
|
reset3();
|
|
4010
|
-
|
|
4446
|
+
reset18();
|
|
4447
|
+
reset12();
|
|
4011
4448
|
reset11();
|
|
4012
|
-
|
|
4449
|
+
reset15();
|
|
4013
4450
|
if (native2)
|
|
4014
4451
|
release(native2);
|
|
4015
4452
|
native2 = null;
|
|
@@ -4560,4 +4997,4 @@ function glyph(name, size = 14) {
|
|
|
4560
4997
|
return isBrand(name) ? brand(name, size) : icon(name, size);
|
|
4561
4998
|
}
|
|
4562
4999
|
|
|
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,
|
|
5000
|
+
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, hostSendsUa, 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 };
|