@vinena/knobs 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +7 -0
- package/dist/early.global.js +6 -6
- package/dist/{elementsview-jnkbhzkj.js → elementsview-2z4pkrdz.js} +4 -4
- package/dist/{elementsview-tf4qzmtw.js → elementsview-qn8qyksa.js} +4 -4
- package/dist/engine/browserdraw.d.ts +24 -2
- package/dist/engine/browserkit.d.ts +18 -1
- package/dist/engine/browserui.d.ts +162 -22
- package/dist/engine/devicon.d.ts +59 -0
- package/dist/engine/fit.d.ts +4 -3
- package/dist/engine/foldflip.d.ts +40 -0
- package/dist/engine/identity.d.ts +7 -4
- package/dist/engine/mock.d.ts +16 -0
- package/dist/engine/mockdata.d.ts +4 -1
- package/dist/engine/mockdraw.d.ts +14 -2
- package/dist/engine/pageshot.d.ts +5 -2
- package/dist/engine/safaridraw.d.ts +162 -10
- package/dist/engine/screen.d.ts +24 -0
- package/dist/engine/store.d.ts +2 -1
- package/dist/engine/tabicon.d.ts +43 -0
- package/dist/engine/toplayer.d.ts +62 -0
- package/dist/engine/touchpointer.d.ts +0 -21
- package/dist/engine/underbar.d.ts +61 -0
- package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
- package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
- package/dist/host.d.ts +51 -0
- package/dist/{index-zvze25nf.js → index-30fc6php.js} +1 -1
- package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
- package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
- package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
- package/dist/{index-ke6v7919.js → index-hv02xka3.js} +20 -8
- package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
- package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
- package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
- package/dist/{index-k015tb6c.js → index-trx7bxdk.js} +4 -4
- package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +270 -176
- package/dist/index.js +398 -124
- package/dist/instance.d.ts +23 -4
- package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
- package/dist/{react-sq9pkw4k.js → react-16spgn0h.js} +1 -1
- package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
- package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
- package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
- package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
- package/dist/{react-eygws6cx.js → react-sw8d8c94.js} +4 -4
- package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
- package/dist/react.js +394 -123
- package/dist/{storageview-vf8v8q8j.js → storageview-r595qpt9.js} +4 -4
- package/dist/{storageview-sb23henh.js → storageview-s7heg93p.js} +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/ui/footer.d.ts +9 -2
- package/dist/ui/panel.d.ts +16 -2
- package/dist/ui/settings.d.ts +17 -1
- package/dist/version.d.ts +2 -0
- package/package.json +3 -2
- package/skills/devknobs/SKILL.md +1 -1
- package/dist/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-fm9y8dbn.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-w0v516w5.js");
|
|
2093
2198
|
var loading = null;
|
|
2094
2199
|
var down = false;
|
|
2095
2200
|
var waiting = [];
|
|
@@ -2128,12 +2233,12 @@ function failed(error) {
|
|
|
2128
2233
|
dropEarly();
|
|
2129
2234
|
exit?.();
|
|
2130
2235
|
}
|
|
2131
|
-
function whenIn(
|
|
2236
|
+
function whenIn(watch2) {
|
|
2132
2237
|
if (kit)
|
|
2133
|
-
return
|
|
2238
|
+
return watch2(kit);
|
|
2134
2239
|
let stop = null;
|
|
2135
2240
|
const run = (loaded) => {
|
|
2136
|
-
stop =
|
|
2241
|
+
stop = watch2(loaded);
|
|
2137
2242
|
};
|
|
2138
2243
|
waiting.push(run);
|
|
2139
2244
|
return () => {
|
|
@@ -2143,7 +2248,7 @@ function whenIn(watch) {
|
|
|
2143
2248
|
stop?.();
|
|
2144
2249
|
};
|
|
2145
2250
|
}
|
|
2146
|
-
function
|
|
2251
|
+
function apply11(state) {
|
|
2147
2252
|
if (kit) {
|
|
2148
2253
|
kit.width.apply(state);
|
|
2149
2254
|
return;
|
|
@@ -2164,7 +2269,7 @@ function apply10(state) {
|
|
|
2164
2269
|
function sync(state) {
|
|
2165
2270
|
kit?.width.sync(state);
|
|
2166
2271
|
}
|
|
2167
|
-
function
|
|
2272
|
+
function reset10() {
|
|
2168
2273
|
kit?.width.reset();
|
|
2169
2274
|
before = null;
|
|
2170
2275
|
latest = null;
|
|
@@ -2233,7 +2338,7 @@ __export(exports_engine, {
|
|
|
2233
2338
|
start: () => start4,
|
|
2234
2339
|
setState: () => setState,
|
|
2235
2340
|
setNative: () => setNative,
|
|
2236
|
-
reset: () =>
|
|
2341
|
+
reset: () => reset19,
|
|
2237
2342
|
replay: () => replay2,
|
|
2238
2343
|
ready: () => ready,
|
|
2239
2344
|
nativeSwitch: () => nativeSwitch,
|
|
@@ -2963,7 +3068,7 @@ function bodyOf(xhr, type, loaded) {
|
|
|
2963
3068
|
return record.size === 0 ? null : record;
|
|
2964
3069
|
}
|
|
2965
3070
|
var FAILS = ["error", "abort", "timeout"];
|
|
2966
|
-
function
|
|
3071
|
+
function watch2(xhr, id, url, log) {
|
|
2967
3072
|
let outcome = null;
|
|
2968
3073
|
let error = null;
|
|
2969
3074
|
let over2 = false;
|
|
@@ -3058,7 +3163,7 @@ function patchXhr(patches, log) {
|
|
|
3058
3163
|
const body = describeBody(args[0], headerOf(headers, "content-type"));
|
|
3059
3164
|
const initiator = trimStack(new Error().stack, 1);
|
|
3060
3165
|
id = log.start("xhr", { method, url, headers: [...headers], body, initiator });
|
|
3061
|
-
request.drop =
|
|
3166
|
+
request.drop = watch2(this, id, url, log);
|
|
3062
3167
|
} catch {}
|
|
3063
3168
|
try {
|
|
3064
3169
|
return original.apply(this, args);
|
|
@@ -3313,14 +3418,14 @@ function restore2() {
|
|
|
3313
3418
|
}
|
|
3314
3419
|
installed2 = [];
|
|
3315
3420
|
}
|
|
3316
|
-
function
|
|
3421
|
+
function apply12(value) {
|
|
3317
3422
|
on = sends(value);
|
|
3318
3423
|
if (on)
|
|
3319
3424
|
patch();
|
|
3320
3425
|
else
|
|
3321
3426
|
restore2();
|
|
3322
3427
|
}
|
|
3323
|
-
function
|
|
3428
|
+
function reset11() {
|
|
3324
3429
|
on = false;
|
|
3325
3430
|
restore2();
|
|
3326
3431
|
}
|
|
@@ -3352,7 +3457,7 @@ function connection() {
|
|
|
3352
3457
|
function readConnection(target) {
|
|
3353
3458
|
return CONNECTION_KEYS.map((key) => String(Reflect.get(target, key))).join();
|
|
3354
3459
|
}
|
|
3355
|
-
function
|
|
3460
|
+
function apply13(value) {
|
|
3356
3461
|
const wasOnline = navigator.onLine;
|
|
3357
3462
|
if (value.online === "offline")
|
|
3358
3463
|
shadow(navigator, "onLine", false);
|
|
@@ -3380,27 +3485,27 @@ function apply12(value) {
|
|
|
3380
3485
|
if (readConnection(target) !== before2)
|
|
3381
3486
|
target.dispatchEvent(new Event("change"));
|
|
3382
3487
|
}
|
|
3383
|
-
function
|
|
3488
|
+
function reset12() {
|
|
3384
3489
|
if (shadowed.size > 0)
|
|
3385
|
-
|
|
3490
|
+
apply13(SYSTEM);
|
|
3386
3491
|
shadowed.clear();
|
|
3387
3492
|
}
|
|
3388
3493
|
|
|
3389
3494
|
// src/engine/outlines.ts
|
|
3390
3495
|
var NAME = "outlines";
|
|
3391
|
-
function
|
|
3496
|
+
function apply14(value) {
|
|
3392
3497
|
if (!value) {
|
|
3393
|
-
|
|
3498
|
+
reset13();
|
|
3394
3499
|
return;
|
|
3395
3500
|
}
|
|
3396
3501
|
ensureStyle(NAME).textContent = "body *:not([data-devknobs],[data-devknobs] *){outline:1px solid rgba(127,127,127,.5)!important}";
|
|
3397
3502
|
}
|
|
3398
|
-
function
|
|
3503
|
+
function reset13() {
|
|
3399
3504
|
removeStyle(NAME);
|
|
3400
3505
|
}
|
|
3401
3506
|
|
|
3402
3507
|
// src/engine/tree.ts
|
|
3403
|
-
function
|
|
3508
|
+
function isOwn2(node) {
|
|
3404
3509
|
let current = node;
|
|
3405
3510
|
while (current) {
|
|
3406
3511
|
if (current instanceof Element && current.closest("[data-devknobs]"))
|
|
@@ -3568,7 +3673,7 @@ function schedule() {
|
|
|
3568
3673
|
});
|
|
3569
3674
|
}
|
|
3570
3675
|
function onMutation(records) {
|
|
3571
|
-
if (timer2 || records.every((record) =>
|
|
3676
|
+
if (timer2 || records.every((record) => isOwn2(record.target)))
|
|
3572
3677
|
return;
|
|
3573
3678
|
timer2 = window.setTimeout(() => {
|
|
3574
3679
|
timer2 = 0;
|
|
@@ -3595,9 +3700,9 @@ function start2() {
|
|
|
3595
3700
|
});
|
|
3596
3701
|
update();
|
|
3597
3702
|
}
|
|
3598
|
-
function
|
|
3703
|
+
function apply15(value) {
|
|
3599
3704
|
if (!value) {
|
|
3600
|
-
|
|
3705
|
+
reset14();
|
|
3601
3706
|
return;
|
|
3602
3707
|
}
|
|
3603
3708
|
if (document.body)
|
|
@@ -3605,7 +3710,7 @@ function apply14(value) {
|
|
|
3605
3710
|
else
|
|
3606
3711
|
document.addEventListener("DOMContentLoaded", start2, { once: true });
|
|
3607
3712
|
}
|
|
3608
|
-
function
|
|
3713
|
+
function reset14() {
|
|
3609
3714
|
document.removeEventListener("DOMContentLoaded", start2);
|
|
3610
3715
|
if (!host2)
|
|
3611
3716
|
return;
|
|
@@ -3806,9 +3911,9 @@ function whenIdle(run) {
|
|
|
3806
3911
|
clearTimeout(timer3);
|
|
3807
3912
|
};
|
|
3808
3913
|
}
|
|
3809
|
-
function
|
|
3914
|
+
function apply16(value) {
|
|
3810
3915
|
if (!value) {
|
|
3811
|
-
|
|
3916
|
+
reset15();
|
|
3812
3917
|
return;
|
|
3813
3918
|
}
|
|
3814
3919
|
if (on2 || cancelStart)
|
|
@@ -3818,7 +3923,7 @@ function apply15(value) {
|
|
|
3818
3923
|
function pending() {
|
|
3819
3924
|
return cancelStart !== null;
|
|
3820
3925
|
}
|
|
3821
|
-
function
|
|
3926
|
+
function reset15() {
|
|
3822
3927
|
cancelStart?.();
|
|
3823
3928
|
cancelStart = null;
|
|
3824
3929
|
if (!on2)
|
|
@@ -3896,7 +4001,7 @@ function collect(roots = shadowRoots()) {
|
|
|
3896
4001
|
for (const animation of scope.getAnimations())
|
|
3897
4002
|
found.add(animation);
|
|
3898
4003
|
}
|
|
3899
|
-
return Array.from(found).filter((animation) => !
|
|
4004
|
+
return Array.from(found).filter((animation) => !isOwn2(targetOf(animation)));
|
|
3900
4005
|
}
|
|
3901
4006
|
|
|
3902
4007
|
// src/engine/replay.ts
|
|
@@ -3971,17 +4076,326 @@ function replay() {
|
|
|
3971
4076
|
var NAME2 = "spacing";
|
|
3972
4077
|
var NOT_OURS = ":not([data-devknobs],[data-devknobs] *)";
|
|
3973
4078
|
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
|
|
4079
|
+
function apply17(value) {
|
|
3975
4080
|
if (!value) {
|
|
3976
|
-
|
|
4081
|
+
reset16();
|
|
3977
4082
|
return;
|
|
3978
4083
|
}
|
|
3979
4084
|
ensureStyle(NAME2).textContent = CSS2;
|
|
3980
4085
|
}
|
|
3981
|
-
function
|
|
4086
|
+
function reset16() {
|
|
3982
4087
|
removeStyle(NAME2);
|
|
3983
4088
|
}
|
|
3984
4089
|
|
|
4090
|
+
// src/engine/devicon.ts
|
|
4091
|
+
var RIBBON_YELLOW = "#ffd60a";
|
|
4092
|
+
var RIBBON_INK = "#111111";
|
|
4093
|
+
var RIBBON_TEXT_MIN = 32;
|
|
4094
|
+
function tileBox(data, size) {
|
|
4095
|
+
let x0 = size;
|
|
4096
|
+
let y0 = size;
|
|
4097
|
+
let x1 = -1;
|
|
4098
|
+
let y1 = -1;
|
|
4099
|
+
for (let y = 0;y < size; y++) {
|
|
4100
|
+
for (let x = 0;x < size; x++) {
|
|
4101
|
+
if ((data[(y * size + x) * 4 + 3] ?? 0) <= 128)
|
|
4102
|
+
continue;
|
|
4103
|
+
if (x < x0)
|
|
4104
|
+
x0 = x;
|
|
4105
|
+
if (x > x1)
|
|
4106
|
+
x1 = x;
|
|
4107
|
+
if (y < y0)
|
|
4108
|
+
y0 = y;
|
|
4109
|
+
if (y > y1)
|
|
4110
|
+
y1 = y;
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
if (x1 < 0)
|
|
4114
|
+
return { x: 0, y: 0, s: size };
|
|
4115
|
+
const w = x1 - x0 + 1;
|
|
4116
|
+
const h = y1 - y0 + 1;
|
|
4117
|
+
const s = Math.max(w, h);
|
|
4118
|
+
return { x: x0 - (s - w) / 2, y: y0 - (s - h) / 2, s };
|
|
4119
|
+
}
|
|
4120
|
+
function ribbonGeometry(size, box) {
|
|
4121
|
+
const width = 0.3 * box.s;
|
|
4122
|
+
const distance = (size <= 20 ? 0.2 : 0.22) * box.s;
|
|
4123
|
+
const textSize = 0.62 * width;
|
|
4124
|
+
return {
|
|
4125
|
+
box,
|
|
4126
|
+
radius: 0.225 * box.s,
|
|
4127
|
+
origin: { x: box.x + box.s, y: box.y },
|
|
4128
|
+
angle: Math.PI / 4,
|
|
4129
|
+
width,
|
|
4130
|
+
distance,
|
|
4131
|
+
edge: Math.max(1, box.s / 40),
|
|
4132
|
+
reach: 2 * box.s,
|
|
4133
|
+
text: size >= RIBBON_TEXT_MIN ? { size: textSize, y: distance + width / 2 + 0.04 * textSize } : null
|
|
4134
|
+
};
|
|
4135
|
+
}
|
|
4136
|
+
function drawDevIcon(context, size, source) {
|
|
4137
|
+
context.clearRect(0, 0, size, size);
|
|
4138
|
+
const w = source.width || size;
|
|
4139
|
+
const h = source.height || size;
|
|
4140
|
+
const scale = size / Math.max(w, h);
|
|
4141
|
+
context.drawImage(source, (size - w * scale) / 2, (size - h * scale) / 2, w * scale, h * scale);
|
|
4142
|
+
const box = tileBox(context.getImageData(0, 0, size, size).data, size);
|
|
4143
|
+
const g = ribbonGeometry(size, box);
|
|
4144
|
+
context.save();
|
|
4145
|
+
context.beginPath();
|
|
4146
|
+
context.roundRect(box.x, box.y, box.s, box.s, g.radius);
|
|
4147
|
+
context.clip();
|
|
4148
|
+
context.translate(g.origin.x, g.origin.y);
|
|
4149
|
+
context.rotate(g.angle);
|
|
4150
|
+
context.fillStyle = RIBBON_INK;
|
|
4151
|
+
context.fillRect(-g.reach, g.distance - g.edge, 2 * g.reach, g.width + 2 * g.edge);
|
|
4152
|
+
context.fillStyle = RIBBON_YELLOW;
|
|
4153
|
+
context.fillRect(-g.reach, g.distance, 2 * g.reach, g.width);
|
|
4154
|
+
if (g.text) {
|
|
4155
|
+
context.fillStyle = RIBBON_INK;
|
|
4156
|
+
context.font = `700 ${g.text.size}px -apple-system, system-ui, sans-serif`;
|
|
4157
|
+
context.textAlign = "center";
|
|
4158
|
+
context.textBaseline = "middle";
|
|
4159
|
+
context.fillText("DEV", 0, g.text.y);
|
|
4160
|
+
}
|
|
4161
|
+
context.restore();
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
// src/engine/tabicon.ts
|
|
4165
|
+
var ORIGINAL_HREF = "data-devknobs-href";
|
|
4166
|
+
var ADDED_ICON = "data-devknobs-icon";
|
|
4167
|
+
var FALLBACK = "/favicon.ico";
|
|
4168
|
+
var TOUCH_RELS = ["apple-touch-icon", "apple-touch-icon-precomposed"];
|
|
4169
|
+
function localHost(hostname) {
|
|
4170
|
+
const host3 = hostname.toLowerCase().replace(/\.$/, "");
|
|
4171
|
+
if (host3 === "localhost" || host3.endsWith(".localhost") || host3.endsWith(".local"))
|
|
4172
|
+
return true;
|
|
4173
|
+
if (host3 === "[::1]" || host3 === "::1" || host3 === "0.0.0.0")
|
|
4174
|
+
return true;
|
|
4175
|
+
if (/^\[?(f[cd][0-9a-f]{2}|fe[89ab][0-9a-f]):/.test(host3))
|
|
4176
|
+
return true;
|
|
4177
|
+
const ip = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host3);
|
|
4178
|
+
if (!ip)
|
|
4179
|
+
return false;
|
|
4180
|
+
const [a = 0, b = 0, ...rest] = ip.slice(1).map(Number);
|
|
4181
|
+
if ([a, b, ...rest].some((part) => part > 255))
|
|
4182
|
+
return false;
|
|
4183
|
+
return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
4184
|
+
}
|
|
4185
|
+
function devIconShown(value, hostname) {
|
|
4186
|
+
return value === "on" || value === "auto" && localHost(hostname);
|
|
4187
|
+
}
|
|
4188
|
+
function devIconFor(on3, hostname) {
|
|
4189
|
+
if (on3 === localHost(hostname))
|
|
4190
|
+
return "auto";
|
|
4191
|
+
return on3 ? "on" : "off";
|
|
4192
|
+
}
|
|
4193
|
+
function shownHere(value) {
|
|
4194
|
+
if (typeof window === "undefined" || typeof document === "undefined")
|
|
4195
|
+
return false;
|
|
4196
|
+
return window.top === window && devIconShown(value, window.location.hostname);
|
|
4197
|
+
}
|
|
4198
|
+
function relTokens(link) {
|
|
4199
|
+
return (link.getAttribute("rel") ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
4200
|
+
}
|
|
4201
|
+
function isIconLink(node) {
|
|
4202
|
+
if (typeof node !== "object" || node === null)
|
|
4203
|
+
return false;
|
|
4204
|
+
const link = node;
|
|
4205
|
+
if (link.nodeType !== 1 || link.localName !== "link")
|
|
4206
|
+
return false;
|
|
4207
|
+
return relTokens(link).some((rel) => rel === "icon" || TOUCH_RELS.includes(rel));
|
|
4208
|
+
}
|
|
4209
|
+
var SIZE_MIN = 16;
|
|
4210
|
+
var SIZE_MAX = 512;
|
|
4211
|
+
function iconSize(link) {
|
|
4212
|
+
const declared = /^(\d+)x(\d+)$/i.exec((link.getAttribute("sizes") ?? "").trim().split(/\s+/)[0] ?? "");
|
|
4213
|
+
const width = declared ? Number(declared[1]) : 0;
|
|
4214
|
+
if (width > 0)
|
|
4215
|
+
return Math.min(SIZE_MAX, Math.max(SIZE_MIN, width));
|
|
4216
|
+
return relTokens(link).some((rel) => TOUCH_RELS.includes(rel)) ? 180 : 32;
|
|
4217
|
+
}
|
|
4218
|
+
function createTabIcon(env) {
|
|
4219
|
+
const doc = env.document;
|
|
4220
|
+
let on3 = false;
|
|
4221
|
+
let observer3 = null;
|
|
4222
|
+
const drawn = new Map;
|
|
4223
|
+
const loading2 = new Map;
|
|
4224
|
+
let added = null;
|
|
4225
|
+
let told = false;
|
|
4226
|
+
function iconLinks() {
|
|
4227
|
+
return Array.from(doc.querySelectorAll("link")).filter(isIconLink);
|
|
4228
|
+
}
|
|
4229
|
+
function swap(link) {
|
|
4230
|
+
if (!on3 || !isIconLink(link))
|
|
4231
|
+
return;
|
|
4232
|
+
const current = link.getAttribute("href");
|
|
4233
|
+
if (!current)
|
|
4234
|
+
return;
|
|
4235
|
+
const mine = drawn.get(link);
|
|
4236
|
+
const href = mine?.url === current ? mine.original : current;
|
|
4237
|
+
if (loading2.get(link) === href)
|
|
4238
|
+
return;
|
|
4239
|
+
loading2.set(link, href);
|
|
4240
|
+
env.load(href).then((source) => {
|
|
4241
|
+
if (loading2.get(link) !== href)
|
|
4242
|
+
return;
|
|
4243
|
+
loading2.delete(link);
|
|
4244
|
+
if (!on3 || link.getAttribute("href") !== current)
|
|
4245
|
+
return;
|
|
4246
|
+
const url = source ? env.render(source, iconSize(link)) : null;
|
|
4247
|
+
if (!url) {
|
|
4248
|
+
if (!told)
|
|
4249
|
+
console.debug(`devknobs: the tab icon ${href} could not be read, so it shows no dev ribbon`);
|
|
4250
|
+
told = true;
|
|
4251
|
+
return;
|
|
4252
|
+
}
|
|
4253
|
+
drawn.set(link, { url, original: href });
|
|
4254
|
+
link.setAttribute(ORIGINAL_HREF, href);
|
|
4255
|
+
link.setAttribute("href", url);
|
|
4256
|
+
});
|
|
4257
|
+
}
|
|
4258
|
+
function forget(link) {
|
|
4259
|
+
loading2.delete(link);
|
|
4260
|
+
const mine = drawn.get(link);
|
|
4261
|
+
if (!mine)
|
|
4262
|
+
return;
|
|
4263
|
+
drawn.delete(link);
|
|
4264
|
+
if (link.getAttribute("href") === mine.url)
|
|
4265
|
+
link.setAttribute("href", mine.original);
|
|
4266
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
4267
|
+
}
|
|
4268
|
+
function linksIn(node) {
|
|
4269
|
+
if (isIconLink(node))
|
|
4270
|
+
return [node];
|
|
4271
|
+
if (node.nodeType !== 1)
|
|
4272
|
+
return [];
|
|
4273
|
+
return Array.from(node.querySelectorAll("link")).filter(isIconLink);
|
|
4274
|
+
}
|
|
4275
|
+
function fallback() {
|
|
4276
|
+
env.load(FALLBACK).then((source) => {
|
|
4277
|
+
if (!on3 || !source || added || iconLinks().length > 0)
|
|
4278
|
+
return;
|
|
4279
|
+
const link = doc.createElement("link");
|
|
4280
|
+
link.setAttribute("rel", "icon");
|
|
4281
|
+
link.setAttribute("href", FALLBACK);
|
|
4282
|
+
link.setAttribute(ADDED_ICON, "");
|
|
4283
|
+
added = link;
|
|
4284
|
+
(doc.head ?? doc.documentElement).append(link);
|
|
4285
|
+
swap(link);
|
|
4286
|
+
});
|
|
4287
|
+
}
|
|
4288
|
+
function watch3(records) {
|
|
4289
|
+
for (const record of records) {
|
|
4290
|
+
if (record.type === "attributes") {
|
|
4291
|
+
const link = record.target;
|
|
4292
|
+
if (!isIconLink(link)) {
|
|
4293
|
+
forget(link);
|
|
4294
|
+
continue;
|
|
4295
|
+
}
|
|
4296
|
+
if (record.attributeName === "href" && drawn.get(link)?.url === link.getAttribute("href"))
|
|
4297
|
+
continue;
|
|
4298
|
+
swap(link);
|
|
4299
|
+
continue;
|
|
4300
|
+
}
|
|
4301
|
+
for (const node of Array.from(record.removedNodes)) {
|
|
4302
|
+
for (const link of linksIn(node))
|
|
4303
|
+
if (link !== added)
|
|
4304
|
+
forget(link);
|
|
4305
|
+
}
|
|
4306
|
+
for (const node of Array.from(record.addedNodes)) {
|
|
4307
|
+
for (const link of linksIn(node)) {
|
|
4308
|
+
if (link !== added && added) {
|
|
4309
|
+
added.remove();
|
|
4310
|
+
added = null;
|
|
4311
|
+
}
|
|
4312
|
+
swap(link);
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
return {
|
|
4318
|
+
start() {
|
|
4319
|
+
if (on3)
|
|
4320
|
+
return;
|
|
4321
|
+
on3 = true;
|
|
4322
|
+
const links = iconLinks();
|
|
4323
|
+
for (const link of links)
|
|
4324
|
+
swap(link);
|
|
4325
|
+
if (links.length === 0)
|
|
4326
|
+
fallback();
|
|
4327
|
+
if (!env.Observer)
|
|
4328
|
+
return;
|
|
4329
|
+
observer3 = new env.Observer(watch3);
|
|
4330
|
+
observer3.observe(doc.documentElement, {
|
|
4331
|
+
childList: true,
|
|
4332
|
+
subtree: true,
|
|
4333
|
+
attributes: true,
|
|
4334
|
+
attributeFilter: ["href", "rel", "sizes"]
|
|
4335
|
+
});
|
|
4336
|
+
},
|
|
4337
|
+
stop() {
|
|
4338
|
+
if (!on3)
|
|
4339
|
+
return;
|
|
4340
|
+
on3 = false;
|
|
4341
|
+
observer3?.disconnect();
|
|
4342
|
+
observer3 = null;
|
|
4343
|
+
loading2.clear();
|
|
4344
|
+
for (const [link, { url, original }] of drawn) {
|
|
4345
|
+
if (link.getAttribute("href") === url)
|
|
4346
|
+
link.setAttribute("href", original);
|
|
4347
|
+
link.removeAttribute(ORIGINAL_HREF);
|
|
4348
|
+
}
|
|
4349
|
+
drawn.clear();
|
|
4350
|
+
added?.remove();
|
|
4351
|
+
added = null;
|
|
4352
|
+
}
|
|
4353
|
+
};
|
|
4354
|
+
}
|
|
4355
|
+
function loadImage(href) {
|
|
4356
|
+
return new Promise((resolve) => {
|
|
4357
|
+
const image = new Image;
|
|
4358
|
+
image.crossOrigin = "anonymous";
|
|
4359
|
+
image.onload = () => resolve(image);
|
|
4360
|
+
image.onerror = () => resolve(null);
|
|
4361
|
+
image.src = href;
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
function renderPng(source, size) {
|
|
4365
|
+
try {
|
|
4366
|
+
const canvas = document.createElement("canvas");
|
|
4367
|
+
canvas.width = size;
|
|
4368
|
+
canvas.height = size;
|
|
4369
|
+
const context = canvas.getContext("2d");
|
|
4370
|
+
if (!context)
|
|
4371
|
+
return null;
|
|
4372
|
+
drawDevIcon(context, size, source);
|
|
4373
|
+
return canvas.toDataURL("image/png");
|
|
4374
|
+
} catch {
|
|
4375
|
+
return null;
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
var live = null;
|
|
4379
|
+
function apply18(on3) {
|
|
4380
|
+
if (!on3) {
|
|
4381
|
+
reset17();
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
if (live || typeof document === "undefined")
|
|
4385
|
+
return;
|
|
4386
|
+
live = createTabIcon({
|
|
4387
|
+
document,
|
|
4388
|
+
load: loadImage,
|
|
4389
|
+
render: renderPng,
|
|
4390
|
+
Observer: typeof MutationObserver === "undefined" ? undefined : MutationObserver
|
|
4391
|
+
});
|
|
4392
|
+
live.start();
|
|
4393
|
+
}
|
|
4394
|
+
function reset17() {
|
|
4395
|
+
live?.stop();
|
|
4396
|
+
live = null;
|
|
4397
|
+
}
|
|
4398
|
+
|
|
3985
4399
|
// src/engine/speed.ts
|
|
3986
4400
|
var SPEED_MIN = 0;
|
|
3987
4401
|
var SPEED_MAX = 16;
|
|
@@ -4060,7 +4474,7 @@ function tick(now2) {
|
|
|
4060
4474
|
}
|
|
4061
4475
|
function onStart(event) {
|
|
4062
4476
|
const target = event.target;
|
|
4063
|
-
if (!(target instanceof Element) ||
|
|
4477
|
+
if (!(target instanceof Element) || isOwn2(target))
|
|
4064
4478
|
return;
|
|
4065
4479
|
for (const animation of target.getAnimations({ subtree: event.pseudoElement !== "" })) {
|
|
4066
4480
|
adopt(animation);
|
|
@@ -4073,7 +4487,7 @@ function patchAnimate() {
|
|
|
4073
4487
|
nativeAnimate = native2;
|
|
4074
4488
|
patchedAnimate = function animate(...args) {
|
|
4075
4489
|
const animation = native2.apply(this, args);
|
|
4076
|
-
if (rate !== 1 && !
|
|
4490
|
+
if (rate !== 1 && !isOwn2(this))
|
|
4077
4491
|
adopt(animation);
|
|
4078
4492
|
return animation;
|
|
4079
4493
|
};
|
|
@@ -4086,10 +4500,10 @@ function restoreAnimate() {
|
|
|
4086
4500
|
nativeAnimate = null;
|
|
4087
4501
|
patchedAnimate = null;
|
|
4088
4502
|
}
|
|
4089
|
-
function
|
|
4503
|
+
function apply19(value) {
|
|
4090
4504
|
const next = Number.isFinite(value) && value >= 0 ? value : 1;
|
|
4091
4505
|
if (next === 1) {
|
|
4092
|
-
|
|
4506
|
+
reset18();
|
|
4093
4507
|
return;
|
|
4094
4508
|
}
|
|
4095
4509
|
if (next === rate && frame3)
|
|
@@ -4108,7 +4522,7 @@ function apply17(value) {
|
|
|
4108
4522
|
if (!frame3)
|
|
4109
4523
|
frame3 = requestAnimationFrame(tick);
|
|
4110
4524
|
}
|
|
4111
|
-
function
|
|
4525
|
+
function reset18() {
|
|
4112
4526
|
rate = 1;
|
|
4113
4527
|
if (frame3) {
|
|
4114
4528
|
cancelAnimationFrame(frame3);
|
|
@@ -4163,30 +4577,32 @@ function applyState(next) {
|
|
|
4163
4577
|
transparency: page.transparency,
|
|
4164
4578
|
touch: touchScreen
|
|
4165
4579
|
});
|
|
4166
|
-
|
|
4580
|
+
apply7({
|
|
4167
4581
|
on: touchScreen || nativeTouch,
|
|
4168
4582
|
points: !nativeTouch && uaPreset(state.ua.preset) === undefined
|
|
4169
4583
|
});
|
|
4170
|
-
|
|
4171
|
-
apply5(
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4584
|
+
apply10(touchScreen && state.touchPointer);
|
|
4585
|
+
apply5(inFrame ? screenSizeOf(state) : null);
|
|
4586
|
+
apply6(touchScreen);
|
|
4587
|
+
apply19(state.speed);
|
|
4588
|
+
apply8(state.locale);
|
|
4589
|
+
apply16(state.pseudo);
|
|
4175
4590
|
apply(state.geo);
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4591
|
+
apply9(resolveTimeZone(state.timeZone, state.geo), state.clock);
|
|
4592
|
+
apply12(state.clock);
|
|
4593
|
+
apply13(page.network);
|
|
4179
4594
|
apply2(page.text);
|
|
4180
4595
|
if (active2 && !inFrame)
|
|
4181
4596
|
drive(active2, state);
|
|
4182
4597
|
else if (native2 && !inFrame)
|
|
4183
4598
|
driveUa(native2, state);
|
|
4184
|
-
|
|
4599
|
+
apply17(state.spacing);
|
|
4185
4600
|
apply4(state.ua);
|
|
4186
4601
|
const sized2 = inFrame ? state : framing(state, active2);
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4602
|
+
apply11(sized2);
|
|
4603
|
+
apply15(state.overflow && !needsFrame(sized2));
|
|
4604
|
+
apply14(state.outlines);
|
|
4605
|
+
apply18(!inFrame && shownHere(state.panel.devIcon));
|
|
4190
4606
|
if (persist)
|
|
4191
4607
|
save(state);
|
|
4192
4608
|
sync(sized2);
|
|
@@ -4226,7 +4642,7 @@ function keepPlace2() {
|
|
|
4226
4642
|
if (persist)
|
|
4227
4643
|
keepPlace(state);
|
|
4228
4644
|
}
|
|
4229
|
-
function
|
|
4645
|
+
function reset19() {
|
|
4230
4646
|
applyState(resetState(state));
|
|
4231
4647
|
}
|
|
4232
4648
|
function onMessage(event) {
|
|
@@ -4292,22 +4708,24 @@ function stop2() {
|
|
|
4292
4708
|
onRefused(null);
|
|
4293
4709
|
onFramed(null);
|
|
4294
4710
|
destroy();
|
|
4295
|
-
reset5();
|
|
4296
|
-
reset8();
|
|
4297
|
-
reset4();
|
|
4298
|
-
reset16();
|
|
4299
4711
|
reset6();
|
|
4300
|
-
|
|
4301
|
-
|
|
4712
|
+
reset9();
|
|
4713
|
+
reset4();
|
|
4714
|
+
reset5();
|
|
4715
|
+
reset18();
|
|
4302
4716
|
reset7();
|
|
4303
|
-
|
|
4717
|
+
reset15();
|
|
4718
|
+
reset();
|
|
4719
|
+
reset8();
|
|
4304
4720
|
reset11();
|
|
4721
|
+
reset12();
|
|
4305
4722
|
reset2();
|
|
4306
|
-
|
|
4723
|
+
reset16();
|
|
4307
4724
|
reset3();
|
|
4308
|
-
|
|
4725
|
+
reset10();
|
|
4726
|
+
reset14();
|
|
4309
4727
|
reset13();
|
|
4310
|
-
|
|
4728
|
+
reset17();
|
|
4311
4729
|
if (native2)
|
|
4312
4730
|
release(native2);
|
|
4313
4731
|
native2 = null;
|
|
@@ -4561,4 +4979,4 @@ function forwardKeys(keys = () => defaultKeys(), open = () => true) {
|
|
|
4561
4979
|
return () => window.removeEventListener("keydown", onKeydown, true);
|
|
4562
4980
|
}
|
|
4563
4981
|
|
|
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,
|
|
4982
|
+
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, devIconShown, devIconFor, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, LAYER, HOST_RESET, holdInTopLayer, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace, reset19 as reset, start4 as start, stop2 as stop, replay2 as replay, exports_engine, parseCombo, comboText, withShift, isFunctionKey, comboLabel, comboSpoken, defaultKeys, KEYS_FIELD, typesInField, lowerKey, keyIs, keyAction, isSearchKey, typeAhead, zoomAction, escapeStep, highlightAt, paletteMove, radioMove, forwardKeys, ROW_ICONS, rowIcon, BINDING_ICONS, icon, glyph };
|