@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
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
apply3 as apply4,
|
|
18
18
|
apply4 as apply5,
|
|
19
19
|
apply5 as apply6,
|
|
20
|
+
apply6 as apply7,
|
|
20
21
|
clockOn,
|
|
21
22
|
destroy,
|
|
22
23
|
drive,
|
|
@@ -53,10 +54,12 @@ import {
|
|
|
53
54
|
reset2 as reset3,
|
|
54
55
|
reset3 as reset4,
|
|
55
56
|
reset4 as reset5,
|
|
57
|
+
reset5 as reset6,
|
|
56
58
|
resetState,
|
|
57
59
|
resolveGeo,
|
|
58
60
|
resume,
|
|
59
61
|
save,
|
|
62
|
+
screenSizeOf,
|
|
60
63
|
setClock,
|
|
61
64
|
share,
|
|
62
65
|
shared,
|
|
@@ -67,7 +70,7 @@ import {
|
|
|
67
70
|
uaPreset,
|
|
68
71
|
webStorage,
|
|
69
72
|
wrapDate
|
|
70
|
-
} from "./react-
|
|
73
|
+
} from "./react-6tss0r9f.js";
|
|
71
74
|
|
|
72
75
|
// src/ui/icons.ts
|
|
73
76
|
var SVG = "http://www.w3.org/2000/svg";
|
|
@@ -843,14 +846,14 @@ function restoreNavigator() {
|
|
|
843
846
|
Reflect.deleteProperty(Navigator.prototype, "languages");
|
|
844
847
|
navigatorPatched = false;
|
|
845
848
|
}
|
|
846
|
-
function
|
|
849
|
+
function apply8(value) {
|
|
847
850
|
if (!captured) {
|
|
848
851
|
originalLang = document.documentElement.getAttribute("lang");
|
|
849
852
|
originalDir = document.documentElement.getAttribute("dir");
|
|
850
853
|
captured = true;
|
|
851
854
|
}
|
|
852
855
|
if (!value.lang || value.lang === "system") {
|
|
853
|
-
|
|
856
|
+
reset7();
|
|
854
857
|
if (value.dir !== "system") {
|
|
855
858
|
captured = true;
|
|
856
859
|
setAttribute("dir", value.dir);
|
|
@@ -873,7 +876,7 @@ function apply7(value) {
|
|
|
873
876
|
}
|
|
874
877
|
appliedLang = value.lang;
|
|
875
878
|
}
|
|
876
|
-
function
|
|
879
|
+
function reset7() {
|
|
877
880
|
cancelRetry();
|
|
878
881
|
appliedLang = null;
|
|
879
882
|
hold(null, null);
|
|
@@ -1209,7 +1212,7 @@ function restoreTime() {
|
|
|
1209
1212
|
installed = [];
|
|
1210
1213
|
timePatched = false;
|
|
1211
1214
|
}
|
|
1212
|
-
function
|
|
1215
|
+
function apply9(value, clock2) {
|
|
1213
1216
|
takeOver();
|
|
1214
1217
|
const next = value ? canonicalZone(value) : null;
|
|
1215
1218
|
if (next !== zone)
|
|
@@ -1222,7 +1225,7 @@ function apply8(value, clock2) {
|
|
|
1222
1225
|
}
|
|
1223
1226
|
patchTime();
|
|
1224
1227
|
}
|
|
1225
|
-
function
|
|
1228
|
+
function reset8() {
|
|
1226
1229
|
zone = null;
|
|
1227
1230
|
setClock(null);
|
|
1228
1231
|
offsetCache.clear();
|
|
@@ -1360,6 +1363,192 @@ function grabTargetAt(root, x, y) {
|
|
|
1360
1363
|
return isGrabbable(element) ? element : null;
|
|
1361
1364
|
}
|
|
1362
1365
|
|
|
1366
|
+
// src/engine/toplayer.ts
|
|
1367
|
+
var LAYER = { overlay: 0, panel: 1, guide: 2, touch: 3 };
|
|
1368
|
+
var HOST_RESET = `
|
|
1369
|
+
:host([popover]) {
|
|
1370
|
+
display: block !important;
|
|
1371
|
+
position: fixed !important;
|
|
1372
|
+
margin: 0 !important;
|
|
1373
|
+
padding: 0 !important;
|
|
1374
|
+
border: 0 !important;
|
|
1375
|
+
background: none !important;
|
|
1376
|
+
color: inherit !important;
|
|
1377
|
+
overflow: visible !important;
|
|
1378
|
+
max-width: none !important;
|
|
1379
|
+
max-height: none !important;
|
|
1380
|
+
box-shadow: none !important;
|
|
1381
|
+
outline: none !important;
|
|
1382
|
+
opacity: 1 !important;
|
|
1383
|
+
transform: none !important;
|
|
1384
|
+
translate: none !important;
|
|
1385
|
+
scale: none !important;
|
|
1386
|
+
rotate: none !important;
|
|
1387
|
+
filter: none !important;
|
|
1388
|
+
backdrop-filter: none !important;
|
|
1389
|
+
clip-path: none !important;
|
|
1390
|
+
mask: none !important;
|
|
1391
|
+
contain: none !important;
|
|
1392
|
+
container-type: normal !important;
|
|
1393
|
+
content-visibility: visible !important;
|
|
1394
|
+
visibility: visible !important;
|
|
1395
|
+
perspective: none !important;
|
|
1396
|
+
will-change: auto !important;
|
|
1397
|
+
zoom: 1 !important;
|
|
1398
|
+
min-width: 0 !important;
|
|
1399
|
+
min-height: 0 !important;
|
|
1400
|
+
position-anchor: auto !important;
|
|
1401
|
+
position-area: none !important;
|
|
1402
|
+
transition: none !important;
|
|
1403
|
+
animation: none !important;
|
|
1404
|
+
}`;
|
|
1405
|
+
var BACKDROP_CSS = "[data-devknobs][popover]::backdrop{display:none!important}";
|
|
1406
|
+
var TOP_LAYER = [":popover-open", ":modal", ":fullscreen"];
|
|
1407
|
+
var POINTER = ["pointerover", "pointermove", "pointerdown"];
|
|
1408
|
+
var held2 = [];
|
|
1409
|
+
var dialogs = null;
|
|
1410
|
+
var over = null;
|
|
1411
|
+
function raises(change) {
|
|
1412
|
+
return !change.own && change.newState === "open" && change.tag.toLowerCase() !== "details";
|
|
1413
|
+
}
|
|
1414
|
+
function dialogOpened(change) {
|
|
1415
|
+
return change.tag.toLowerCase() === "dialog" && change.was === null && change.open;
|
|
1416
|
+
}
|
|
1417
|
+
function topLayerOf(path, inTopLayer) {
|
|
1418
|
+
return path.find(inTopLayer) ?? null;
|
|
1419
|
+
}
|
|
1420
|
+
function placeOf(ranks, rank) {
|
|
1421
|
+
const index = ranks.findIndex((other) => other > rank);
|
|
1422
|
+
return index === -1 ? ranks.length : index;
|
|
1423
|
+
}
|
|
1424
|
+
function layered() {
|
|
1425
|
+
return typeof HTMLElement === "function" && typeof HTMLElement.prototype.showPopover === "function";
|
|
1426
|
+
}
|
|
1427
|
+
function isOwn(node) {
|
|
1428
|
+
return held2.some((entry) => entry.host === node);
|
|
1429
|
+
}
|
|
1430
|
+
function inTopLayer(node) {
|
|
1431
|
+
if (!(node instanceof Element) || isOwn(node))
|
|
1432
|
+
return false;
|
|
1433
|
+
for (let index = 0;index < TOP_LAYER.length; index++) {
|
|
1434
|
+
try {
|
|
1435
|
+
if (node.matches(TOP_LAYER[index] ?? ""))
|
|
1436
|
+
return true;
|
|
1437
|
+
} catch {}
|
|
1438
|
+
}
|
|
1439
|
+
return false;
|
|
1440
|
+
}
|
|
1441
|
+
function show(host) {
|
|
1442
|
+
try {
|
|
1443
|
+
if (host.matches(":popover-open"))
|
|
1444
|
+
host.hidePopover();
|
|
1445
|
+
host.showPopover();
|
|
1446
|
+
} catch {}
|
|
1447
|
+
}
|
|
1448
|
+
function raiseFrom(rank) {
|
|
1449
|
+
for (const entry of held2)
|
|
1450
|
+
if (entry.rank >= rank)
|
|
1451
|
+
show(entry.host);
|
|
1452
|
+
}
|
|
1453
|
+
function raiseAll() {
|
|
1454
|
+
raiseFrom(Number.NEGATIVE_INFINITY);
|
|
1455
|
+
}
|
|
1456
|
+
function onPointer(event) {
|
|
1457
|
+
const found = topLayerOf(event.composedPath(), inTopLayer);
|
|
1458
|
+
if (found === over)
|
|
1459
|
+
return;
|
|
1460
|
+
over = found;
|
|
1461
|
+
if (found)
|
|
1462
|
+
raiseAll();
|
|
1463
|
+
}
|
|
1464
|
+
function onToggle(event) {
|
|
1465
|
+
const target = event.composedPath()[0];
|
|
1466
|
+
const own = isOwn(target);
|
|
1467
|
+
if (own)
|
|
1468
|
+
event.stopImmediatePropagation();
|
|
1469
|
+
if (!(target instanceof Element))
|
|
1470
|
+
return;
|
|
1471
|
+
const newState = "newState" in event ? event.newState : undefined;
|
|
1472
|
+
if (!raises({ newState, tag: target.tagName, own }))
|
|
1473
|
+
return;
|
|
1474
|
+
if (event.type === "beforetoggle")
|
|
1475
|
+
queueMicrotask(raiseAll);
|
|
1476
|
+
else
|
|
1477
|
+
raiseAll();
|
|
1478
|
+
}
|
|
1479
|
+
function onFullscreen() {
|
|
1480
|
+
if (document.fullscreenElement)
|
|
1481
|
+
raiseAll();
|
|
1482
|
+
}
|
|
1483
|
+
function onDialogs(records) {
|
|
1484
|
+
const opened = records.some((record) => record.target instanceof Element && dialogOpened({
|
|
1485
|
+
tag: record.target.tagName,
|
|
1486
|
+
was: record.oldValue,
|
|
1487
|
+
open: record.target.hasAttribute("open")
|
|
1488
|
+
}));
|
|
1489
|
+
if (opened)
|
|
1490
|
+
raiseAll();
|
|
1491
|
+
}
|
|
1492
|
+
function watch() {
|
|
1493
|
+
ensureStyle("top-layer").textContent = BACKDROP_CSS;
|
|
1494
|
+
window.addEventListener("beforetoggle", onToggle, true);
|
|
1495
|
+
window.addEventListener("toggle", onToggle, true);
|
|
1496
|
+
window.addEventListener("fullscreenchange", onFullscreen, true);
|
|
1497
|
+
for (const type of POINTER)
|
|
1498
|
+
window.addEventListener(type, onPointer, true);
|
|
1499
|
+
if (typeof MutationObserver !== "function")
|
|
1500
|
+
return;
|
|
1501
|
+
dialogs = new MutationObserver(onDialogs);
|
|
1502
|
+
dialogs.observe(document.documentElement, {
|
|
1503
|
+
subtree: true,
|
|
1504
|
+
attributes: true,
|
|
1505
|
+
attributeFilter: ["open"],
|
|
1506
|
+
attributeOldValue: true
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function unwatch() {
|
|
1510
|
+
removeStyle("top-layer");
|
|
1511
|
+
window.removeEventListener("beforetoggle", onToggle, true);
|
|
1512
|
+
window.removeEventListener("toggle", onToggle, true);
|
|
1513
|
+
window.removeEventListener("fullscreenchange", onFullscreen, true);
|
|
1514
|
+
for (const type of POINTER)
|
|
1515
|
+
window.removeEventListener(type, onPointer, true);
|
|
1516
|
+
dialogs?.disconnect();
|
|
1517
|
+
dialogs = null;
|
|
1518
|
+
over = null;
|
|
1519
|
+
}
|
|
1520
|
+
function holdInTopLayer(host, rank) {
|
|
1521
|
+
if (!layered())
|
|
1522
|
+
return { raise() {}, release() {} };
|
|
1523
|
+
const entry = { host, rank };
|
|
1524
|
+
const first = held2.length === 0;
|
|
1525
|
+
held2.splice(placeOf(held2.map((other) => other.rank), rank), 0, entry);
|
|
1526
|
+
host.setAttribute("popover", "manual");
|
|
1527
|
+
if (first)
|
|
1528
|
+
watch();
|
|
1529
|
+
raiseFrom(rank);
|
|
1530
|
+
if (!host.matches(":popover-open")) {
|
|
1531
|
+
host.removeAttribute("popover");
|
|
1532
|
+
held2 = held2.filter((other) => other !== entry);
|
|
1533
|
+
if (held2.length === 0)
|
|
1534
|
+
unwatch();
|
|
1535
|
+
return { raise() {}, release() {} };
|
|
1536
|
+
}
|
|
1537
|
+
return {
|
|
1538
|
+
raise() {
|
|
1539
|
+
if (held2.includes(entry))
|
|
1540
|
+
raiseFrom(rank);
|
|
1541
|
+
},
|
|
1542
|
+
release() {
|
|
1543
|
+
if (!held2.includes(entry))
|
|
1544
|
+
return;
|
|
1545
|
+
held2 = held2.filter((other) => other !== entry);
|
|
1546
|
+
if (held2.length === 0)
|
|
1547
|
+
unwatch();
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1363
1552
|
// src/engine/touchpointer.ts
|
|
1364
1553
|
var SLOP = 10;
|
|
1365
1554
|
var VELOCITY_WINDOW = 100;
|
|
@@ -1401,7 +1590,7 @@ var EVENTS = [
|
|
|
1401
1590
|
"dragstart",
|
|
1402
1591
|
"selectstart"
|
|
1403
1592
|
];
|
|
1404
|
-
var CURSOR_CSS =
|
|
1593
|
+
var CURSOR_CSS = "*:not([data-devknobs]){cursor:none!important}:where([data-devknobs]){cursor:auto}";
|
|
1405
1594
|
var DRAG_CSS = "*{-webkit-user-select:none!important;user-select:none!important}";
|
|
1406
1595
|
var DOT_CSS = `
|
|
1407
1596
|
:host {
|
|
@@ -1479,15 +1668,6 @@ function inertiaStep(velocity, dt) {
|
|
|
1479
1668
|
done: Math.hypot(next.x, next.y) < STOP_FLING
|
|
1480
1669
|
};
|
|
1481
1670
|
}
|
|
1482
|
-
function raises(change) {
|
|
1483
|
-
return !change.own && change.newState === "open" && change.tag.toLowerCase() !== "details";
|
|
1484
|
-
}
|
|
1485
|
-
function dialogOpened(change) {
|
|
1486
|
-
return change.tag.toLowerCase() === "dialog" && change.was === null && change.open;
|
|
1487
|
-
}
|
|
1488
|
-
function topLayerOf(path, inTopLayer) {
|
|
1489
|
-
return path.find(inTopLayer) ?? null;
|
|
1490
|
-
}
|
|
1491
1671
|
var active = false;
|
|
1492
1672
|
var paused = false;
|
|
1493
1673
|
var native = false;
|
|
@@ -1495,8 +1675,7 @@ var nativeTimer = 0;
|
|
|
1495
1675
|
var mark = { at: null, pressed: false, held: false };
|
|
1496
1676
|
var host = null;
|
|
1497
1677
|
var dot = null;
|
|
1498
|
-
var
|
|
1499
|
-
var over = null;
|
|
1678
|
+
var hold2 = null;
|
|
1500
1679
|
var gesture = null;
|
|
1501
1680
|
var nextId = 1;
|
|
1502
1681
|
var finishTimer = 0;
|
|
@@ -1560,89 +1739,6 @@ function pressDot(pressed) {
|
|
|
1560
1739
|
mark = { ...mark, pressed };
|
|
1561
1740
|
render();
|
|
1562
1741
|
}
|
|
1563
|
-
function layered() {
|
|
1564
|
-
return typeof HTMLElement.prototype.showPopover === "function";
|
|
1565
|
-
}
|
|
1566
|
-
function raise() {
|
|
1567
|
-
if (!host)
|
|
1568
|
-
return;
|
|
1569
|
-
try {
|
|
1570
|
-
if (host.matches(":popover-open"))
|
|
1571
|
-
host.hidePopover();
|
|
1572
|
-
host.showPopover();
|
|
1573
|
-
} catch {}
|
|
1574
|
-
}
|
|
1575
|
-
var TOP_LAYER = [":popover-open", ":modal", ":fullscreen"];
|
|
1576
|
-
function inTopLayer(node) {
|
|
1577
|
-
if (!(node instanceof Element))
|
|
1578
|
-
return false;
|
|
1579
|
-
for (let index = 0;index < TOP_LAYER.length; index++) {
|
|
1580
|
-
try {
|
|
1581
|
-
if (node.matches(TOP_LAYER[index] ?? ""))
|
|
1582
|
-
return true;
|
|
1583
|
-
} catch {}
|
|
1584
|
-
}
|
|
1585
|
-
return false;
|
|
1586
|
-
}
|
|
1587
|
-
function raiseOver(event) {
|
|
1588
|
-
if (!host || !layered())
|
|
1589
|
-
return;
|
|
1590
|
-
const found = topLayerOf(event.composedPath(), inTopLayer);
|
|
1591
|
-
if (found === over)
|
|
1592
|
-
return;
|
|
1593
|
-
over = found;
|
|
1594
|
-
if (found)
|
|
1595
|
-
raise();
|
|
1596
|
-
}
|
|
1597
|
-
function onToggle(event) {
|
|
1598
|
-
const target = event.composedPath()[0];
|
|
1599
|
-
const own = target === host;
|
|
1600
|
-
if (own)
|
|
1601
|
-
event.stopImmediatePropagation();
|
|
1602
|
-
if (!(target instanceof Element))
|
|
1603
|
-
return;
|
|
1604
|
-
const newState = "newState" in event ? event.newState : undefined;
|
|
1605
|
-
if (!raises({ newState, tag: target.tagName, own }))
|
|
1606
|
-
return;
|
|
1607
|
-
if (event.type === "beforetoggle")
|
|
1608
|
-
queueMicrotask(raise);
|
|
1609
|
-
else
|
|
1610
|
-
raise();
|
|
1611
|
-
}
|
|
1612
|
-
function onFullscreen() {
|
|
1613
|
-
if (document.fullscreenElement)
|
|
1614
|
-
raise();
|
|
1615
|
-
}
|
|
1616
|
-
function onDialogs(records) {
|
|
1617
|
-
const opened = records.some((record) => record.target instanceof Element && dialogOpened({
|
|
1618
|
-
tag: record.target.tagName,
|
|
1619
|
-
was: record.oldValue,
|
|
1620
|
-
open: record.target.hasAttribute("open")
|
|
1621
|
-
}));
|
|
1622
|
-
if (opened)
|
|
1623
|
-
raise();
|
|
1624
|
-
}
|
|
1625
|
-
function watchTopLayer() {
|
|
1626
|
-
window.addEventListener("beforetoggle", onToggle, true);
|
|
1627
|
-
window.addEventListener("toggle", onToggle, true);
|
|
1628
|
-
window.addEventListener("fullscreenchange", onFullscreen, true);
|
|
1629
|
-
if (typeof MutationObserver !== "function")
|
|
1630
|
-
return;
|
|
1631
|
-
dialogs = new MutationObserver(onDialogs);
|
|
1632
|
-
dialogs.observe(document.documentElement, {
|
|
1633
|
-
subtree: true,
|
|
1634
|
-
attributes: true,
|
|
1635
|
-
attributeFilter: ["open"],
|
|
1636
|
-
attributeOldValue: true
|
|
1637
|
-
});
|
|
1638
|
-
}
|
|
1639
|
-
function unwatchTopLayer() {
|
|
1640
|
-
window.removeEventListener("beforetoggle", onToggle, true);
|
|
1641
|
-
window.removeEventListener("toggle", onToggle, true);
|
|
1642
|
-
window.removeEventListener("fullscreenchange", onFullscreen, true);
|
|
1643
|
-
dialogs?.disconnect();
|
|
1644
|
-
dialogs = null;
|
|
1645
|
-
}
|
|
1646
1742
|
function mountDot() {
|
|
1647
1743
|
if (host)
|
|
1648
1744
|
return;
|
|
@@ -1655,18 +1751,14 @@ function mountDot() {
|
|
|
1655
1751
|
dot.hidden = true;
|
|
1656
1752
|
root.append(dot);
|
|
1657
1753
|
document.documentElement.append(host);
|
|
1658
|
-
|
|
1659
|
-
return;
|
|
1660
|
-
host.setAttribute("popover", "manual");
|
|
1661
|
-
watchTopLayer();
|
|
1662
|
-
raise();
|
|
1754
|
+
hold2 = holdInTopLayer(host, LAYER.touch);
|
|
1663
1755
|
}
|
|
1664
1756
|
function unmountDot() {
|
|
1665
|
-
|
|
1757
|
+
hold2?.release();
|
|
1758
|
+
hold2 = null;
|
|
1666
1759
|
host?.remove();
|
|
1667
1760
|
host = null;
|
|
1668
1761
|
dot = null;
|
|
1669
|
-
over = null;
|
|
1670
1762
|
}
|
|
1671
1763
|
function sendTouch(type, current, event, cancelable) {
|
|
1672
1764
|
if (!touchable())
|
|
@@ -1871,6 +1963,19 @@ function patchPointer(event) {
|
|
|
1871
1963
|
Object.defineProperty(event, "pointerType", { configurable: true, get: () => "touch" });
|
|
1872
1964
|
Object.defineProperty(event, "isPrimary", { configurable: true, get: () => true });
|
|
1873
1965
|
}
|
|
1966
|
+
function fingerAt(event) {
|
|
1967
|
+
let origin = { x: 0, y: 0 };
|
|
1968
|
+
try {
|
|
1969
|
+
const host2 = window.frameElement;
|
|
1970
|
+
if (host2 && "offsetWidth" in host2 && typeof host2.offsetWidth === "number" && host2.offsetWidth > 0) {
|
|
1971
|
+
const box = host2.getBoundingClientRect();
|
|
1972
|
+
const scale = box.width / host2.offsetWidth;
|
|
1973
|
+
if (scale > 0)
|
|
1974
|
+
origin = { x: box.left / scale, y: box.top / scale };
|
|
1975
|
+
}
|
|
1976
|
+
} catch {}
|
|
1977
|
+
return { x: event.clientX + origin.x, y: event.clientY + origin.y };
|
|
1978
|
+
}
|
|
1874
1979
|
function onPointerDown(event) {
|
|
1875
1980
|
stopFling();
|
|
1876
1981
|
finish();
|
|
@@ -1879,15 +1984,16 @@ function onPointerDown(event) {
|
|
|
1879
1984
|
native = event.button !== 0 || !(target instanceof Element) || isNative(target) || onScrollbar(target, event);
|
|
1880
1985
|
if (native || !(target instanceof Element))
|
|
1881
1986
|
return;
|
|
1987
|
+
const finger = fingerAt(event);
|
|
1882
1988
|
const current = {
|
|
1883
1989
|
id: nextId++,
|
|
1884
1990
|
pointerId: event.pointerId,
|
|
1885
1991
|
target,
|
|
1886
|
-
startX:
|
|
1887
|
-
startY:
|
|
1888
|
-
lastX:
|
|
1889
|
-
lastY:
|
|
1890
|
-
samples: [{ t: performance.now(), x:
|
|
1992
|
+
startX: finger.x,
|
|
1993
|
+
startY: finger.y,
|
|
1994
|
+
lastX: finger.x,
|
|
1995
|
+
lastY: finger.y,
|
|
1996
|
+
samples: [{ t: performance.now(), x: finger.x, y: finger.y }],
|
|
1891
1997
|
dragged: false,
|
|
1892
1998
|
claimed: false,
|
|
1893
1999
|
quiet: false,
|
|
@@ -1905,15 +2011,16 @@ function onPointerMove(event) {
|
|
|
1905
2011
|
if (!current || current.ended || event.pointerId !== current.pointerId)
|
|
1906
2012
|
return;
|
|
1907
2013
|
const now2 = performance.now();
|
|
1908
|
-
const
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1911
|
-
current.
|
|
1912
|
-
current.
|
|
2014
|
+
const finger = fingerAt(event);
|
|
2015
|
+
const stepX = finger.x - current.lastX;
|
|
2016
|
+
const stepY = finger.y - current.lastY;
|
|
2017
|
+
current.lastX = finger.x;
|
|
2018
|
+
current.lastY = finger.y;
|
|
2019
|
+
current.samples.push({ t: now2, x: finger.x, y: finger.y });
|
|
1913
2020
|
while ((current.samples[0]?.t ?? now2) < now2 - VELOCITY_WINDOW * 2)
|
|
1914
2021
|
current.samples.shift();
|
|
1915
|
-
const dx =
|
|
1916
|
-
const dy =
|
|
2022
|
+
const dx = finger.x - current.startX;
|
|
2023
|
+
const dy = finger.y - current.startY;
|
|
1917
2024
|
if (!current.dragged && passedSlop(dx, dy)) {
|
|
1918
2025
|
current.dragged = true;
|
|
1919
2026
|
ensureStyle("touch-drag").textContent = DRAG_CSS;
|
|
@@ -1965,8 +2072,6 @@ function onEvent(event) {
|
|
|
1965
2072
|
hideDot();
|
|
1966
2073
|
else if (type !== "pointerleave" && type !== "pointerout")
|
|
1967
2074
|
showDot(event);
|
|
1968
|
-
if (type === "pointerover" || type === "pointermove" || type === "pointerdown")
|
|
1969
|
-
raiseOver(event);
|
|
1970
2075
|
if (type === "pointerdown")
|
|
1971
2076
|
pressDot(true);
|
|
1972
2077
|
else if (type === "pointerup" || type === "pointercancel")
|
|
@@ -2053,7 +2158,7 @@ function hideCursor() {
|
|
|
2053
2158
|
handUp(mark);
|
|
2054
2159
|
unmountDot();
|
|
2055
2160
|
}
|
|
2056
|
-
function
|
|
2161
|
+
function apply10(on) {
|
|
2057
2162
|
if (on === active)
|
|
2058
2163
|
return;
|
|
2059
2164
|
active = on;
|
|
@@ -2070,8 +2175,8 @@ function apply9(on) {
|
|
|
2070
2175
|
stopFling();
|
|
2071
2176
|
hideCursor();
|
|
2072
2177
|
}
|
|
2073
|
-
function
|
|
2074
|
-
|
|
2178
|
+
function reset9() {
|
|
2179
|
+
apply10(false);
|
|
2075
2180
|
}
|
|
2076
2181
|
function pause(on) {
|
|
2077
2182
|
if (on === paused)
|
|
@@ -2089,7 +2194,7 @@ function pause(on) {
|
|
|
2089
2194
|
|
|
2090
2195
|
// src/engine/frames.ts
|
|
2091
2196
|
var kit = null;
|
|
2092
|
-
var load2 = () => import("./framekit-
|
|
2197
|
+
var load2 = () => import("./framekit-cjz0e4y8.js");
|
|
2093
2198
|
var loading = null;
|
|
2094
2199
|
var down = false;
|
|
2095
2200
|
var waiting = [];
|
|
@@ -2099,12 +2204,14 @@ var exit = null;
|
|
|
2099
2204
|
var zoomTo = null;
|
|
2100
2205
|
var askWhy = null;
|
|
2101
2206
|
var framed2 = null;
|
|
2207
|
+
var loader = null;
|
|
2102
2208
|
function arrived(loaded) {
|
|
2103
2209
|
kit = loaded;
|
|
2104
2210
|
loaded.width.onExit(exit);
|
|
2105
2211
|
loaded.width.onZoom(zoomTo);
|
|
2106
2212
|
loaded.width.onRefused(askWhy);
|
|
2107
2213
|
loaded.width.onFramed(framed2);
|
|
2214
|
+
loaded.width.onLoader(loader);
|
|
2108
2215
|
for (const run of waiting.splice(0))
|
|
2109
2216
|
run(loaded);
|
|
2110
2217
|
for (const state of [before, latest]) {
|
|
@@ -2128,12 +2235,12 @@ function failed(error) {
|
|
|
2128
2235
|
dropEarly();
|
|
2129
2236
|
exit?.();
|
|
2130
2237
|
}
|
|
2131
|
-
function whenIn(
|
|
2238
|
+
function whenIn(watch2) {
|
|
2132
2239
|
if (kit)
|
|
2133
|
-
return
|
|
2240
|
+
return watch2(kit);
|
|
2134
2241
|
let stop = null;
|
|
2135
2242
|
const run = (loaded) => {
|
|
2136
|
-
stop =
|
|
2243
|
+
stop = watch2(loaded);
|
|
2137
2244
|
};
|
|
2138
2245
|
waiting.push(run);
|
|
2139
2246
|
return () => {
|
|
@@ -2143,7 +2250,7 @@ function whenIn(watch) {
|
|
|
2143
2250
|
stop?.();
|
|
2144
2251
|
};
|
|
2145
2252
|
}
|
|
2146
|
-
function
|
|
2253
|
+
function apply11(state) {
|
|
2147
2254
|
if (kit) {
|
|
2148
2255
|
kit.width.apply(state);
|
|
2149
2256
|
return;
|
|
@@ -2164,7 +2271,7 @@ function apply10(state) {
|
|
|
2164
2271
|
function sync(state) {
|
|
2165
2272
|
kit?.width.sync(state);
|
|
2166
2273
|
}
|
|
2167
|
-
function
|
|
2274
|
+
function reset10() {
|
|
2168
2275
|
kit?.width.reset();
|
|
2169
2276
|
before = null;
|
|
2170
2277
|
latest = null;
|
|
@@ -2185,6 +2292,10 @@ function onFramed(handler) {
|
|
|
2185
2292
|
framed2 = handler;
|
|
2186
2293
|
kit?.width.onFramed(handler);
|
|
2187
2294
|
}
|
|
2295
|
+
function onLoader(handler) {
|
|
2296
|
+
loader = handler;
|
|
2297
|
+
kit?.width.onLoader(handler);
|
|
2298
|
+
}
|
|
2188
2299
|
function frameWindow() {
|
|
2189
2300
|
return kit?.width.frameWindow() ?? null;
|
|
2190
2301
|
}
|
|
@@ -2233,11 +2344,12 @@ __export(exports_engine, {
|
|
|
2233
2344
|
start: () => start4,
|
|
2234
2345
|
setState: () => setState,
|
|
2235
2346
|
setNative: () => setNative,
|
|
2236
|
-
reset: () =>
|
|
2347
|
+
reset: () => reset19,
|
|
2237
2348
|
replay: () => replay2,
|
|
2238
2349
|
ready: () => ready,
|
|
2239
2350
|
nativeSwitch: () => nativeSwitch,
|
|
2240
2351
|
keepPlace: () => keepPlace2,
|
|
2352
|
+
hostSendsUa: () => hostSendsUa,
|
|
2241
2353
|
getState: () => getState,
|
|
2242
2354
|
applyState: () => applyState
|
|
2243
2355
|
});
|
|
@@ -2963,7 +3075,7 @@ function bodyOf(xhr, type, loaded) {
|
|
|
2963
3075
|
return record.size === 0 ? null : record;
|
|
2964
3076
|
}
|
|
2965
3077
|
var FAILS = ["error", "abort", "timeout"];
|
|
2966
|
-
function
|
|
3078
|
+
function watch2(xhr, id, url, log) {
|
|
2967
3079
|
let outcome = null;
|
|
2968
3080
|
let error = null;
|
|
2969
3081
|
let over2 = false;
|
|
@@ -3058,7 +3170,7 @@ function patchXhr(patches, log) {
|
|
|
3058
3170
|
const body = describeBody(args[0], headerOf(headers, "content-type"));
|
|
3059
3171
|
const initiator = trimStack(new Error().stack, 1);
|
|
3060
3172
|
id = log.start("xhr", { method, url, headers: [...headers], body, initiator });
|
|
3061
|
-
request.drop =
|
|
3173
|
+
request.drop = watch2(this, id, url, log);
|
|
3062
3174
|
} catch {}
|
|
3063
3175
|
try {
|
|
3064
3176
|
return original.apply(this, args);
|
|
@@ -3313,14 +3425,14 @@ function restore2() {
|
|
|
3313
3425
|
}
|
|
3314
3426
|
installed2 = [];
|
|
3315
3427
|
}
|
|
3316
|
-
function
|
|
3428
|
+
function apply12(value) {
|
|
3317
3429
|
on = sends(value);
|
|
3318
3430
|
if (on)
|
|
3319
3431
|
patch();
|
|
3320
3432
|
else
|
|
3321
3433
|
restore2();
|
|
3322
3434
|
}
|
|
3323
|
-
function
|
|
3435
|
+
function reset11() {
|
|
3324
3436
|
on = false;
|
|
3325
3437
|
restore2();
|
|
3326
3438
|
}
|
|
@@ -3352,7 +3464,7 @@ function connection() {
|
|
|
3352
3464
|
function readConnection(target) {
|
|
3353
3465
|
return CONNECTION_KEYS.map((key) => String(Reflect.get(target, key))).join();
|
|
3354
3466
|
}
|
|
3355
|
-
function
|
|
3467
|
+
function apply13(value) {
|
|
3356
3468
|
const wasOnline = navigator.onLine;
|
|
3357
3469
|
if (value.online === "offline")
|
|
3358
3470
|
shadow(navigator, "onLine", false);
|
|
@@ -3380,27 +3492,27 @@ function apply12(value) {
|
|
|
3380
3492
|
if (readConnection(target) !== before2)
|
|
3381
3493
|
target.dispatchEvent(new Event("change"));
|
|
3382
3494
|
}
|
|
3383
|
-
function
|
|
3495
|
+
function reset12() {
|
|
3384
3496
|
if (shadowed.size > 0)
|
|
3385
|
-
|
|
3497
|
+
apply13(SYSTEM);
|
|
3386
3498
|
shadowed.clear();
|
|
3387
3499
|
}
|
|
3388
3500
|
|
|
3389
3501
|
// src/engine/outlines.ts
|
|
3390
3502
|
var NAME = "outlines";
|
|
3391
|
-
function
|
|
3503
|
+
function apply14(value) {
|
|
3392
3504
|
if (!value) {
|
|
3393
|
-
|
|
3505
|
+
reset13();
|
|
3394
3506
|
return;
|
|
3395
3507
|
}
|
|
3396
3508
|
ensureStyle(NAME).textContent = "body *:not([data-devknobs],[data-devknobs] *){outline:1px solid rgba(127,127,127,.5)!important}";
|
|
3397
3509
|
}
|
|
3398
|
-
function
|
|
3510
|
+
function reset13() {
|
|
3399
3511
|
removeStyle(NAME);
|
|
3400
3512
|
}
|
|
3401
3513
|
|
|
3402
3514
|
// src/engine/tree.ts
|
|
3403
|
-
function
|
|
3515
|
+
function isOwn2(node) {
|
|
3404
3516
|
let current = node;
|
|
3405
3517
|
while (current) {
|
|
3406
3518
|
if (current instanceof Element && current.closest("[data-devknobs]"))
|
|
@@ -3568,7 +3680,7 @@ function schedule() {
|
|
|
3568
3680
|
});
|
|
3569
3681
|
}
|
|
3570
3682
|
function onMutation(records) {
|
|
3571
|
-
if (timer2 || records.every((record) =>
|
|
3683
|
+
if (timer2 || records.every((record) => isOwn2(record.target)))
|
|
3572
3684
|
return;
|
|
3573
3685
|
timer2 = window.setTimeout(() => {
|
|
3574
3686
|
timer2 = 0;
|
|
@@ -3595,9 +3707,9 @@ function start2() {
|
|
|
3595
3707
|
});
|
|
3596
3708
|
update();
|
|
3597
3709
|
}
|
|
3598
|
-
function
|
|
3710
|
+
function apply15(value) {
|
|
3599
3711
|
if (!value) {
|
|
3600
|
-
|
|
3712
|
+
reset14();
|
|
3601
3713
|
return;
|
|
3602
3714
|
}
|
|
3603
3715
|
if (document.body)
|
|
@@ -3605,7 +3717,7 @@ function apply14(value) {
|
|
|
3605
3717
|
else
|
|
3606
3718
|
document.addEventListener("DOMContentLoaded", start2, { once: true });
|
|
3607
3719
|
}
|
|
3608
|
-
function
|
|
3720
|
+
function reset14() {
|
|
3609
3721
|
document.removeEventListener("DOMContentLoaded", start2);
|
|
3610
3722
|
if (!host2)
|
|
3611
3723
|
return;
|
|
@@ -3806,9 +3918,9 @@ function whenIdle(run) {
|
|
|
3806
3918
|
clearTimeout(timer3);
|
|
3807
3919
|
};
|
|
3808
3920
|
}
|
|
3809
|
-
function
|
|
3921
|
+
function apply16(value) {
|
|
3810
3922
|
if (!value) {
|
|
3811
|
-
|
|
3923
|
+
reset15();
|
|
3812
3924
|
return;
|
|
3813
3925
|
}
|
|
3814
3926
|
if (on2 || cancelStart)
|
|
@@ -3818,7 +3930,7 @@ function apply15(value) {
|
|
|
3818
3930
|
function pending() {
|
|
3819
3931
|
return cancelStart !== null;
|
|
3820
3932
|
}
|
|
3821
|
-
function
|
|
3933
|
+
function reset15() {
|
|
3822
3934
|
cancelStart?.();
|
|
3823
3935
|
cancelStart = null;
|
|
3824
3936
|
if (!on2)
|
|
@@ -3896,7 +4008,7 @@ function collect(roots = shadowRoots()) {
|
|
|
3896
4008
|
for (const animation of scope.getAnimations())
|
|
3897
4009
|
found.add(animation);
|
|
3898
4010
|
}
|
|
3899
|
-
return Array.from(found).filter((animation) => !
|
|
4011
|
+
return Array.from(found).filter((animation) => !isOwn2(targetOf(animation)));
|
|
3900
4012
|
}
|
|
3901
4013
|
|
|
3902
4014
|
// src/engine/replay.ts
|
|
@@ -3971,17 +4083,326 @@ function replay() {
|
|
|
3971
4083
|
var NAME2 = "spacing";
|
|
3972
4084
|
var NOT_OURS = ":not([data-devknobs],[data-devknobs] *)";
|
|
3973
4085
|
var CSS2 = `*${NOT_OURS}{line-height:1.5!important;letter-spacing:.12em!important;word-spacing:.16em!important}` + `p${NOT_OURS}{margin-bottom:2em!important}`;
|
|
3974
|
-
function
|
|
4086
|
+
function apply17(value) {
|
|
3975
4087
|
if (!value) {
|
|
3976
|
-
|
|
4088
|
+
reset16();
|
|
3977
4089
|
return;
|
|
3978
4090
|
}
|
|
3979
4091
|
ensureStyle(NAME2).textContent = CSS2;
|
|
3980
4092
|
}
|
|
3981
|
-
function
|
|
4093
|
+
function reset16() {
|
|
3982
4094
|
removeStyle(NAME2);
|
|
3983
4095
|
}
|
|
3984
4096
|
|
|
4097
|
+
// src/engine/devicon.ts
|
|
4098
|
+
var RIBBON_YELLOW = "#ffd60a";
|
|
4099
|
+
var RIBBON_INK = "#111111";
|
|
4100
|
+
var RIBBON_TEXT_MIN = 32;
|
|
4101
|
+
function tileBox(data, size) {
|
|
4102
|
+
let x0 = size;
|
|
4103
|
+
let y0 = size;
|
|
4104
|
+
let x1 = -1;
|
|
4105
|
+
let y1 = -1;
|
|
4106
|
+
for (let y = 0;y < size; y++) {
|
|
4107
|
+
for (let x = 0;x < size; x++) {
|
|
4108
|
+
if ((data[(y * size + x) * 4 + 3] ?? 0) <= 128)
|
|
4109
|
+
continue;
|
|
4110
|
+
if (x < x0)
|
|
4111
|
+
x0 = x;
|
|
4112
|
+
if (x > x1)
|
|
4113
|
+
x1 = x;
|
|
4114
|
+
if (y < y0)
|
|
4115
|
+
y0 = y;
|
|
4116
|
+
if (y > y1)
|
|
4117
|
+
y1 = y;
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
if (x1 < 0)
|
|
4121
|
+
return { x: 0, y: 0, s: size };
|
|
4122
|
+
const w = x1 - x0 + 1;
|
|
4123
|
+
const h = y1 - y0 + 1;
|
|
4124
|
+
const s = Math.max(w, h);
|
|
4125
|
+
return { x: x0 - (s - w) / 2, y: y0 - (s - h) / 2, s };
|
|
4126
|
+
}
|
|
4127
|
+
function ribbonGeometry(size, box) {
|
|
4128
|
+
const width = 0.3 * box.s;
|
|
4129
|
+
const distance = (size <= 20 ? 0.2 : 0.22) * box.s;
|
|
4130
|
+
const textSize = 0.62 * width;
|
|
4131
|
+
return {
|
|
4132
|
+
box,
|
|
4133
|
+
radius: 0.225 * box.s,
|
|
4134
|
+
origin: { x: box.x + box.s, y: box.y },
|
|
4135
|
+
angle: Math.PI / 4,
|
|
4136
|
+
width,
|
|
4137
|
+
distance,
|
|
4138
|
+
edge: Math.max(1, box.s / 40),
|
|
4139
|
+
reach: 2 * box.s,
|
|
4140
|
+
text: size >= RIBBON_TEXT_MIN ? { size: textSize, y: distance + width / 2 + 0.04 * textSize } : null
|
|
4141
|
+
};
|
|
4142
|
+
}
|
|
4143
|
+
function drawDevIcon(context, size, source) {
|
|
4144
|
+
context.clearRect(0, 0, size, size);
|
|
4145
|
+
const w = source.width || size;
|
|
4146
|
+
const h = source.height || size;
|
|
4147
|
+
const scale = size / Math.max(w, h);
|
|
4148
|
+
context.drawImage(source, (size - w * scale) / 2, (size - h * scale) / 2, w * scale, h * scale);
|
|
4149
|
+
const box = tileBox(context.getImageData(0, 0, size, size).data, size);
|
|
4150
|
+
const g = ribbonGeometry(size, box);
|
|
4151
|
+
context.save();
|
|
4152
|
+
context.beginPath();
|
|
4153
|
+
context.roundRect(box.x, box.y, box.s, box.s, g.radius);
|
|
4154
|
+
context.clip();
|
|
4155
|
+
context.translate(g.origin.x, g.origin.y);
|
|
4156
|
+
context.rotate(g.angle);
|
|
4157
|
+
context.fillStyle = RIBBON_INK;
|
|
4158
|
+
context.fillRect(-g.reach, g.distance - g.edge, 2 * g.reach, g.width + 2 * g.edge);
|
|
4159
|
+
context.fillStyle = RIBBON_YELLOW;
|
|
4160
|
+
context.fillRect(-g.reach, g.distance, 2 * g.reach, g.width);
|
|
4161
|
+
if (g.text) {
|
|
4162
|
+
context.fillStyle = RIBBON_INK;
|
|
4163
|
+
context.font = `700 ${g.text.size}px -apple-system, system-ui, sans-serif`;
|
|
4164
|
+
context.textAlign = "center";
|
|
4165
|
+
context.textBaseline = "middle";
|
|
4166
|
+
context.fillText("DEV", 0, g.text.y);
|
|
4167
|
+
}
|
|
4168
|
+
context.restore();
|
|
4169
|
+
}
|
|
4170
|
+
|
|
4171
|
+
// src/engine/tabicon.ts
|
|
4172
|
+
var ORIGINAL_HREF = "data-devknobs-href";
|
|
4173
|
+
var ADDED_ICON = "data-devknobs-icon";
|
|
4174
|
+
var FALLBACK = "/favicon.ico";
|
|
4175
|
+
var TOUCH_RELS = ["apple-touch-icon", "apple-touch-icon-precomposed"];
|
|
4176
|
+
function localHost(hostname) {
|
|
4177
|
+
const host3 = hostname.toLowerCase().replace(/\.$/, "");
|
|
4178
|
+
if (host3 === "localhost" || host3.endsWith(".localhost") || host3.endsWith(".local"))
|
|
4179
|
+
return true;
|
|
4180
|
+
if (host3 === "[::1]" || host3 === "::1" || host3 === "0.0.0.0")
|
|
4181
|
+
return true;
|
|
4182
|
+
if (/^\[?(f[cd][0-9a-f]{2}|fe[89ab][0-9a-f]):/.test(host3))
|
|
4183
|
+
return true;
|
|
4184
|
+
const ip = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host3);
|
|
4185
|
+
if (!ip)
|
|
4186
|
+
return false;
|
|
4187
|
+
const [a = 0, b = 0, ...rest] = ip.slice(1).map(Number);
|
|
4188
|
+
if ([a, b, ...rest].some((part) => part > 255))
|
|
4189
|
+
return false;
|
|
4190
|
+
return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
4191
|
+
}
|
|
4192
|
+
function devIconShown(value, hostname) {
|
|
4193
|
+
return value === "on" || value === "auto" && localHost(hostname);
|
|
4194
|
+
}
|
|
4195
|
+
function devIconFor(on3, hostname) {
|
|
4196
|
+
if (on3 === localHost(hostname))
|
|
4197
|
+
return "auto";
|
|
4198
|
+
return on3 ? "on" : "off";
|
|
4199
|
+
}
|
|
4200
|
+
function shownHere(value) {
|
|
4201
|
+
if (typeof window === "undefined" || typeof document === "undefined")
|
|
4202
|
+
return false;
|
|
4203
|
+
return window.top === window && devIconShown(value, window.location.hostname);
|
|
4204
|
+
}
|
|
4205
|
+
function relTokens(link) {
|
|
4206
|
+
return (link.getAttribute("rel") ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
4207
|
+
}
|
|
4208
|
+
function isIconLink(node) {
|
|
4209
|
+
if (typeof node !== "object" || node === null)
|
|
4210
|
+
return false;
|
|
4211
|
+
const link = node;
|
|
4212
|
+
if (link.nodeType !== 1 || link.localName !== "link")
|
|
4213
|
+
return false;
|
|
4214
|
+
return relTokens(link).some((rel) => rel === "icon" || TOUCH_RELS.includes(rel));
|
|
4215
|
+
}
|
|
4216
|
+
var SIZE_MIN = 16;
|
|
4217
|
+
var SIZE_MAX = 512;
|
|
4218
|
+
function iconSize(link) {
|
|
4219
|
+
const declared = /^(\d+)x(\d+)$/i.exec((link.getAttribute("sizes") ?? "").trim().split(/\s+/)[0] ?? "");
|
|
4220
|
+
const width = declared ? Number(declared[1]) : 0;
|
|
4221
|
+
if (width > 0)
|
|
4222
|
+
return Math.min(SIZE_MAX, Math.max(SIZE_MIN, width));
|
|
4223
|
+
return relTokens(link).some((rel) => TOUCH_RELS.includes(rel)) ? 180 : 32;
|
|
4224
|
+
}
|
|
4225
|
+
function createTabIcon(env) {
|
|
4226
|
+
const doc = env.document;
|
|
4227
|
+
let on3 = false;
|
|
4228
|
+
let observer3 = null;
|
|
4229
|
+
const drawn = new Map;
|
|
4230
|
+
const loading2 = new Map;
|
|
4231
|
+
let added = null;
|
|
4232
|
+
let told = false;
|
|
4233
|
+
function iconLinks() {
|
|
4234
|
+
return Array.from(doc.querySelectorAll("link")).filter(isIconLink);
|
|
4235
|
+
}
|
|
4236
|
+
function swap(link) {
|
|
4237
|
+
if (!on3 || !isIconLink(link))
|
|
4238
|
+
return;
|
|
4239
|
+
const current = link.getAttribute("href");
|
|
4240
|
+
if (!current)
|
|
4241
|
+
return;
|
|
4242
|
+
const mine = drawn.get(link);
|
|
4243
|
+
const href = mine?.url === current ? mine.original : current;
|
|
4244
|
+
if (loading2.get(link) === href)
|
|
4245
|
+
return;
|
|
4246
|
+
loading2.set(link, href);
|
|
4247
|
+
env.load(href).then((source) => {
|
|
4248
|
+
if (loading2.get(link) !== href)
|
|
4249
|
+
return;
|
|
4250
|
+
loading2.delete(link);
|
|
4251
|
+
if (!on3 || link.getAttribute("href") !== current)
|
|
4252
|
+
return;
|
|
4253
|
+
const url = source ? env.render(source, iconSize(link)) : null;
|
|
4254
|
+
if (!url) {
|
|
4255
|
+
if (!told)
|
|
4256
|
+
console.debug(`devknobs: the tab icon ${href} could not be read, so it shows no dev ribbon`);
|
|
4257
|
+
told = true;
|
|
4258
|
+
return;
|
|
4259
|
+
}
|
|
4260
|
+
drawn.set(link, { url, original: href });
|
|
4261
|
+
link.setAttribute(ORIGINAL_HREF, href);
|
|
4262
|
+
link.setAttribute("href", url);
|
|
4263
|
+
});
|
|
4264
|
+
}
|
|
4265
|
+
function forget(link) {
|
|
4266
|
+
loading2.delete(link);
|
|
4267
|
+
const mine = drawn.get(link);
|
|
4268
|
+
if (!mine)
|
|
4269
|
+
return;
|
|
4270
|
+
drawn.delete(link);
|
|
4271
|
+
if (link.getAttribute("href") === mine.url)
|
|
4272
|
+
link.setAttribute("href", mine.original);
|
|
4273
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
4274
|
+
}
|
|
4275
|
+
function linksIn(node) {
|
|
4276
|
+
if (isIconLink(node))
|
|
4277
|
+
return [node];
|
|
4278
|
+
if (node.nodeType !== 1)
|
|
4279
|
+
return [];
|
|
4280
|
+
return Array.from(node.querySelectorAll("link")).filter(isIconLink);
|
|
4281
|
+
}
|
|
4282
|
+
function fallback() {
|
|
4283
|
+
env.load(FALLBACK).then((source) => {
|
|
4284
|
+
if (!on3 || !source || added || iconLinks().length > 0)
|
|
4285
|
+
return;
|
|
4286
|
+
const link = doc.createElement("link");
|
|
4287
|
+
link.setAttribute("rel", "icon");
|
|
4288
|
+
link.setAttribute("href", FALLBACK);
|
|
4289
|
+
link.setAttribute(ADDED_ICON, "");
|
|
4290
|
+
added = link;
|
|
4291
|
+
(doc.head ?? doc.documentElement).append(link);
|
|
4292
|
+
swap(link);
|
|
4293
|
+
});
|
|
4294
|
+
}
|
|
4295
|
+
function watch3(records) {
|
|
4296
|
+
for (const record of records) {
|
|
4297
|
+
if (record.type === "attributes") {
|
|
4298
|
+
const link = record.target;
|
|
4299
|
+
if (!isIconLink(link)) {
|
|
4300
|
+
forget(link);
|
|
4301
|
+
continue;
|
|
4302
|
+
}
|
|
4303
|
+
if (record.attributeName === "href" && drawn.get(link)?.url === link.getAttribute("href"))
|
|
4304
|
+
continue;
|
|
4305
|
+
swap(link);
|
|
4306
|
+
continue;
|
|
4307
|
+
}
|
|
4308
|
+
for (const node of Array.from(record.removedNodes)) {
|
|
4309
|
+
for (const link of linksIn(node))
|
|
4310
|
+
if (link !== added)
|
|
4311
|
+
forget(link);
|
|
4312
|
+
}
|
|
4313
|
+
for (const node of Array.from(record.addedNodes)) {
|
|
4314
|
+
for (const link of linksIn(node)) {
|
|
4315
|
+
if (link !== added && added) {
|
|
4316
|
+
added.remove();
|
|
4317
|
+
added = null;
|
|
4318
|
+
}
|
|
4319
|
+
swap(link);
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
return {
|
|
4325
|
+
start() {
|
|
4326
|
+
if (on3)
|
|
4327
|
+
return;
|
|
4328
|
+
on3 = true;
|
|
4329
|
+
const links = iconLinks();
|
|
4330
|
+
for (const link of links)
|
|
4331
|
+
swap(link);
|
|
4332
|
+
if (links.length === 0)
|
|
4333
|
+
fallback();
|
|
4334
|
+
if (!env.Observer)
|
|
4335
|
+
return;
|
|
4336
|
+
observer3 = new env.Observer(watch3);
|
|
4337
|
+
observer3.observe(doc.documentElement, {
|
|
4338
|
+
childList: true,
|
|
4339
|
+
subtree: true,
|
|
4340
|
+
attributes: true,
|
|
4341
|
+
attributeFilter: ["href", "rel", "sizes"]
|
|
4342
|
+
});
|
|
4343
|
+
},
|
|
4344
|
+
stop() {
|
|
4345
|
+
if (!on3)
|
|
4346
|
+
return;
|
|
4347
|
+
on3 = false;
|
|
4348
|
+
observer3?.disconnect();
|
|
4349
|
+
observer3 = null;
|
|
4350
|
+
loading2.clear();
|
|
4351
|
+
for (const [link, { url, original }] of drawn) {
|
|
4352
|
+
if (link.getAttribute("href") === url)
|
|
4353
|
+
link.setAttribute("href", original);
|
|
4354
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
4355
|
+
}
|
|
4356
|
+
drawn.clear();
|
|
4357
|
+
added?.remove();
|
|
4358
|
+
added = null;
|
|
4359
|
+
}
|
|
4360
|
+
};
|
|
4361
|
+
}
|
|
4362
|
+
function loadImage(href) {
|
|
4363
|
+
return new Promise((resolve) => {
|
|
4364
|
+
const image = new Image;
|
|
4365
|
+
image.crossOrigin = "anonymous";
|
|
4366
|
+
image.onload = () => resolve(image);
|
|
4367
|
+
image.onerror = () => resolve(null);
|
|
4368
|
+
image.src = href;
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
function renderPng(source, size) {
|
|
4372
|
+
try {
|
|
4373
|
+
const canvas = document.createElement("canvas");
|
|
4374
|
+
canvas.width = size;
|
|
4375
|
+
canvas.height = size;
|
|
4376
|
+
const context = canvas.getContext("2d");
|
|
4377
|
+
if (!context)
|
|
4378
|
+
return null;
|
|
4379
|
+
drawDevIcon(context, size, source);
|
|
4380
|
+
return canvas.toDataURL("image/png");
|
|
4381
|
+
} catch {
|
|
4382
|
+
return null;
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
var live = null;
|
|
4386
|
+
function apply18(on3) {
|
|
4387
|
+
if (!on3) {
|
|
4388
|
+
reset17();
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
if (live || typeof document === "undefined")
|
|
4392
|
+
return;
|
|
4393
|
+
live = createTabIcon({
|
|
4394
|
+
document,
|
|
4395
|
+
load: loadImage,
|
|
4396
|
+
render: renderPng,
|
|
4397
|
+
Observer: typeof MutationObserver === "undefined" ? undefined : MutationObserver
|
|
4398
|
+
});
|
|
4399
|
+
live.start();
|
|
4400
|
+
}
|
|
4401
|
+
function reset17() {
|
|
4402
|
+
live?.stop();
|
|
4403
|
+
live = null;
|
|
4404
|
+
}
|
|
4405
|
+
|
|
3985
4406
|
// src/engine/speed.ts
|
|
3986
4407
|
var SPEED_MIN = 0;
|
|
3987
4408
|
var SPEED_MAX = 16;
|
|
@@ -4060,7 +4481,7 @@ function tick(now2) {
|
|
|
4060
4481
|
}
|
|
4061
4482
|
function onStart(event) {
|
|
4062
4483
|
const target = event.target;
|
|
4063
|
-
if (!(target instanceof Element) ||
|
|
4484
|
+
if (!(target instanceof Element) || isOwn2(target))
|
|
4064
4485
|
return;
|
|
4065
4486
|
for (const animation of target.getAnimations({ subtree: event.pseudoElement !== "" })) {
|
|
4066
4487
|
adopt(animation);
|
|
@@ -4073,7 +4494,7 @@ function patchAnimate() {
|
|
|
4073
4494
|
nativeAnimate = native2;
|
|
4074
4495
|
patchedAnimate = function animate(...args) {
|
|
4075
4496
|
const animation = native2.apply(this, args);
|
|
4076
|
-
if (rate !== 1 && !
|
|
4497
|
+
if (rate !== 1 && !isOwn2(this))
|
|
4077
4498
|
adopt(animation);
|
|
4078
4499
|
return animation;
|
|
4079
4500
|
};
|
|
@@ -4086,10 +4507,10 @@ function restoreAnimate() {
|
|
|
4086
4507
|
nativeAnimate = null;
|
|
4087
4508
|
patchedAnimate = null;
|
|
4088
4509
|
}
|
|
4089
|
-
function
|
|
4510
|
+
function apply19(value) {
|
|
4090
4511
|
const next = Number.isFinite(value) && value >= 0 ? value : 1;
|
|
4091
4512
|
if (next === 1) {
|
|
4092
|
-
|
|
4513
|
+
reset18();
|
|
4093
4514
|
return;
|
|
4094
4515
|
}
|
|
4095
4516
|
if (next === rate && frame3)
|
|
@@ -4108,7 +4529,7 @@ function apply17(value) {
|
|
|
4108
4529
|
if (!frame3)
|
|
4109
4530
|
frame3 = requestAnimationFrame(tick);
|
|
4110
4531
|
}
|
|
4111
|
-
function
|
|
4532
|
+
function reset18() {
|
|
4112
4533
|
rate = 1;
|
|
4113
4534
|
if (frame3) {
|
|
4114
4535
|
cancelAnimationFrame(frame3);
|
|
@@ -4133,6 +4554,7 @@ var persist = true;
|
|
|
4133
4554
|
var running = false;
|
|
4134
4555
|
var native2 = null;
|
|
4135
4556
|
var nativeNote = null;
|
|
4557
|
+
var toldRealPhone = false;
|
|
4136
4558
|
var inFrame = false;
|
|
4137
4559
|
var stopRelay = null;
|
|
4138
4560
|
var panelMoving = null;
|
|
@@ -4151,6 +4573,10 @@ function driver() {
|
|
|
4151
4573
|
}
|
|
4152
4574
|
function applyState(next) {
|
|
4153
4575
|
state = inFrame ? framed(next) : next;
|
|
4576
|
+
if (running && !inFrame && native2?.realPhone && toldRealPhone !== state.panel.realPhone) {
|
|
4577
|
+
toldRealPhone = state.panel.realPhone;
|
|
4578
|
+
native2.realPhone(toldRealPhone);
|
|
4579
|
+
}
|
|
4154
4580
|
const active2 = driver();
|
|
4155
4581
|
const page = inPage(state, active2);
|
|
4156
4582
|
const scheme = inFrame && nativeScheme(page.scheme) ? "system" : page.scheme;
|
|
@@ -4163,30 +4589,32 @@ function applyState(next) {
|
|
|
4163
4589
|
transparency: page.transparency,
|
|
4164
4590
|
touch: touchScreen
|
|
4165
4591
|
});
|
|
4166
|
-
|
|
4592
|
+
apply7({
|
|
4167
4593
|
on: touchScreen || nativeTouch,
|
|
4168
4594
|
points: !nativeTouch && uaPreset(state.ua.preset) === undefined
|
|
4169
4595
|
});
|
|
4170
|
-
|
|
4171
|
-
apply5(
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4596
|
+
apply10(touchScreen && state.touchPointer);
|
|
4597
|
+
apply5(inFrame ? screenSizeOf(state) : null);
|
|
4598
|
+
apply6(touchScreen);
|
|
4599
|
+
apply19(state.speed);
|
|
4600
|
+
apply8(state.locale);
|
|
4601
|
+
apply16(state.pseudo);
|
|
4175
4602
|
apply(state.geo);
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4603
|
+
apply9(resolveTimeZone(state.timeZone, state.geo), state.clock);
|
|
4604
|
+
apply12(state.clock);
|
|
4605
|
+
apply13(page.network);
|
|
4179
4606
|
apply2(page.text);
|
|
4180
4607
|
if (active2 && !inFrame)
|
|
4181
4608
|
drive(active2, state);
|
|
4182
4609
|
else if (native2 && !inFrame)
|
|
4183
4610
|
driveUa(native2, state);
|
|
4184
|
-
|
|
4185
|
-
apply4(state.ua);
|
|
4611
|
+
apply17(state.spacing);
|
|
4186
4612
|
const sized2 = inFrame ? state : framing(state, active2);
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4613
|
+
apply4(!inFrame && needsFrame(sized2) ? DEFAULT_STATE.ua : state.ua);
|
|
4614
|
+
apply11(sized2);
|
|
4615
|
+
apply15(state.overflow && !needsFrame(sized2));
|
|
4616
|
+
apply14(state.outlines);
|
|
4617
|
+
apply18(!inFrame && shownHere(state.panel.devIcon));
|
|
4190
4618
|
if (persist)
|
|
4191
4619
|
save(state);
|
|
4192
4620
|
sync(sized2);
|
|
@@ -4203,6 +4631,9 @@ function setNative(on3, note) {
|
|
|
4203
4631
|
if (running && (changed || note !== undefined))
|
|
4204
4632
|
applyState(state);
|
|
4205
4633
|
}
|
|
4634
|
+
function hostSendsUa() {
|
|
4635
|
+
return native2?.ua !== undefined && native2.realPhone !== undefined;
|
|
4636
|
+
}
|
|
4206
4637
|
function nativeSwitch() {
|
|
4207
4638
|
if (!native2?.setting)
|
|
4208
4639
|
return null;
|
|
@@ -4226,7 +4657,7 @@ function keepPlace2() {
|
|
|
4226
4657
|
if (persist)
|
|
4227
4658
|
keepPlace(state);
|
|
4228
4659
|
}
|
|
4229
|
-
function
|
|
4660
|
+
function reset19() {
|
|
4230
4661
|
applyState(resetState(state));
|
|
4231
4662
|
}
|
|
4232
4663
|
function onMessage(event) {
|
|
@@ -4271,7 +4702,10 @@ function start4(options = {}) {
|
|
|
4271
4702
|
onZoom((zoom) => setState({ zoom }));
|
|
4272
4703
|
onRefused(native2?.refused ?? null);
|
|
4273
4704
|
onFramed(native2?.framed ?? null);
|
|
4274
|
-
|
|
4705
|
+
onLoader(native2?.load ?? null);
|
|
4706
|
+
const first = merge(stored ? load() : { ...DEFAULT_STATE }, options.state ?? {});
|
|
4707
|
+
toldRealPhone = first.panel.realPhone;
|
|
4708
|
+
applyState(first);
|
|
4275
4709
|
if (!inFrame)
|
|
4276
4710
|
return;
|
|
4277
4711
|
relay(overflowCount());
|
|
@@ -4291,23 +4725,26 @@ function stop2() {
|
|
|
4291
4725
|
onZoom(null);
|
|
4292
4726
|
onRefused(null);
|
|
4293
4727
|
onFramed(null);
|
|
4728
|
+
onLoader(null);
|
|
4294
4729
|
destroy();
|
|
4295
|
-
reset5();
|
|
4296
|
-
reset8();
|
|
4297
|
-
reset4();
|
|
4298
|
-
reset16();
|
|
4299
4730
|
reset6();
|
|
4300
|
-
|
|
4301
|
-
|
|
4731
|
+
reset9();
|
|
4732
|
+
reset4();
|
|
4733
|
+
reset5();
|
|
4734
|
+
reset18();
|
|
4302
4735
|
reset7();
|
|
4303
|
-
|
|
4736
|
+
reset15();
|
|
4737
|
+
reset();
|
|
4738
|
+
reset8();
|
|
4304
4739
|
reset11();
|
|
4740
|
+
reset12();
|
|
4305
4741
|
reset2();
|
|
4306
|
-
|
|
4742
|
+
reset16();
|
|
4307
4743
|
reset3();
|
|
4308
|
-
|
|
4744
|
+
reset10();
|
|
4745
|
+
reset14();
|
|
4309
4746
|
reset13();
|
|
4310
|
-
|
|
4747
|
+
reset17();
|
|
4311
4748
|
if (native2)
|
|
4312
4749
|
release(native2);
|
|
4313
4750
|
native2 = null;
|
|
@@ -4561,4 +4998,4 @@ function forwardKeys(keys = () => defaultKeys(), open = () => true) {
|
|
|
4561
4998
|
return () => window.removeEventListener("keydown", onKeydown, true);
|
|
4562
4999
|
}
|
|
4563
5000
|
|
|
4564
|
-
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,
|
|
5001
|
+
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 };
|