@vinena/knobs 0.5.3 → 0.6.1

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +7 -6
  3. package/dist/context-amfyasb5.js +23 -0
  4. package/dist/context-svtr7vwt.js +22 -0
  5. package/dist/early.global.js +5 -5
  6. package/dist/edit/css.d.ts +59 -0
  7. package/dist/edit/html.d.ts +91 -0
  8. package/dist/edit/keep.d.ts +175 -0
  9. package/dist/edit/log.d.ts +107 -0
  10. package/dist/edit/replay.d.ts +28 -0
  11. package/dist/edit/risk.d.ts +33 -0
  12. package/dist/edit/rule.d.ts +31 -0
  13. package/dist/edit/source.d.ts +12 -0
  14. package/dist/edit/text.d.ts +66 -0
  15. package/dist/elementsview-dm5v3z5a.js +3761 -0
  16. package/dist/elementsview-xm82cvs2.js +3762 -0
  17. package/dist/engine/dock.d.ts +3 -4
  18. package/dist/engine/frame.d.ts +1 -1
  19. package/dist/engine/style.d.ts +15 -0
  20. package/dist/{framekit-cjz0e4y8.js → framekit-622h6w1f.js} +54 -47
  21. package/dist/{framekit-yk1jxjv7.js → framekit-yx612r28.js} +54 -47
  22. package/dist/index-0zp9py56.js +859 -0
  23. package/dist/{index-prjpx67p.js → index-1mstjadm.js} +126 -2167
  24. package/dist/{index-begsqdm0.js → index-4a4x1bt2.js} +1 -1
  25. package/dist/index-58jdczmj.js +44 -0
  26. package/dist/index-5tv6sr74.js +23 -0
  27. package/dist/index-6bc2ztfd.js +688 -0
  28. package/dist/index-7cb4x1vj.js +1885 -0
  29. package/dist/index-a974q3aa.js +34 -0
  30. package/dist/{index-q73py563.js → index-aymfvd8s.js} +1 -1
  31. package/dist/{index-zt3rheck.js → index-aynkv7qk.js} +11 -8
  32. package/dist/{index-p57fdttx.js → index-dzm8ywq0.js} +492 -2365
  33. package/dist/{index-9jhatmky.js → index-f60yax1j.js} +13 -8
  34. package/dist/index-f67wctn3.js +1858 -0
  35. package/dist/{index-vgfn2n1h.js → index-ftjdt358.js} +8 -171
  36. package/dist/{index-j1h13ahg.js → index-gm51cthv.js} +2 -45
  37. package/dist/index-kfdzsyyw.js +1859 -0
  38. package/dist/index-t4kssacm.js +208 -0
  39. package/dist/index-v0ht9q0g.js +1518 -0
  40. package/dist/{index-6wbgqkdz.js → index-x59vz1xx.js} +247 -905
  41. package/dist/index-xh39jtkq.js +32 -0
  42. package/dist/index-yb7fc59g.js +718 -0
  43. package/dist/index-zd6adby9.js +496 -0
  44. package/dist/index.d.ts +62 -0
  45. package/dist/index.global.js +438 -153
  46. package/dist/index.js +594 -486
  47. package/dist/react-0wepdf60.js +1519 -0
  48. package/dist/{react-gefkdkdz.js → react-1gqwa2yw.js} +1 -1
  49. package/dist/{index-sn2y6j09.js → react-3mfz1x2a.js} +126 -2167
  50. package/dist/react-4rbjw9af.js +33 -0
  51. package/dist/react-5rq7bnsy.js +210 -0
  52. package/dist/react-6bz05qk1.js +860 -0
  53. package/dist/{react-qgz9afa2.js → react-6fnxxs30.js} +8 -171
  54. package/dist/react-6q2cw2ya.js +689 -0
  55. package/dist/{react-7vjfsh40.js → react-6t4dbdzn.js} +11 -8
  56. package/dist/react-88es9b5q.js +719 -0
  57. package/dist/react-97b5b8j4.js +46 -0
  58. package/dist/{react-mmq2zya3.js → react-bxzn8vq5.js} +1 -1
  59. package/dist/{react-3rhdj2k1.js → react-cs62p9qh.js} +62 -720
  60. package/dist/react-ethftdxp.js +497 -0
  61. package/dist/react-fp73vhyd.js +36 -0
  62. package/dist/{react-qfpg79hs.js → react-me102s1a.js} +2 -45
  63. package/dist/react-t2qnewz2.js +24 -0
  64. package/dist/react-ttj8f9qp.js +1886 -0
  65. package/dist/{react-806qmkyz.js → react-v8497a41.js} +13 -8
  66. package/dist/{react-6tss0r9f.js → react-wqn4sx0n.js} +265 -2137
  67. package/dist/react.js +590 -486
  68. package/dist/replay-j18rw92k.js +258 -0
  69. package/dist/replay-vtg0vqj2.js +257 -0
  70. package/dist/{storageview-7cv0vpdm.js → storageview-6xj7zb63.js} +11 -7
  71. package/dist/{storageview-dyhpgt8f.js → storageview-pzn8yaad.js} +11 -7
  72. package/dist/styles/force.d.ts +66 -0
  73. package/dist/ui/bindings.d.ts +31 -5
  74. package/dist/ui/changes.d.ts +49 -0
  75. package/dist/ui/cssauto.d.ts +119 -0
  76. package/dist/ui/cssedit.d.ts +80 -0
  77. package/dist/ui/domedit.d.ts +99 -0
  78. package/dist/ui/domtree.d.ts +26 -1
  79. package/dist/ui/elementsview.d.ts +17 -2
  80. package/dist/ui/htmledit.d.ts +62 -0
  81. package/dist/ui/inspector.d.ts +6 -1
  82. package/dist/ui/keys.d.ts +12 -8
  83. package/dist/ui/pane.d.ts +0 -2
  84. package/dist/ui/panel.d.ts +3 -0
  85. package/dist/ui/prefs.d.ts +30 -10
  86. package/dist/ui/settings.d.ts +22 -1
  87. package/dist/ui/size.d.ts +14 -22
  88. package/dist/ui/stylesview.d.ts +30 -1
  89. package/package.json +1 -1
  90. package/skills/devknobs/SKILL.md +95 -0
  91. package/dist/elementsview-1wsxcdtj.js +0 -2874
  92. package/dist/elementsview-3kv34jfx.js +0 -2873
  93. package/dist/index-78r0f8pw.js +0 -27
  94. package/dist/react-adky72h9.js +0 -29
@@ -1,25 +1,106 @@
1
1
  "use client";
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
2
+
3
+ // src/engine/clock.ts
4
+ var HOUR = 3600000;
5
+ var DAY = 86400000;
6
+ var CLOCK_SPEED_MIN = 0.001;
7
+ var CLOCK_SPEED_MAX = 1e6;
8
+ var CLOCK_PRESETS = [
9
+ { label: "+1h", ms: HOUR },
10
+ { label: "+1d", ms: DAY },
11
+ { label: "+2d", ms: 2 * DAY },
12
+ { label: "+1w", ms: 7 * DAY },
13
+ { label: "+30d", ms: 30 * DAY }
14
+ ];
15
+ var SHARED = Symbol.for("devknobs.clock");
16
+ var shared = globalThis[SHARED] ??= {
17
+ Date,
18
+ clock: null
15
19
  };
16
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
17
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
18
- }) : x)(function(x) {
19
- if (typeof require !== "undefined")
20
- return require.apply(this, arguments);
21
- throw Error('Dynamic require of "' + x + '" is not supported');
22
- });
20
+ var NativeDate = shared.Date;
21
+ function realNow() {
22
+ return NativeDate.now();
23
+ }
24
+ function virtualNow(clock, real) {
25
+ if (clock.mode === "frozen")
26
+ return clock.at;
27
+ if (clock.mode === "offset")
28
+ return Math.floor(clock.at + (real - clock.since) * clock.speed);
29
+ return real;
30
+ }
31
+ function mergeClock(clock, patch, real = realNow()) {
32
+ if (!patch)
33
+ return clock;
34
+ const next = { ...clock, ...patch };
35
+ if (patch.since !== undefined && patch.since !== clock.since)
36
+ return next;
37
+ if (patch.at !== undefined && patch.since === undefined)
38
+ return { ...next, since: real };
39
+ const moved = (key) => patch[key] !== undefined && patch[key] !== clock[key];
40
+ if (moved("mode") || moved("speed"))
41
+ return { ...next, at: virtualNow(clock, real), since: real };
42
+ return next;
43
+ }
44
+ function setClock(value) {
45
+ shared.clock = value && value.mode !== "system" ? { ...value } : null;
46
+ }
47
+ function clockOn() {
48
+ return shared.clock !== null;
49
+ }
50
+ function now() {
51
+ return shared.clock ? virtualNow(shared.clock, realNow()) : realNow();
52
+ }
53
+ function wrapDate(original, zone) {
54
+ return new Proxy(original, {
55
+ construct(target, args, newTarget) {
56
+ if (args.length === 0 && shared.clock)
57
+ return Reflect.construct(target, [now()], newTarget);
58
+ return Reflect.construct(target, zone ? zone.args(args) : args, newTarget);
59
+ },
60
+ apply(target, thisArg, args) {
61
+ if (!shared.clock && !zone?.on())
62
+ return Reflect.apply(target, thisArg, args);
63
+ return String(new NativeDate(now()));
64
+ },
65
+ get(target, key, receiver) {
66
+ if (key === "now")
67
+ return now;
68
+ if (key === "parse" && zone)
69
+ return zone.parse;
70
+ return Reflect.get(target, key, receiver);
71
+ }
72
+ });
73
+ }
74
+ var READERS = {
75
+ instant: (instant) => instant,
76
+ zonedDateTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone),
77
+ plainDateTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainDateTime(),
78
+ plainDateISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainDate(),
79
+ plainTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainTime()
80
+ };
81
+ var NOW_READERS = Object.keys(READERS);
82
+ function temporalNow() {
83
+ return globalThis.Temporal?.Now;
84
+ }
85
+ function readNow(key, original, zoneOf) {
86
+ return function(timeZone) {
87
+ const zone = zoneOf(timeZone);
88
+ const temporal = globalThis.Temporal;
89
+ if (!shared.clock || !temporal?.Instant)
90
+ return original.call(this, zone);
91
+ const instant = temporal.Instant.fromEpochMilliseconds(now());
92
+ const timeZoneId = temporal.Now?.timeZoneId;
93
+ const host = typeof timeZoneId === "function" ? timeZoneId.call(temporal.Now) : undefined;
94
+ return READERS[key](instant, zone ?? host);
95
+ };
96
+ }
97
+ var EARLY = Symbol.for("devknobs.early.clock");
98
+ function takeOver() {
99
+ const scope = globalThis;
100
+ const patches = scope[EARLY];
101
+ scope[EARLY] = null;
102
+ patches?.release();
103
+ }
23
104
 
24
105
  // src/engine/devices.ts
25
106
  var POSTURES = ["closed", "open"];
@@ -407,108 +488,6 @@ function stamped(value, v) {
407
488
  return { v, ...value };
408
489
  }
409
490
 
410
- // src/engine/clock.ts
411
- var HOUR = 3600000;
412
- var DAY = 86400000;
413
- var CLOCK_SPEED_MIN = 0.001;
414
- var CLOCK_SPEED_MAX = 1e6;
415
- var CLOCK_PRESETS = [
416
- { label: "+1h", ms: HOUR },
417
- { label: "+1d", ms: DAY },
418
- { label: "+2d", ms: 2 * DAY },
419
- { label: "+1w", ms: 7 * DAY },
420
- { label: "+30d", ms: 30 * DAY }
421
- ];
422
- var SHARED = Symbol.for("devknobs.clock");
423
- var shared = globalThis[SHARED] ??= {
424
- Date,
425
- clock: null
426
- };
427
- var NativeDate = shared.Date;
428
- function realNow() {
429
- return NativeDate.now();
430
- }
431
- function virtualNow(clock, real) {
432
- if (clock.mode === "frozen")
433
- return clock.at;
434
- if (clock.mode === "offset")
435
- return Math.floor(clock.at + (real - clock.since) * clock.speed);
436
- return real;
437
- }
438
- function mergeClock(clock, patch, real = realNow()) {
439
- if (!patch)
440
- return clock;
441
- const next = { ...clock, ...patch };
442
- if (patch.since !== undefined && patch.since !== clock.since)
443
- return next;
444
- if (patch.at !== undefined && patch.since === undefined)
445
- return { ...next, since: real };
446
- const moved = (key) => patch[key] !== undefined && patch[key] !== clock[key];
447
- if (moved("mode") || moved("speed"))
448
- return { ...next, at: virtualNow(clock, real), since: real };
449
- return next;
450
- }
451
- function setClock(value) {
452
- shared.clock = value && value.mode !== "system" ? { ...value } : null;
453
- }
454
- function clockOn() {
455
- return shared.clock !== null;
456
- }
457
- function now() {
458
- return shared.clock ? virtualNow(shared.clock, realNow()) : realNow();
459
- }
460
- function wrapDate(original, zone) {
461
- return new Proxy(original, {
462
- construct(target, args, newTarget) {
463
- if (args.length === 0 && shared.clock)
464
- return Reflect.construct(target, [now()], newTarget);
465
- return Reflect.construct(target, zone ? zone.args(args) : args, newTarget);
466
- },
467
- apply(target, thisArg, args) {
468
- if (!shared.clock && !zone?.on())
469
- return Reflect.apply(target, thisArg, args);
470
- return String(new NativeDate(now()));
471
- },
472
- get(target, key, receiver) {
473
- if (key === "now")
474
- return now;
475
- if (key === "parse" && zone)
476
- return zone.parse;
477
- return Reflect.get(target, key, receiver);
478
- }
479
- });
480
- }
481
- var READERS = {
482
- instant: (instant) => instant,
483
- zonedDateTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone),
484
- plainDateTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainDateTime(),
485
- plainDateISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainDate(),
486
- plainTimeISO: (instant, zone) => instant.toZonedDateTimeISO(zone).toPlainTime()
487
- };
488
- var NOW_READERS = Object.keys(READERS);
489
- function temporalNow() {
490
- return globalThis.Temporal?.Now;
491
- }
492
- function readNow(key, original, zoneOf) {
493
- return function(timeZone) {
494
- const zone = zoneOf(timeZone);
495
- const temporal = globalThis.Temporal;
496
- if (!shared.clock || !temporal?.Instant)
497
- return original.call(this, zone);
498
- const instant = temporal.Instant.fromEpochMilliseconds(now());
499
- const timeZoneId = temporal.Now?.timeZoneId;
500
- const host = typeof timeZoneId === "function" ? timeZoneId.call(temporal.Now) : undefined;
501
- return READERS[key](instant, zone ?? host);
502
- };
503
- }
504
- var EARLY = Symbol.for("devknobs.early.clock");
505
- function takeOver() {
506
- const scope = globalThis;
507
- const patches = scope[EARLY];
508
- scope[EARLY] = null;
509
- patches?.release();
510
- }
511
-
512
491
  // src/grab/boxmodel.ts
513
492
  var RINGS = ["margin", "border", "padding", "content"];
514
493
  var SIDES = ["top", "right", "bottom", "left"];
@@ -1443,6 +1422,8 @@ var KEY_ACTIONS = [
1443
1422
  "requests",
1444
1423
  "reset",
1445
1424
  "storage",
1425
+ "elements",
1426
+ "settings",
1446
1427
  "search",
1447
1428
  "zoom-in",
1448
1429
  "zoom-out",
@@ -1713,174 +1694,6 @@ function ownReload() {
1713
1694
  } catch {}
1714
1695
  }
1715
1696
 
1716
- // src/engine/scrollkeep.ts
1717
- var SCROLL_KEY = "devknobs:scroll";
1718
- var SCROLL_VERSION = 1;
1719
- var SCROLL_WINDOW = 1e4;
1720
- var HOLD = 2000;
1721
- var HOLD_CAP = 1e4;
1722
- var PUT_BUDGET = 20;
1723
- var INPUTS = ["wheel", "touchstart", "keydown", "mousedown"];
1724
- function placeOf2(value) {
1725
- if (typeof value !== "object" || value === null)
1726
- return;
1727
- const path = Reflect.get(value, "path");
1728
- const x = Reflect.get(value, "x");
1729
- const y = Reflect.get(value, "y");
1730
- if (typeof path !== "string" || typeof x !== "number" || typeof y !== "number")
1731
- return;
1732
- return Number.isFinite(x) && Number.isFinite(y) ? { path, x, y } : undefined;
1733
- }
1734
- function parseKept(text2) {
1735
- if (!text2)
1736
- return null;
1737
- let raw;
1738
- try {
1739
- raw = JSON.parse(text2);
1740
- } catch {
1741
- return null;
1742
- }
1743
- if (typeof raw !== "object" || raw === null || newer(raw, SCROLL_VERSION))
1744
- return null;
1745
- const at = Reflect.get(raw, "at");
1746
- if (typeof at !== "number")
1747
- return null;
1748
- const kept = { at };
1749
- const page = placeOf2(Reflect.get(raw, "page"));
1750
- const frame = placeOf2(Reflect.get(raw, "frame"));
1751
- if (page)
1752
- kept.page = page;
1753
- if (frame)
1754
- kept.frame = frame;
1755
- return kept;
1756
- }
1757
- function stale(at, now2) {
1758
- const age = now2 - at;
1759
- return !(age >= 0 && age < SCROLL_WINDOW);
1760
- }
1761
- function keptWith(kept, role, place, now2) {
1762
- const next = { at: now2 };
1763
- const other = role === "page" ? "frame" : "page";
1764
- const rest = kept && !stale(kept.at, now2) ? kept[other] : undefined;
1765
- if (rest)
1766
- next[other] = rest;
1767
- if (place && (place.x !== 0 || place.y !== 0))
1768
- next[role] = place;
1769
- return next.page || next.frame ? next : null;
1770
- }
1771
- function take(kept, role, path, now2) {
1772
- if (!kept || stale(kept.at, now2))
1773
- return { place: null, rest: null };
1774
- const own = kept[role];
1775
- const other = role === "page" ? "frame" : "page";
1776
- const left = kept[other];
1777
- const rest = left ? { at: kept.at, [other]: left } : null;
1778
- if (!own || own.path !== path)
1779
- return { place: null, rest };
1780
- return { place: { x: own.x, y: own.y }, rest };
1781
- }
1782
- function next(holding, seen) {
1783
- const { target } = holding;
1784
- const there = Math.abs(seen.x - target.x) <= 1 && Math.abs(seen.y - target.y) <= 1;
1785
- const spent = holding.puts >= PUT_BUDGET;
1786
- const over = seen.now - holding.start >= HOLD_CAP || holding.loadedAt !== null && seen.now - holding.loadedAt >= HOLD;
1787
- if (over)
1788
- return there || spent ? "done" : "last";
1789
- if (spent)
1790
- return "done";
1791
- if (there)
1792
- return "wait";
1793
- return seen.maxX >= target.x - 1 && seen.maxY >= target.y - 1 ? "put" : "wait";
1794
- }
1795
- function hold2(view, target, now2 = realNow) {
1796
- const holding = { target, start: now2(), loadedAt: null, puts: 0 };
1797
- let over = false;
1798
- const end = () => {
1799
- over = true;
1800
- for (const type of INPUTS)
1801
- view.removeEventListener(type, end, true);
1802
- };
1803
- const frame = () => {
1804
- if (over)
1805
- return;
1806
- const time = now2();
1807
- if (holding.loadedAt === null && view.document.readyState === "complete")
1808
- holding.loadedAt = time;
1809
- const root = view.document.documentElement;
1810
- const move = next(holding, {
1811
- x: view.scrollX,
1812
- y: view.scrollY,
1813
- maxX: root ? root.scrollWidth - root.clientWidth : 0,
1814
- maxY: root ? root.scrollHeight - root.clientHeight : 0,
1815
- now: time
1816
- });
1817
- if (move === "put" || move === "last") {
1818
- holding.puts++;
1819
- view.scrollTo({ left: target.x, top: target.y, behavior: "instant" });
1820
- }
1821
- if (move === "last" || move === "done")
1822
- end();
1823
- else
1824
- view.requestAnimationFrame(frame);
1825
- };
1826
- for (const type of INPUTS)
1827
- view.addEventListener(type, end, true);
1828
- frame();
1829
- }
1830
- var framed2 = null;
1831
- function follow(view) {
1832
- framed2 = view;
1833
- }
1834
- function placeIn(view) {
1835
- try {
1836
- return view ? { path: view.location.pathname, x: view.scrollX, y: view.scrollY } : null;
1837
- } catch {
1838
- return null;
1839
- }
1840
- }
1841
- function keep(view, role) {
1842
- try {
1843
- const session = webStorage("session");
1844
- if (!session)
1845
- return;
1846
- const kept = keptWith(parseKept(session.getItem(SCROLL_KEY)), role, placeIn(view), realNow());
1847
- if (kept)
1848
- session.setItem(SCROLL_KEY, JSON.stringify(stamped(kept, SCROLL_VERSION)));
1849
- else
1850
- session.removeItem(SCROLL_KEY);
1851
- } catch {}
1852
- }
1853
- function keepOwn() {
1854
- if (isDevknobsFrame()) {
1855
- keep(window, "frame");
1856
- return;
1857
- }
1858
- keep(window, "page");
1859
- keep(framed2?.() ?? null, "frame");
1860
- }
1861
- function resume() {
1862
- if (typeof window === "undefined")
1863
- return;
1864
- let target = null;
1865
- try {
1866
- const session = webStorage("session");
1867
- const text2 = session?.getItem(SCROLL_KEY) ?? null;
1868
- if (!session || text2 === null)
1869
- return;
1870
- const role = isDevknobsFrame() ? "frame" : "page";
1871
- const { place, rest } = take(parseKept(text2), role, window.location.pathname, realNow());
1872
- if (rest)
1873
- session.setItem(SCROLL_KEY, JSON.stringify(stamped(rest, SCROLL_VERSION)));
1874
- else
1875
- session.removeItem(SCROLL_KEY);
1876
- target = place;
1877
- } catch {
1878
- return;
1879
- }
1880
- if (target)
1881
- hold2(window, target);
1882
- }
1883
-
1884
1697
  // src/engine/system.ts
1885
1698
  var current = null;
1886
1699
  var listeners = new Set;
@@ -1902,7 +1715,7 @@ function run(at, query, below) {
1902
1715
  for (let i = at;i < ORDER.length; i++) {
1903
1716
  const layer = layers.get(ORDER[i]);
1904
1717
  if (layer)
1905
- return layer(query, (next2) => run(i + 1, next2, below));
1718
+ return layer(query, (next) => run(i + 1, next, below));
1906
1719
  }
1907
1720
  return below.call(window, query);
1908
1721
  }
@@ -1942,1624 +1755,10 @@ function still() {
1942
1755
  return baseMatchMedia("(prefers-reduced-motion: reduce)").matches;
1943
1756
  }
1944
1757
 
1945
- // src/engine/mockdata.ts
1946
- function sides2(top, right, bottom, left) {
1947
- return { top, right, bottom, left };
1948
- }
1949
- function pill(kind, x, y, width, height) {
1950
- return { kind, x, y, width, height };
1951
- }
1952
- function dot(kind, x, y, size) {
1953
- return { kind, x: x - size / 2, y: y - size / 2, width: size, height: size };
1954
- }
1955
- var left = (at, length) => ({ side: "left", at, length });
1956
- var right = (at, length, out) => ({
1957
- side: "right",
1958
- at,
1959
- length,
1960
- out
1961
- });
1962
- var top = (at, length, out) => ({
1963
- side: "top",
1964
- at,
1965
- length,
1966
- out
1967
- });
1968
- var IPHONE_LEFT = [left(185, 41.7), left(257.4, 67.6), left(343.2, 67.6)];
1969
- function iphoneRight(control) {
1970
- return [right(280.7, 106.9), right(control, 103.3, 1)];
1971
- }
1972
- var BODIES = {
1973
- "iphone-18-pro": {
1974
- bezel: sides2(15.7, 15.7, 15.7, 15.7),
1975
- screenRadius: 62,
1976
- bodyRadius: 77.7,
1977
- out: 3,
1978
- front: [pill("sensor", 154, 14.3, 94, 36.1)],
1979
- buttons: [left(186, 41.7), left(258.3, 67.7), left(344, 68), right(281.7, 107, 2.7)]
1980
- },
1981
- "iphone-18-pro-max": {
1982
- bezel: sides2(15.3, 15.3, 15.3, 15.3),
1983
- screenRadius: 62,
1984
- bodyRadius: 77.3,
1985
- out: 2.7,
1986
- front: [pill("sensor", 173.2, 14.5, 93.6, 35.8)],
1987
- buttons: [left(186.3, 41.7), left(258.7, 67.7), left(344.3, 67.7), right(282, 106.7)]
1988
- },
1989
- "iphone-duo-closed": {
1990
- bezel: sides2(16.3, 16, 16, 25.7),
1991
- screenRadius: [8, 59, 59, 8],
1992
- bodyRadius: [10, 75, 75, 10],
1993
- out: 2.7,
1994
- front: [dot("sensor", 418.35, 47.75, 36.3)],
1995
- buttons: [right(202.7, 112.7), top(235, 65.7, 2.3), top(316, 65.7, 2.3)]
1996
- },
1997
- "iphone-duo-open": {
1998
- bezel: sides2(20.3, 20.7, 20.7, 20.7),
1999
- screenRadius: 55,
2000
- bodyRadius: 75.7,
2001
- out: 2.7,
2002
- front: [],
2003
- buttons: [left(134.3, 57), left(206.3, 65.7), top(202.3, 112.7)]
2004
- },
2005
- "iphone-air": {
2006
- bezel: sides2(15.3, 15.3, 15.3, 15.3),
2007
- screenRadius: 62,
2008
- bodyRadius: 77.3,
2009
- out: 2.7,
2010
- front: [pill("sensor", 147.33, 20, 125.33, 36.67)],
2011
- buttons: [left(185, 41.7), left(257.3, 67.7), left(343, 67.7), right(280.7, 106.7, 3)]
2012
- },
2013
- "iphone-17": {
2014
- bezel: sides2(14.7, 14.7, 14.7, 14.7),
2015
- screenRadius: 62,
2016
- bodyRadius: 76.7,
2017
- out: 3,
2018
- front: [pill("sensor", 138.33, 14, 125.33, 36.67)],
2019
- buttons: [left(185, 41.7), left(257.3, 67.7), left(342.7, 68), right(280.3, 107, 2.7)]
2020
- },
2021
- "iphone-17-pro": {
2022
- bezel: sides2(15.7, 15.7, 15.7, 15.7),
2023
- screenRadius: 62,
2024
- bodyRadius: 77.7,
2025
- out: 3,
2026
- front: [pill("sensor", 138.33, 14, 125.33, 36.67)],
2027
- buttons: [left(186, 41.7), left(258.3, 67.7), left(344, 67.7), right(281.7, 107, 2.7)]
2028
- },
2029
- "iphone-17-pro-max": {
2030
- bezel: sides2(15.3, 15.3, 15.3, 15.3),
2031
- screenRadius: 62,
2032
- bodyRadius: 77.3,
2033
- out: 2.7,
2034
- front: [pill("sensor", 157.33, 14, 125.33, 36.67)],
2035
- buttons: [left(186.3, 41.7), left(258.7, 67.7), left(344.3, 67.7), right(282, 106.7)]
2036
- },
2037
- "iphone-16": {
2038
- bezel: sides2(19.7, 19.7, 19.7, 19.7),
2039
- screenRadius: 55.8,
2040
- bodyRadius: 75.5,
2041
- out: 2.7,
2042
- front: [pill("sensor", 134, 11.3, 124.9, 36.7)],
2043
- buttons: [...IPHONE_LEFT, ...iphoneRight(529.5)]
2044
- },
2045
- "iphone-16-plus": {
2046
- bezel: sides2(19.7, 19.7, 19.7, 19.7),
2047
- screenRadius: 55.8,
2048
- bodyRadius: 75.5,
2049
- out: 2.7,
2050
- front: [pill("sensor", 152.3, 11.3, 125.4, 36.7)],
2051
- buttons: [...IPHONE_LEFT, ...iphoneRight(608.5)]
2052
- },
2053
- "iphone-16-pro": {
2054
- bezel: sides2(14.7, 14.7, 14.7, 14.7),
2055
- screenRadius: 63.2,
2056
- bodyRadius: 77.9,
2057
- out: 2.7,
2058
- front: [pill("sensor", 138.33, 14, 125.33, 36.67)],
2059
- buttons: [...IPHONE_LEFT, ...iphoneRight(541.3)]
2060
- },
2061
- "iphone-16-pro-max": {
2062
- bezel: sides2(14.3, 14.3, 14.3, 14.3),
2063
- screenRadius: 63.6,
2064
- bodyRadius: 77.9,
2065
- out: 2.7,
2066
- front: [pill("sensor", 157.3, 14, 125.4, 36.7)],
2067
- buttons: [...IPHONE_LEFT, ...iphoneRight(622.4)]
2068
- },
2069
- "iphone-se": {
2070
- bezel: sides2(110.2, 28.1, 110.3, 28.1),
2071
- screenRadius: 0,
2072
- bodyRadius: 65.6,
2073
- out: 2.6,
2074
- front: [
2075
- pill("slot", 149.5, -55.4, 76.1, 7.7),
2076
- dot("lens", 119.3, -51.5, 14),
2077
- { ...dot("home", 187.5, 718, 69.9), key: 60 }
2078
- ],
2079
- buttons: [left(94.6, 36), left(187.5, 68.1), left(268.3, 68.1), right(188, 68.1)]
2080
- },
2081
- "pixel-10": {
2082
- bezel: sides2(21, 22.1, 21.4, 22.5),
2083
- screenRadius: 55,
2084
- bodyRadius: 77,
2085
- out: 3.1,
2086
- front: [dot("sensor", 205.6, 33.9, 29.7)],
2087
- buttons: [right(269.6, 77), right(389.3, 134.2)]
2088
- },
2089
- "pixel-10-pro": {
2090
- bezel: sides2(20, 20.7, 17.3, 19.7),
2091
- screenRadius: 59,
2092
- bodyRadius: 79,
2093
- out: 3,
2094
- front: [dot("sensor", 213.6, 34.3, 30.6)],
2095
- buttons: [right(276.4, 78.4), right(399.1, 137)]
2096
- },
2097
- "pixel-10-pro-xl": {
2098
- bezel: sides2(18.3, 20.3, 18, 20),
2099
- screenRadius: 52,
2100
- bodyRadius: 71,
2101
- out: 2.3,
2102
- front: [dot("sensor", 224, 34.8, 30.2)],
2103
- buttons: [right(280.5, 77), right(401.2, 134.4)]
2104
- },
2105
- "pixel-10a": {
2106
- bezel: sides2(24, 24.8, 24, 24.8),
2107
- screenRadius: 55,
2108
- bodyRadius: 79,
2109
- out: 3.1,
2110
- front: [dot("sensor", 205.2, 33.3, 30.5)],
2111
- buttons: [right(273, 75.9), right(393.1, 132.7)]
2112
- },
2113
- "pixel-9": {
2114
- bezel: sides2(21.9, 22.2, 21.9, 22.2),
2115
- screenRadius: 55,
2116
- bodyRadius: 77,
2117
- out: 2.5,
2118
- front: [dot("sensor", 205.5, 33, 32)],
2119
- buttons: [right(290, 70), right(385, 135)]
2120
- },
2121
- "pixel-9-pro": {
2122
- bezel: sides2(20.3, 20.3, 19, 20),
2123
- screenRadius: 58,
2124
- bodyRadius: 78,
2125
- out: 2.3,
2126
- front: [dot("sensor", 213.4, 33.7, 30.9)],
2127
- buttons: [right(269.7, 77.7), right(392.1, 142.7)]
2128
- },
2129
- "pixel-9-pro-xl": {
2130
- bezel: sides2(18.7, 19.3, 17.3, 19),
2131
- screenRadius: 57,
2132
- bodyRadius: 76,
2133
- out: 2.3,
2134
- front: [dot("sensor", 224, 32.8, 30.8)],
2135
- buttons: [right(274.1, 75.7), right(393.8, 139.4)]
2136
- },
2137
- "ipad-mini": {
2138
- bezel: sides2(60.6, 60.4, 60.6, 60.4),
2139
- screenRadius: 21.5,
2140
- bodyRadius: 77,
2141
- out: 2.5,
2142
- front: [dot("lens", 372, -35, 16)],
2143
- buttons: [top(82.3, 64.6), top(159.7, 64.6), top(673.5, 109.9)]
2144
- },
2145
- "ipad-air-11": {
2146
- bezel: sides2(53.5, 53.9, 53.5, 53.9),
2147
- screenRadius: 18,
2148
- bodyRadius: 66.5,
2149
- out: 2.5,
2150
- front: [dot("lens", 850.5, 540.6, 16)],
2151
- buttons: [top(772.9, 89), right(75.1, 52.3), right(137.8, 52.3)]
2152
- },
2153
- "ipad-pro-13": {
2154
- bezel: sides2(43.7, 44, 43.7, 44),
2155
- screenRadius: 30,
2156
- bodyRadius: 74.8,
2157
- out: 2.5,
2158
- front: [dot("lens", 1051.6, 688, 13.9)],
2159
- buttons: [top(984.7, 62.7), right(74.3, 52.3), right(137, 52.3)]
2160
- }
2161
- };
2162
-
2163
- // src/engine/browserui.ts
2164
- var LAYOUTS = {
2165
- safari: ["compact", "bottom", "top", "off"],
2166
- chrome: ["top", "bottom", "off"]
2167
- };
2168
- var DUO_COVER = {
2169
- column: 84,
2170
- bottom: 98,
2171
- minimized: 60,
2172
- axis: 48,
2173
- time: { y: 91.5, size: 15.75 },
2174
- ring: { y: 129.9, radius: 18.9, stroke: 3.5 },
2175
- buttons: [174.2, 234.2],
2176
- capsule: 102,
2177
- gap: 34,
2178
- inset: 24,
2179
- across: {
2180
- top: 80,
2181
- minimized: 26,
2182
- side: 7.33,
2183
- address: { x: 209, width: 260 },
2184
- end: 149.33
2185
- }
2186
- };
2187
- var DUO_INNER = {
2188
- top: 80,
2189
- minimized: 51,
2190
- axis: 47.67,
2191
- time: { x: 99.83, y: 47.4, size: 15.75 },
2192
- ring: { y: 47.9, radius: 18.9, stroke: 3.5 },
2193
- side: 6,
2194
- address: { landscape: { x: 295, width: 361 }, portrait: { x: 184, width: 241.5 } },
2195
- end: 232,
2196
- pill: 23.5
2197
- };
2198
- var DUO_ROW = 26;
2199
- var DUO_PILL = { height: 20, size: 12, pad: 15 };
2200
- function runsUnderBars(id) {
2201
- return !SAFARI[id]?.duo;
2202
- }
2203
- var DUO_LAYOUTS = ["compact", "off"];
2204
- var STATUS_PRO = { time: 73.83, right: 369.67 };
2205
- var STATUS_MAX = { time: 83.17, right: 401.67 };
2206
- var SAFARI = {
2207
- "iphone-18-pro": { top: 62, side: 62, faceId: true },
2208
- "iphone-18-pro-max": { top: 62, side: 62, faceId: true },
2209
- "iphone-duo-closed": { top: 0, side: 0, faceId: true, duo: "cover" },
2210
- "iphone-duo-open": { top: DUO_INNER.top, side: 0, faceId: true, duo: "inner" },
2211
- "iphone-air": { top: 68, side: 68, faceId: true, status: { time: 77.17, right: 387.67 } },
2212
- "iphone-17": { top: 62, side: 62, faceId: true, status: STATUS_PRO },
2213
- "iphone-17-pro": { top: 62, side: 62, faceId: true, status: STATUS_PRO },
2214
- "iphone-17-pro-max": { top: 62, side: 62, faceId: true, status: STATUS_MAX },
2215
- "iphone-16": { top: 59, side: 59, faceId: true },
2216
- "iphone-16-plus": { top: 59, side: 59, faceId: true },
2217
- "iphone-16-pro": { top: 62, side: 62, faceId: true, status: STATUS_PRO },
2218
- "iphone-16-pro-max": { top: 62, side: 62, faceId: true, status: STATUS_MAX },
2219
- "iphone-se": { top: 20, side: 0, faceId: false }
2220
- };
2221
- var CHROME = {
2222
- "pixel-10": { top: 69, tall: 923 },
2223
- "pixel-10-pro": { top: 69 },
2224
- "pixel-10-pro-xl": { top: 70, tall: 997 },
2225
- "pixel-10a": { top: 68, tall: 923 },
2226
- "pixel-9": { top: 66, tall: 923 },
2227
- "pixel-9-pro": { top: 68 },
2228
- "pixel-9-pro-xl": { top: 66, tall: 997 }
2229
- };
2230
- var SAFARI_BARS = {
2231
- compact: 98,
2232
- bottom: 158,
2233
- bottomSe: 152,
2234
- topBar: 60,
2235
- topBottom: 92,
2236
- pill: 58,
2237
- topPill: 44,
2238
- landscape: 64
2239
- };
2240
- var CHROME_BARS = { toolbar: 56, chin: 24, landscapeTop: 24 };
2241
- function platformOf(id) {
2242
- if (SAFARI[id])
2243
- return "safari";
2244
- if (CHROME[id])
2245
- return "chrome";
2246
- return null;
2247
- }
2248
- function layoutOptions(id) {
2249
- if (SAFARI[id]?.duo)
2250
- return DUO_LAYOUTS;
2251
- const platform = platformOf(id);
2252
- return platform ? LAYOUTS[platform] : [];
2253
- }
2254
- function layoutOf(id, browser) {
2255
- const options = layoutOptions(id);
2256
- const fallback = options[0];
2257
- if (!fallback)
2258
- return null;
2259
- return browser !== "auto" && options.includes(browser) ? browser : fallback;
2260
- }
2261
- function rect(x, y, width, height) {
2262
- return { x, y, width, height };
2263
- }
2264
- function viewportOf(device, orientation, layout, minimized, edge = false) {
2265
- const { width: W, height: H } = turn(device, orientation);
2266
- const whole = rect(0, 0, W, H);
2267
- if (!layout || layout === "off")
2268
- return whole;
2269
- const safari = SAFARI[device.id];
2270
- if (safari?.duo === "cover" && orientation === "landscape") {
2271
- const { across } = DUO_COVER;
2272
- const top2 = minimized ? across.minimized : across.top;
2273
- return rect(0, top2, W, H - top2);
2274
- }
2275
- if (safari?.duo === "cover") {
2276
- const bottom = minimized ? DUO_COVER.minimized : DUO_COVER.bottom;
2277
- return rect(0, 0, W - DUO_COVER.column, H - bottom);
2278
- }
2279
- if (safari?.duo === "inner") {
2280
- const top2 = minimized ? DUO_INNER.minimized : DUO_INNER.top;
2281
- return rect(0, top2, W, H - top2);
2282
- }
2283
- if (safari) {
2284
- if (edge && orientation === "landscape")
2285
- return rect(safari.side, 0, W - 2 * safari.side, H);
2286
- if (orientation === "landscape") {
2287
- const top2 = minimized ? 0 : SAFARI_BARS.landscape;
2288
- return rect(safari.side, top2, W - 2 * safari.side, H - top2);
2289
- }
2290
- const T = safari.top;
2291
- if (layout === "top") {
2292
- const top2 = T + (minimized ? SAFARI_BARS.topPill : SAFARI_BARS.topBar);
2293
- const bottom = minimized ? H : H - SAFARI_BARS.topBottom;
2294
- return rect(0, top2, W, bottom - top2);
2295
- }
2296
- const card = safari.faceId ? SAFARI_BARS.bottom : SAFARI_BARS.bottomSe;
2297
- const bar = minimized ? SAFARI_BARS.pill : layout === "bottom" ? card : SAFARI_BARS.compact;
2298
- return rect(0, T, W, H - bar - T);
2299
- }
2300
- const chrome = CHROME[device.id];
2301
- if (!chrome)
2302
- return whole;
2303
- const toolbar = minimized ? 0 : CHROME_BARS.toolbar;
2304
- if (orientation === "landscape") {
2305
- const top2 = CHROME_BARS.landscapeTop + toolbar;
2306
- return rect(0, top2, W, H - top2);
2307
- }
2308
- const tall = chrome.tall ?? H;
2309
- const chin = minimized ? 0 : CHROME_BARS.chin;
2310
- const height = tall - chrome.top - toolbar - chin;
2311
- return rect(0, chrome.top + (layout === "top" ? toolbar : 0), W, height);
2312
- }
2313
- function capsule(kind, box, marks = []) {
2314
- return { kind, ...box, radius: Math.min(box.width, box.height) / 2, marks };
2315
- }
2316
- function mark(glyph, x, y) {
2317
- return { glyph, x, y };
2318
- }
2319
- var SCRIM = [
2320
- [0, 0.81],
2321
- [20, 0.67],
2322
- [40, 0.41],
2323
- [60, 0.16],
2324
- [80, 0.03],
2325
- [100, 0]
2326
- ];
2327
- function alphaAt(fade, y) {
2328
- const at = y - fade.y;
2329
- const { stops } = fade;
2330
- const first = stops[0];
2331
- if (!first || at <= first.at)
2332
- return first?.alpha ?? 0;
2333
- for (let i = 1;i < stops.length; i++) {
2334
- const from = stops[i - 1];
2335
- const to = stops[i];
2336
- if (!from || !to || at > to.at)
2337
- continue;
2338
- return from.alpha + (to.alpha - from.alpha) * (at - from.at) / (to.at - from.at || 1);
2339
- }
2340
- return stops.at(-1)?.alpha ?? 0;
2341
- }
2342
- function sensorMiddle(id) {
2343
- const sensor = BODIES[id]?.front.find((front) => front.kind === "sensor");
2344
- if (!sensor)
2345
- return null;
2346
- return { x: sensor.x + sensor.width / 2, y: sensor.y + sensor.height / 2, width: sensor.width };
2347
- }
2348
- var SAFARI_TEXT = { field: 17, pill: 13 };
2349
- var SAFARI_PILL = { height: 32, size: SAFARI_TEXT.pill, pad: 33 };
2350
- var BOTTOM_ROW = [0.1032, 0.3056, 0.4965, 0.6925, 0.8872];
2351
- var TOP_ROW = [0.0884, 0.2986, 0.4962, 0.6994, 0.9012];
2352
- var ROW = ["back", "forward", "share", "bookmarks", "tabs"];
2353
- function domainPill(x, top2, look = SAFARI_PILL) {
2354
- const { height, size, pad } = look;
2355
- return {
2356
- kind: "pill",
2357
- x,
2358
- y: top2,
2359
- width: 0,
2360
- height,
2361
- radius: height / 2,
2362
- marks: [],
2363
- text: { x, y: top2 + height / 2, size, pad }
2364
- };
2365
- }
2366
- function address(kind, box, page, reload) {
2367
- const y = box.y + box.height / 2;
2368
- return {
2369
- ...capsule(kind, box, [
2370
- mark("page", box.x + page, y),
2371
- mark("reload", box.x + box.width - reload, y)
2372
- ]),
2373
- text: { x: box.x + box.width / 2, y, size: SAFARI_TEXT.field }
2374
- };
2375
- }
2376
- function acrossRow(left2, right2, y) {
2377
- const s = left2;
2378
- const row = (x2, width2) => rect(x2, y, width2, 44);
2379
- const end = row(right2 - 10 - 132, 132);
2380
- const middle = y + 22;
2381
- const [from, to] = [s + 66 + 44 + 8, end.x - 8];
2382
- const width = Math.min(318, to - from);
2383
- const x = Math.min(Math.max((left2 + right2) / 2 - width / 2, from), to - width);
2384
- return [
2385
- capsule("glass", row(s + 10, 44), [mark("back", s + 32, middle)]),
2386
- capsule("glass", row(s + 66, 44), [mark("bookmarks", s + 88, middle)]),
2387
- address("glass", row(x, width), 24, 22),
2388
- capsule("glass", end, [
2389
- mark("share", end.x + 22, middle),
2390
- mark("plus", end.x + 66, middle),
2391
- mark("tabs", end.x + 110, middle)
2392
- ])
2393
- ];
2394
- }
2395
- function duoRow(side, field, endX, end) {
2396
- const y = DUO_ROW;
2397
- const middle = y + 22;
2398
- const row = (x, width) => rect(x, y, width, 44);
2399
- return [
2400
- capsule("glass", row(side + 10, 44), [mark("back", side + 32, middle)]),
2401
- capsule("glass", row(side + 66, 44), [mark("bookmarks", side + 88, middle)]),
2402
- address("glass", row(field.x, field.width), 22, 24.5),
2403
- capsule("glass", row(endX, 44 * end.length), end.map((glyph, at) => mark(glyph, endX + 22 + 44 * at, middle)))
2404
- ];
2405
- }
2406
- function duoCover(bars, W, H, orientation, minimized) {
2407
- const c = DUO_COVER;
2408
- if (orientation === "landscape") {
2409
- const { across } = c;
2410
- if (minimized)
2411
- bars.shapes = [domainPill(W / 2, (across.minimized - DUO_PILL.height) / 2, DUO_PILL)];
2412
- else
2413
- bars.shapes = duoRow(across.side, across.address, W - across.end, ["share", "plus", "tabs"]);
2414
- return bars;
2415
- }
2416
- const page = W - c.column;
2417
- const x = W - c.axis;
2418
- bars.column = { x, strip: false, time: { x, ...c.time }, ring: { ...c.ring } };
2419
- if (minimized) {
2420
- bars.shapes = [domainPill(page / 2, H - 46)];
2421
- return bars;
2422
- }
2423
- const button = (y, glyph) => capsule("glass", rect(x - 24, y, 48, 48), [mark(glyph, x, y + 24)]);
2424
- const [back = 0, reader = 0] = c.buttons;
2425
- const low = H - c.gap - c.capsule;
2426
- bars.shapes = [
2427
- address("glass", rect(c.inset, H - c.gap - 48, page - 2 * c.inset, 48), 24, 24),
2428
- button(back, "back"),
2429
- button(reader, "bookmarks"),
2430
- capsule("glass", rect(x - 24, low, 48, c.capsule), [mark("plus", x, low + 24), mark("tabs", x, H - c.gap - 24)])
2431
- ];
2432
- return bars;
2433
- }
2434
- function duoInner(bars, W, orientation, minimized) {
2435
- const d = DUO_INNER;
2436
- if (minimized) {
2437
- bars.shapes = [domainPill(W / 2, d.pill, DUO_PILL)];
2438
- return bars;
2439
- }
2440
- bars.column = { x: W - d.axis, strip: true, time: { ...d.time, x: W - d.time.x }, ring: { ...d.ring } };
2441
- bars.shapes = duoRow(d.side, d.address[orientation], W - d.end, ["plus", "tabs"]);
2442
- return bars;
2443
- }
2444
- function safariBars(device, spec, orientation, layout, minimized) {
2445
- const { width: W, height: H } = turn(device, orientation);
2446
- const bars = {
2447
- platform: "safari",
2448
- layout,
2449
- screen: device,
2450
- orientation,
2451
- minimized,
2452
- status: null,
2453
- column: null,
2454
- shapes: [],
2455
- chin: null,
2456
- hairline: null,
2457
- scrim: null,
2458
- edge: false
2459
- };
2460
- if (spec.duo === "cover")
2461
- return duoCover(bars, W, H, orientation, minimized);
2462
- if (spec.duo === "inner")
2463
- return duoInner(bars, W, orientation, minimized);
2464
- if (orientation === "landscape") {
2465
- if (!minimized)
2466
- bars.shapes = acrossRow(spec.side, W - spec.side, 10);
2467
- return bars;
2468
- }
2469
- bars.status = safariStatus(device.id, spec, W);
2470
- const page = viewportOf(device, orientation, layout, minimized);
2471
- const T = spec.top;
2472
- if (minimized) {
2473
- bars.shapes = [domainPill(W / 2, layout === "top" ? T : H - 46)];
2474
- const stops = SCRIM.map(([at, alpha]) => ({ at, alpha }));
2475
- bars.scrim = { y: 0, height: 100, stops, at: { x: W / 2, y: page.y + 1 } };
2476
- return bars;
2477
- }
2478
- if (layout === "compact") {
2479
- const y = H - 82;
2480
- const middle = y + 24;
2481
- bars.shapes = [
2482
- capsule("glass", rect(34, y, 48, 48), [mark("back", 58, middle)]),
2483
- address("glass", rect(90, y, W - 180, 48), 24, 22),
2484
- capsule("glass", rect(W - 82, y, 48, 48), [mark("tabs", W - 58, middle)])
2485
- ];
2486
- return bars;
2487
- }
2488
- if (layout === "bottom") {
2489
- const inset2 = spec.faceId ? 14 : 8;
2490
- const card = rect(inset2, H - inset2 - 128, W - 2 * inset2, 128);
2491
- const field = rect(card.x + 22, card.y + 16, card.width - 44, 48);
2492
- const row2 = card.y + 92;
2493
- bars.shapes = [
2494
- {
2495
- kind: "card",
2496
- ...card,
2497
- radius: 40,
2498
- marks: ROW.map((glyph, at) => {
2499
- return mark(glyph, card.x + card.width * (BOTTOM_ROW[at] ?? 0), row2);
2500
- })
2501
- },
2502
- address("field", field, 18, 16)
2503
- ];
2504
- return bars;
2505
- }
2506
- const top2 = rect(16, T, W - 32, 44);
2507
- const bottom = rect(28, H - 76, W - 56, 48);
2508
- const row = bottom.y + 24;
2509
- bars.shapes = [
2510
- address("glass", top2, 23, 18),
2511
- capsule("glass", bottom, ROW.map((glyph, at) => mark(glyph, bottom.x + bottom.width * (TOP_ROW[at] ?? 0), row)))
2512
- ];
2513
- return bars;
2514
- }
2515
- function safariStatus(id, spec, W) {
2516
- const island = sensorMiddle(id);
2517
- if (!spec.faceId) {
2518
- return {
2519
- height: spec.top,
2520
- time: { x: W / 2, y: 10, size: 15 },
2521
- icons: { x: 6, y: 10, align: "start" },
2522
- battery: { x: W - 7, y: 10 },
2523
- large: false
2524
- };
2525
- }
2526
- const large = W >= 420;
2527
- const size = large ? 19 : 18;
2528
- if (!island) {
2529
- const y = spec.top / 2 + 2;
2530
- return {
2531
- height: spec.top,
2532
- time: { x: 58, y, size },
2533
- icons: { x: W - 36, y, align: "end" },
2534
- large
2535
- };
2536
- }
2537
- const left2 = island.x - island.width / 2;
2538
- if (left2 > W / 2) {
2539
- return {
2540
- height: spec.top,
2541
- time: { x: 52, y: island.y, size },
2542
- icons: { x: left2 - 12, y: island.y, align: "end" },
2543
- large
2544
- };
2545
- }
2546
- return {
2547
- height: spec.top,
2548
- time: { x: spec.status?.time ?? left2 * 0.535, y: island.y, size },
2549
- icons: { x: spec.status?.right ?? W - (large ? 38.33 : 32.33), y: island.y, align: "end" },
2550
- large
2551
- };
2552
- }
2553
- function chromeStatus(id, height, W, orientation) {
2554
- const hole = orientation === "portrait" ? sensorMiddle(id) : null;
2555
- const y = hole?.y ?? height / 2;
2556
- const side = orientation === "portrait" ? 26 : 56;
2557
- return {
2558
- height,
2559
- time: { x: side, y, size: 14 },
2560
- icons: { x: W - side, y, align: "end" },
2561
- large: false
2562
- };
2563
- }
2564
- function chromeBars(device, spec, orientation, layout, minimized) {
2565
- const { width: W, height: H } = turn(device, orientation);
2566
- const portrait = orientation === "portrait";
2567
- const statusHeight = portrait ? spec.top : CHROME_BARS.landscapeTop;
2568
- const page = viewportOf(device, orientation, layout, minimized);
2569
- const bars = {
2570
- platform: "chrome",
2571
- layout,
2572
- screen: device,
2573
- orientation,
2574
- minimized,
2575
- status: chromeStatus(device.id, statusHeight, W, orientation),
2576
- column: null,
2577
- shapes: [],
2578
- chin: null,
2579
- hairline: null,
2580
- scrim: null,
2581
- edge: false
2582
- };
2583
- if (minimized)
2584
- return bars;
2585
- const atTop = layout === "top" || !portrait;
2586
- const toolbarY = atTop ? statusHeight : page.y + page.height;
2587
- const toolbar = rect(0, toolbarY, W, CHROME_BARS.toolbar);
2588
- const under = toolbarY + CHROME_BARS.toolbar;
2589
- const chin = atTop ? page.y + page.height : under;
2590
- bars.chin = portrait ? rect(0, chin, W, H - chin) : null;
2591
- bars.hairline = rect(0, atTop ? under : toolbarY, W, 1);
2592
- const middle = toolbarY + CHROME_BARS.toolbar / 2;
2593
- const menu = W - 8 - 24;
2594
- const tabs = menu - 48;
2595
- const plus = tabs - 24 - 26;
2596
- const pillLeft = 48 + 4;
2597
- const pillRight = plus - 26 - 4;
2598
- const pill2 = rect(pillLeft, middle - 20, pillRight - pillLeft, 40);
2599
- bars.shapes = [
2600
- {
2601
- kind: "toolbar",
2602
- ...toolbar,
2603
- radius: 0,
2604
- marks: [
2605
- mark("home", 24, middle),
2606
- mark("plus", plus, middle),
2607
- mark("switcher", tabs, middle),
2608
- mark("menu", menu, middle)
2609
- ]
2610
- },
2611
- {
2612
- ...capsule("field", pill2, [mark("tune", pill2.x + 4 + 14, middle)]),
2613
- text: { x: pill2.x + 4 + 28 + 4, y: middle, size: 16 }
2614
- }
2615
- ];
2616
- return bars;
2617
- }
2618
- function barsOf(device, orientation, layout, minimized, edge = false) {
2619
- if (!layout || layout === "off")
2620
- return null;
2621
- const safari = SAFARI[device.id];
2622
- if (safari) {
2623
- const bars = safariBars(device, safari, orientation, layout, minimized);
2624
- const upright = orientation === "portrait" || safari.duo !== undefined;
2625
- return { ...bars, edge: edge || upright };
2626
- }
2627
- const chrome = CHROME[device.id];
2628
- if (chrome)
2629
- return chromeBars(device, chrome, orientation, layout, minimized);
2630
- return null;
2631
- }
2632
- var BARS_DOWN = 16;
2633
- var BARS_UP = 40;
2634
- var BARS_TOP = 1;
2635
- var BARS_LOCK = 450;
2636
- var BARS_START = { minimized: false, anchor: 0, y: 0, lockUntil: 0 };
2637
- function barsStep(state, event) {
2638
- if (event.type === "navigate")
2639
- return BARS_START;
2640
- if (event.type === "tap")
2641
- return { ...state, minimized: false, anchor: state.y };
2642
- if (event.type === "resize")
2643
- return { ...state, lockUntil: event.time + BARS_LOCK };
2644
- const { y, time } = event;
2645
- const room = event.room ?? 0;
2646
- const near = state.minimized && room > 0 && y - room <= BARS_TOP;
2647
- if (near)
2648
- return { ...state, minimized: false, y, anchor: y };
2649
- if (time < state.lockUntil)
2650
- return { ...state, y, anchor: y };
2651
- if (y <= BARS_TOP)
2652
- return { ...state, minimized: false, y, anchor: y };
2653
- if (state.minimized) {
2654
- const anchor2 = Math.max(state.anchor, y);
2655
- if (anchor2 - y >= BARS_UP)
2656
- return { ...state, minimized: false, y, anchor: y };
2657
- return { ...state, y, anchor: anchor2 };
2658
- }
2659
- const anchor = Math.min(state.anchor, y);
2660
- const left2 = room > 0 ? Math.min(y, event.rest ?? Infinity) : y;
2661
- const clear = left2 - 2 * room >= BARS_DOWN;
2662
- if (y - anchor >= BARS_DOWN && clear)
2663
- return { ...state, minimized: true, y, anchor: y };
2664
- return { ...state, y, anchor };
2665
- }
2666
-
2667
- // src/engine/ua.ts
2668
- var CHROME2 = "154.0.8037.98";
2669
- var EDGE = "154.0.4258.53";
2670
- var SAFARI2 = "27.0";
2671
- var FIREFOX = "157.0";
2672
- var GREASE = { brand: "Not/A)Brand", version: "24.0.0.0" };
2673
- var APPLE = "Apple Computer, Inc.";
2674
- var GOOGLE = "Google Inc.";
2675
- function major(version) {
2676
- return version.split(".")[0] ?? version;
2677
- }
2678
- function chromeAgent(system, mobile = false) {
2679
- const browser = `Chrome/${major(CHROME2)}.0.0.0 ${mobile ? "Mobile " : ""}Safari/537.36`;
2680
- return `Mozilla/5.0 (${system}) AppleWebKit/537.36 (KHTML, like Gecko) ${browser}`;
2681
- }
2682
- function chromium(own, hints) {
2683
- const full = [{ brand: "Chromium", version: CHROME2 }, GREASE, ...own ? [own] : []];
2684
- return {
2685
- brands: full.map(({ brand, version }) => ({ brand, version: major(version) })),
2686
- hints: { ...hints, fullVersionList: full, uaFullVersion: own?.version ?? CHROME2 }
2687
- };
2688
- }
2689
- var CHROME_BRAND = { brand: "Google Chrome", version: CHROME2 };
2690
- var DESKTOP = { model: "", bitness: "64" };
2691
- var WINDOWS = { ...DESKTOP, platformVersion: "19.0.0", architecture: "x86" };
2692
- var MAC_SAFARI = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${SAFARI2} Safari/605.1.15`;
2693
- var UA_PRESETS = [
2694
- {
2695
- id: "iphone-safari",
2696
- label: "iPhone Safari",
2697
- userAgent: `Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${SAFARI2} Mobile/15E148 Safari/604.1`,
2698
- platform: "iPhone",
2699
- vendor: APPLE,
2700
- mobile: true,
2701
- brands: [],
2702
- uaPlatform: "iOS",
2703
- maxTouchPoints: 5
2704
- },
2705
- {
2706
- id: "android-chrome",
2707
- label: "Android Chrome",
2708
- userAgent: chromeAgent("Linux; Android 10; K", true),
2709
- platform: "Linux armv81",
2710
- vendor: GOOGLE,
2711
- mobile: true,
2712
- uaPlatform: "Android",
2713
- maxTouchPoints: 5,
2714
- ...chromium(CHROME_BRAND, {
2715
- platformVersion: "16.0.0",
2716
- model: "Pixel 10",
2717
- architecture: "",
2718
- bitness: ""
2719
- })
2720
- },
2721
- {
2722
- id: "ipad-safari",
2723
- label: "iPad Safari",
2724
- userAgent: MAC_SAFARI,
2725
- platform: "MacIntel",
2726
- vendor: APPLE,
2727
- mobile: false,
2728
- brands: [],
2729
- uaPlatform: "iOS",
2730
- maxTouchPoints: 5
2731
- },
2732
- {
2733
- id: "mac-safari",
2734
- label: "Mac Safari",
2735
- userAgent: MAC_SAFARI,
2736
- platform: "MacIntel",
2737
- vendor: APPLE,
2738
- mobile: false,
2739
- brands: [],
2740
- uaPlatform: "macOS",
2741
- maxTouchPoints: 0
2742
- },
2743
- {
2744
- id: "mac-chrome",
2745
- label: "Mac Chrome",
2746
- userAgent: chromeAgent("Macintosh; Intel Mac OS X 10_15_7"),
2747
- platform: "MacIntel",
2748
- vendor: GOOGLE,
2749
- mobile: false,
2750
- uaPlatform: "macOS",
2751
- maxTouchPoints: 0,
2752
- ...chromium(CHROME_BRAND, { ...DESKTOP, platformVersion: "26.7.1", architecture: "arm" })
2753
- },
2754
- {
2755
- id: "windows-chrome",
2756
- label: "Windows Chrome",
2757
- userAgent: chromeAgent("Windows NT 10.0; Win64; x64"),
2758
- platform: "Win32",
2759
- vendor: GOOGLE,
2760
- mobile: false,
2761
- uaPlatform: "Windows",
2762
- maxTouchPoints: 0,
2763
- ...chromium(CHROME_BRAND, WINDOWS)
2764
- },
2765
- {
2766
- id: "windows-edge",
2767
- label: "Windows Edge",
2768
- userAgent: `${chromeAgent("Windows NT 10.0; Win64; x64")} Edg/${EDGE}`,
2769
- platform: "Win32",
2770
- vendor: GOOGLE,
2771
- mobile: false,
2772
- uaPlatform: "Windows",
2773
- maxTouchPoints: 0,
2774
- ...chromium({ brand: "Microsoft Edge", version: EDGE }, WINDOWS)
2775
- },
2776
- {
2777
- id: "linux-firefox",
2778
- label: "Linux Firefox",
2779
- userAgent: `Mozilla/5.0 (X11; Linux x86_64; rv:${FIREFOX}) Gecko/20100101 Firefox/${FIREFOX}`,
2780
- platform: "Linux x86_64",
2781
- vendor: "",
2782
- mobile: false,
2783
- brands: [],
2784
- uaPlatform: "Linux",
2785
- maxTouchPoints: 0,
2786
- appVersion: "5.0 (X11)"
2787
- },
2788
- {
2789
- id: "googlebot",
2790
- label: "Googlebot",
2791
- userAgent: `Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROME2} Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)`,
2792
- platform: "Linux armv81",
2793
- vendor: GOOGLE,
2794
- mobile: true,
2795
- uaPlatform: "Android",
2796
- maxTouchPoints: 1,
2797
- ...chromium(null, {
2798
- platformVersion: "6.0.1",
2799
- model: "Nexus 5X",
2800
- architecture: "",
2801
- bitness: ""
2802
- })
2803
- }
2804
- ];
2805
- function uaPreset(id) {
2806
- return UA_PRESETS.find((preset) => preset.id === id);
2807
- }
2808
- function userAgentOf(value) {
2809
- if (value.preset === "custom")
2810
- return value.custom.trim();
2811
- return uaPreset(value.preset)?.userAgent ?? "";
2812
- }
2813
- function appVersionOf(userAgent) {
2814
- return userAgent.replace(/^Mozilla\//, "");
2815
- }
2816
- var KEYS = [
2817
- "userAgent",
2818
- "appVersion",
2819
- "platform",
2820
- "vendor",
2821
- "maxTouchPoints",
2822
- "userAgentData"
2823
- ];
2824
- var SHARED2 = Symbol.for("devknobs.ua");
2825
- function isShared(value) {
2826
- return typeof value === "object" && value !== null && "originals" in value;
2827
- }
2828
- function sharedOf(scope) {
2829
- const had = Reflect.get(scope, SHARED2);
2830
- if (isShared(had))
2831
- return had;
2832
- const shared2 = { originals: null };
2833
- Reflect.set(scope, SHARED2, shared2);
2834
- return shared2;
2835
- }
2836
- function prototypeOf(scope) {
2837
- const navigator2 = Reflect.get(scope, "Navigator");
2838
- return typeof navigator2 === "function" ? navigator2.prototype : null;
2839
- }
2840
- function put(target, key, value) {
2841
- Object.defineProperty(target, key, { configurable: true, enumerable: true, get: () => value });
2842
- }
2843
- function restore(shared2, target, key) {
2844
- const descriptor = shared2.originals?.get(key);
2845
- if (descriptor)
2846
- Object.defineProperty(target, key, descriptor);
2847
- else
2848
- Reflect.deleteProperty(target, key);
2849
- }
2850
- function copy(brands) {
2851
- return brands.map(({ brand, version }) => ({ brand, version }));
2852
- }
2853
- var NO_HINTS = { brands: [], mobile: false, uaPlatform: "" };
2854
- function uaData(source, scope) {
2855
- const brands = Object.freeze(source.brands.map((brand) => Object.freeze({ ...brand })));
2856
- const low = () => ({ brands: copy(brands), mobile: source.mobile, platform: source.uaPlatform });
2857
- const hints = source.hints;
2858
- const high = () => ({
2859
- architecture: hints?.architecture ?? "",
2860
- bitness: hints?.bitness ?? "",
2861
- fullVersionList: copy(hints?.fullVersionList ?? []),
2862
- model: hints?.model ?? "",
2863
- platformVersion: hints?.platformVersion ?? "",
2864
- uaFullVersion: hints?.uaFullVersion ?? ""
2865
- });
2866
- const native = Reflect.get(scope, "NavigatorUAData");
2867
- const proto = typeof native === "function" ? native.prototype : Object.prototype;
2868
- return Object.create(proto, {
2869
- brands: { enumerable: true, get: () => brands },
2870
- mobile: { enumerable: true, get: () => source.mobile },
2871
- platform: { enumerable: true, get: () => source.uaPlatform },
2872
- getHighEntropyValues: {
2873
- value: (asked) => {
2874
- try {
2875
- const values = low();
2876
- const all = high();
2877
- for (const hint of Array.from(asked, String)) {
2878
- if (Object.hasOwn(all, hint))
2879
- values[hint] = all[hint];
2880
- }
2881
- return Promise.resolve(values);
2882
- } catch (error) {
2883
- return Promise.reject(error);
2884
- }
2885
- }
2886
- },
2887
- toJSON: { value: low }
2888
- });
2889
- }
2890
- function apply2(value, scope = globalThis) {
2891
- const target = prototypeOf(scope);
2892
- const preset = value.preset === "custom" ? undefined : uaPreset(value.preset);
2893
- const userAgent = userAgentOf(value);
2894
- if (!target || userAgent === "") {
2895
- reset2(scope);
2896
- return;
2897
- }
2898
- const shared2 = sharedOf(scope);
2899
- shared2.originals ??= new Map(KEYS.map((key) => [key, Object.getOwnPropertyDescriptor(target, key)]));
2900
- put(target, "userAgent", userAgent);
2901
- put(target, "appVersion", preset?.appVersion ?? appVersionOf(userAgent));
2902
- if (!preset) {
2903
- for (const key of ["platform", "vendor", "maxTouchPoints"]) {
2904
- restore(shared2, target, key);
2905
- }
2906
- if (shared2.originals.get("userAgentData")) {
2907
- put(target, "userAgentData", uaData(NO_HINTS, scope));
2908
- } else
2909
- restore(shared2, target, "userAgentData");
2910
- return;
2911
- }
2912
- put(target, "platform", preset.platform);
2913
- put(target, "vendor", preset.vendor);
2914
- put(target, "maxTouchPoints", preset.maxTouchPoints);
2915
- if (preset.brands.length > 0)
2916
- put(target, "userAgentData", uaData(preset, scope));
2917
- else
2918
- Reflect.deleteProperty(target, "userAgentData");
2919
- }
2920
- function realPlatform() {
2921
- const getter = sharedOf(globalThis).originals?.get("platform")?.get;
2922
- try {
2923
- return String(getter ? getter.call(navigator) : navigator.platform);
2924
- } catch {
2925
- return "";
2926
- }
2927
- }
2928
- function isMac() {
2929
- return /mac|iphone|ipad|ipod/i.test(realPlatform());
2930
- }
2931
- function reset2(scope = globalThis) {
2932
- const shared2 = sharedOf(scope);
2933
- const target = prototypeOf(scope);
2934
- if (!shared2.originals)
2935
- return;
2936
- if (target)
2937
- for (const key of KEYS)
2938
- restore(shared2, target, key);
2939
- shared2.originals = null;
2940
- }
2941
-
2942
- // src/engine/mock.ts
2943
- function islandOf(id) {
2944
- const sensor = BODIES[id]?.front.find((front) => front.kind === "sensor");
2945
- return sensor && sensor.width > sensor.height ? sensor : null;
2946
- }
2947
- function round(kind, rect2) {
2948
- return { kind, ...rect2, radius: Math.min(rect2.width, rect2.height) / 2 };
2949
- }
2950
- function bar(button, out, body) {
2951
- const { side, at, length } = button;
2952
- if (side === "top") {
2953
- const y = body.y - out;
2954
- return { kind: "button", x: body.x + at, y, width: length, height: 2 * out, radius: out };
2955
- }
2956
- const x = side === "left" ? body.x - out : body.x + body.width - out;
2957
- return { kind: "button", x, y: body.y + at, width: 2 * out, height: length, radius: out };
2958
- }
2959
- function keyOf(front) {
2960
- if (front.key === undefined)
2961
- return null;
2962
- const gap = (front.width - front.key) / 2;
2963
- return { x: front.x + gap, y: front.y + gap, width: front.key, height: front.key };
2964
- }
2965
- function turnRect(rect2, width, height, clockwise) {
2966
- const { x, y } = rect2;
2967
- const turned = { width: rect2.height, height: rect2.width };
2968
- return clockwise ? { ...rect2, ...turned, x: height - y - rect2.height, y: x } : { ...rect2, ...turned, x: y, y: width - x - rect2.width };
2969
- }
2970
- function turnSides(sides3, clockwise = false) {
2971
- return clockwise ? { top: sides3.left, right: sides3.top, bottom: sides3.right, left: sides3.bottom } : { top: sides3.right, right: sides3.bottom, bottom: sides3.left, left: sides3.top };
2972
- }
2973
- function turnRadius(radius, clockwise = false) {
2974
- if (typeof radius === "number")
2975
- return radius;
2976
- const [topLeft, topRight, bottomRight, bottomLeft] = radius;
2977
- return clockwise ? [bottomLeft, topLeft, topRight, bottomRight] : [topRight, bottomRight, bottomLeft, topLeft];
2978
- }
2979
- function placeIn2(mock, room) {
2980
- const dx = room.inset.left - mock.inset.left;
2981
- const dy = room.inset.top - mock.inset.top;
2982
- const move = (rect2) => ({ ...rect2, x: rect2.x + dx, y: rect2.y + dy });
2983
- const { width, height, inset: inset2 } = room;
2984
- return { ...mock, width, height, inset: inset2, body: move(mock.body), parts: mock.parts.map(move) };
2985
- }
2986
- function mockOf(id, orientation) {
2987
- const device = screenOf(id);
2988
- const shape = BODIES[id];
2989
- if (!device || !shape)
2990
- return null;
2991
- const { bezel, screenRadius, bodyRadius } = shape;
2992
- const out = (button) => button.out ?? shape.out;
2993
- const most = (side) => Math.max(0, ...shape.buttons.filter((button) => button.side === side).map(out));
2994
- const room = { top: most("top"), right: most("right"), left: most("left") };
2995
- const size = turn(device, "portrait");
2996
- const inset2 = {
2997
- top: bezel.top + room.top,
2998
- right: bezel.right + room.right,
2999
- bottom: bezel.bottom,
3000
- left: bezel.left + room.left
3001
- };
3002
- const width = size.width + inset2.left + inset2.right;
3003
- const height = size.height + inset2.top + inset2.bottom;
3004
- const body = {
3005
- x: room.left,
3006
- y: room.top,
3007
- width: size.width + bezel.left + bezel.right,
3008
- height: size.height + bezel.top + bezel.bottom
3009
- };
3010
- const at = ({ x, y, width: width2, height: height2 }) => {
3011
- return { x: inset2.left + x, y: inset2.top + y, width: width2, height: height2 };
3012
- };
3013
- const parts = [
3014
- ...shape.buttons.map((button) => bar(button, out(button), body)),
3015
- ...shape.front.flatMap((front) => {
3016
- const key = keyOf(front);
3017
- const shown = round(front.kind, at(front));
3018
- return key ? [shown, round("key", at(key))] : [shown];
3019
- })
3020
- ];
3021
- const upright = { width, height, inset: inset2, body, screenRadius, bodyRadius, parts };
3022
- if (orientation === "portrait")
3023
- return upright;
3024
- const clockwise = device.clockwise === true;
3025
- return {
3026
- ...upright,
3027
- width: height,
3028
- height: width,
3029
- inset: turnSides(inset2, clockwise),
3030
- body: turnRect(body, width, height, clockwise),
3031
- screenRadius: turnRadius(screenRadius, clockwise),
3032
- bodyRadius: turnRadius(bodyRadius, clockwise),
3033
- parts: upright.parts.map((part2) => turnRect(part2, width, height, clockwise))
3034
- };
3035
- }
3036
-
3037
- // src/engine/native.ts
3038
- var HAND_WAIT = 2000;
3039
- var SYSTEM_MEDIA = {
3040
- scheme: "system",
3041
- motion: "system",
3042
- contrast: "system",
3043
- transparency: "system"
3044
- };
3045
- function drawnAround(state) {
3046
- if (state.panel.docked || state.frame || state.vision !== "none" || state.zoom !== "fit")
3047
- return true;
3048
- const device = deviceOf(state.device);
3049
- if (!device)
3050
- return false;
3051
- if (device.postures)
3052
- return true;
3053
- const id = formId(state.device, state.posture);
3054
- if (state.mock && mockOf(id, state.orientation) !== null)
3055
- return true;
3056
- const layout = layoutOf(id, state.browser);
3057
- return layout !== null && layout !== "off";
3058
- }
3059
- function nativeViewport(state) {
3060
- if (!knobFrame(state) || drawnAround(state))
3061
- return null;
3062
- const device = deviceOf(state.device);
3063
- const touch = device?.touch === true;
3064
- return {
3065
- width: typeof state.width === "number" ? state.width : null,
3066
- height: typeof state.height === "number" ? state.height : null,
3067
- dpr: typeof state.dpr === "number" ? state.dpr : null,
3068
- mobile: device?.kind === "phone" || device?.kind === "tablet",
3069
- touch,
3070
- touchPointer: touch && state.touchPointer
3071
- };
3072
- }
3073
- function nativeUa(value) {
3074
- const preset = uaPreset(value.preset);
3075
- if (preset) {
3076
- const { userAgent: userAgent2, platform, mobile, brands, uaPlatform, hints } = preset;
3077
- return { userAgent: userAgent2, platform, mobile, brands, uaPlatform, ...hints ? { hints } : {} };
3078
- }
3079
- const userAgent = userAgentOf(value);
3080
- return userAgent === "" ? null : { userAgent, platform: "", mobile: false, brands: [], uaPlatform: "" };
3081
- }
3082
- function inPage(state, driver) {
3083
- if (!driver)
3084
- return state;
3085
- let next2 = state;
3086
- if (driver.text)
3087
- next2 = { ...next2, text: "system" };
3088
- if (driver.offline)
3089
- next2 = { ...next2, network: { ...next2.network, online: "system" } };
3090
- if (driver.media)
3091
- next2 = { ...next2, ...SYSTEM_MEDIA };
3092
- return next2;
3093
- }
3094
- function framing(state, driver) {
3095
- if (!driver?.viewport || !nativeViewport(state))
3096
- return state;
3097
- return { ...state, width: "full", height: "full", dpr: "system" };
3098
- }
3099
- var enabled = true;
3100
- function nativeEnabled() {
3101
- return enabled;
3102
- }
3103
- function enableNative(on) {
3104
- enabled = on;
3105
- }
3106
- var sent = new Map;
3107
- var pending = null;
3108
- function handing() {
3109
- return pending;
3110
- }
3111
- function hand(driver, part2, value) {
3112
- const call = driver[part2];
3113
- if (!call)
3114
- return;
3115
- const key = JSON.stringify(value);
3116
- if (sent.get(part2) === key)
3117
- return;
3118
- sent.set(part2, key);
3119
- const settled = settles(call(value))?.then(() => {
3120
- if (pending === settled)
3121
- pending = null;
3122
- });
3123
- if (settled)
3124
- pending = settled;
3125
- }
3126
- function settles(result) {
3127
- if (!(result instanceof Promise))
3128
- return null;
3129
- return Promise.race([
3130
- result.then(() => {}, () => {}),
3131
- new Promise((resolve) => setTimeout(resolve, HAND_WAIT))
3132
- ]);
3133
- }
3134
- function drive(driver, state) {
3135
- hand(driver, "text", state.text);
3136
- hand(driver, "offline", state.network.online === "offline");
3137
- const { scheme, motion, contrast: contrast2, transparency } = state;
3138
- hand(driver, "media", { scheme, motion, contrast: contrast2, transparency });
3139
- if (driver.viewport)
3140
- hand(driver, "viewport", nativeViewport(state));
3141
- driveUa(driver, state, driver.viewport !== undefined && nativeViewport(state) !== null);
3142
- }
3143
- function hostUa(state, sized) {
3144
- const brought = [deviceOf(state.device)?.ua, formOf(state.device, state.posture)?.ua];
3145
- if (sized || !brought.includes(state.ua.preset))
3146
- return nativeUa(state.ua);
3147
- const ua = state.panel.realPhone ? nativeUa(state.ua) : null;
3148
- return ua && { ...ua, frame: true };
3149
- }
3150
- function driveUa(driver, state, sized = false) {
3151
- if (driver.ua)
3152
- hand(driver, "ua", hostUa(state, sized));
3153
- }
3154
- function release(driver, ua = true) {
3155
- if (sent.size === 0)
3156
- return;
3157
- hand(driver, "text", "system");
3158
- hand(driver, "offline", false);
3159
- hand(driver, "media", SYSTEM_MEDIA);
3160
- hand(driver, "viewport", null);
3161
- if (ua)
3162
- hand(driver, "ua", null);
3163
- for (const part2 of Array.from(sent.keys()))
3164
- if (ua || part2 !== "ua")
3165
- sent.delete(part2);
3166
- }
3167
-
3168
- // src/engine/style.ts
3169
- var OWN = Symbol.for("devknobs.own");
3170
- var NAME = Symbol.for("devknobs.name");
3171
- var TEXT = Symbol.for("devknobs.text");
3172
- var wrapped = new WeakMap;
3173
- function isDocument(root) {
3174
- return root.nodeType === 9;
3175
- }
3176
- function documentOf(root) {
3177
- return isDocument(root) ? root : root.ownerDocument ?? document;
3178
- }
3179
- function constructable(root) {
3180
- const doc = isDocument(root) ? root : root.ownerDocument;
3181
- const Sheet = doc?.defaultView?.CSSStyleSheet;
3182
- if (typeof Sheet !== "function" || typeof Sheet.prototype.replaceSync !== "function")
3183
- return null;
3184
- return "adoptedStyleSheets" in root ? Sheet : null;
3185
- }
3186
- function styleNode(style) {
3187
- return "nodeType" in style ? style : null;
3188
- }
3189
- function isOwnSheet(sheet) {
3190
- return Reflect.get(sheet, OWN) === true;
3191
- }
3192
- function wrap(root, sheet) {
3193
- const had = wrapped.get(sheet);
3194
- if (had)
3195
- return had;
3196
- const style = {
3197
- get textContent() {
3198
- const text2 = Reflect.get(sheet, TEXT);
3199
- return typeof text2 === "string" ? text2 : "";
3200
- },
3201
- set textContent(value) {
3202
- Reflect.set(sheet, TEXT, value ?? "");
3203
- sheet.replaceSync(value ?? "");
3204
- },
3205
- sheet,
3206
- remove() {
3207
- root.adoptedStyleSheets = root.adoptedStyleSheets.filter((other) => other !== sheet);
3208
- }
3209
- };
3210
- wrapped.set(sheet, style);
3211
- return style;
3212
- }
3213
- function adopt(root, Sheet, name) {
3214
- const sheet = new Sheet;
3215
- Reflect.set(sheet, OWN, true);
3216
- if (name !== undefined)
3217
- Reflect.set(sheet, NAME, name);
3218
- root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
3219
- return wrap(root, sheet);
3220
- }
3221
- function addStyle(root, css) {
3222
- const Sheet = constructable(root);
3223
- if (Sheet) {
3224
- const style2 = adopt(root, Sheet);
3225
- style2.textContent = css;
3226
- return style2;
3227
- }
3228
- const style = documentOf(root).createElement("style");
3229
- style.textContent = css;
3230
- if (isDocument(root))
3231
- (root.head ?? root.documentElement).appendChild(style);
3232
- else
3233
- root.append(style);
3234
- return style;
3235
- }
3236
- function findStyle(name, doc = document) {
3237
- const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME) === name) : undefined;
3238
- return sheet ? wrap(doc, sheet) : doc.querySelector(`style[data-devknobs="${name}"]`);
3239
- }
3240
- function ensureStyle(name, doc = document) {
3241
- const existing = findStyle(name, doc);
3242
- if (existing)
3243
- return existing;
3244
- const Sheet = constructable(doc);
3245
- if (Sheet)
3246
- return adopt(doc, Sheet, name);
3247
- const style = doc.createElement("style");
3248
- style.setAttribute("data-devknobs", name);
3249
- (doc.head ?? doc.documentElement).appendChild(style);
3250
- return style;
3251
- }
3252
- function removeStyle(name, doc = document) {
3253
- findStyle(name, doc)?.remove();
3254
- }
3255
-
3256
- // src/engine/matcolors.ts
3257
- var MAT_COLORS2 = {
3258
- blue: {
3259
- srgb: ["rgb(20, 70, 152)", "rgb(12, 48, 114)", "rgb(7, 31, 80)"],
3260
- p3: [
3261
- "color(display-p3 0.1 0.27 0.61)",
3262
- "color(display-p3 0.06 0.19 0.46)",
3263
- "color(display-p3 0.035 0.12 0.32)"
3264
- ],
3265
- line: "rgb(170, 205, 255)"
3266
- },
3267
- green: {
3268
- srgb: ["rgb(26, 96, 71)", "rgb(14, 71, 51)", "rgb(8, 49, 35)"],
3269
- p3: [
3270
- "color(display-p3 0.159 0.377 0.279)",
3271
- "color(display-p3 0.102 0.277 0.2)",
3272
- "color(display-p3 0.065 0.194 0.136)"
3273
- ],
3274
- line: "rgb(160, 218, 191)"
3275
- },
3276
- magenta: {
3277
- srgb: ["rgb(123, 37, 88)", "rgb(90, 22, 63)", "rgb(62, 12, 42)"],
3278
- p3: [
3279
- "color(display-p3 0.462 0.14 0.342)",
3280
- "color(display-p3 0.34 0.081 0.246)",
3281
- "color(display-p3 0.234 0.043 0.165)"
3282
- ],
3283
- line: "rgb(238, 185, 211)"
3284
- },
3285
- purple: {
3286
- srgb: ["rgb(86, 56, 130)", "rgb(62, 38, 96)", "rgb(42, 24, 67)"],
3287
- p3: [
3288
- "color(display-p3 0.326 0.209 0.521)",
3289
- "color(display-p3 0.233 0.138 0.387)",
3290
- "color(display-p3 0.156 0.086 0.269)"
3291
- ],
3292
- line: "rgb(209, 193, 242)"
3293
- },
3294
- red: {
3295
- srgb: ["rgb(132, 36, 36)", "rgb(97, 21, 22)", "rgb(68, 11, 12)"],
3296
- p3: [
3297
- "color(display-p3 0.499 0.139 0.133)",
3298
- "color(display-p3 0.369 0.079 0.078)",
3299
- "color(display-p3 0.256 0.041 0.042)"
3300
- ],
3301
- line: "rgb(239, 188, 183)"
3302
- },
3303
- graphite: {
3304
- srgb: ["rgb(64, 68, 74)", "rgb(43, 46, 51)", "rgb(26, 28, 32)"],
3305
- p3: [
3306
- "color(display-p3 0.25 0.264 0.291)",
3307
- "color(display-p3 0.169 0.179 0.2)",
3308
- "color(display-p3 0.102 0.11 0.126)"
3309
- ],
3310
- line: "rgb(198, 203, 211)"
3311
- }
3312
- };
3313
- var MAT_COLOR_NAMES = [
3314
- "blue",
3315
- "green",
3316
- "magenta",
3317
- "purple",
3318
- "red",
3319
- "graphite"
3320
- ];
3321
- function matGradient(stops) {
3322
- return `radial-gradient(140% 100% at 50% 0%, ${stops[0]}, ${stops[1]} 60%, ${stops[2]})`;
3323
- }
3324
- function isMatName(value) {
3325
- return MAT_COLOR_NAMES.some((name) => name === value);
3326
- }
3327
- var SHADE = [1, 0.82, 0.64];
3328
- function rgb(color) {
3329
- return `rgb(${Math.round(color.red)}, ${Math.round(color.green)}, ${Math.round(color.blue)})`;
3330
- }
3331
- function shades(color) {
3332
- const shade = (share) => ({
3333
- red: color.red * share,
3334
- green: color.green * share,
3335
- blue: color.blue * share,
3336
- alpha: 1
3337
- });
3338
- return [shade(SHADE[0]), shade(SHADE[1]), shade(SHADE[2])];
3339
- }
3340
- function customColor(mat) {
3341
- return isCustomColor(mat) ? parseHex(mat) : null;
3342
- }
3343
- function matStops(mat) {
3344
- if (isMatName(mat))
3345
- return MAT_COLORS2[mat];
3346
- const color = customColor(mat);
3347
- if (!color)
3348
- return MAT_COLORS2.blue;
3349
- const [top2, middle, edge] = shades(color);
3350
- const stops = [rgb(top2), rgb(middle), rgb(edge)];
3351
- return { srgb: stops, p3: stops };
3352
- }
3353
- function matPaint(mat) {
3354
- if (isMatName(mat))
3355
- return MAT_COLORS2[mat];
3356
- const color = customColor(mat);
3357
- return color ? { ...matStops(mat), line: rgb(inkOn(color, shades(color))) } : MAT_COLORS2.blue;
3358
- }
3359
- var MAT_VARIABLES = ["--mat", "--mat-p3", "--mat-line"];
3360
- function putMat(node, mat) {
3361
- if (mat === null)
3362
- node.removeAttribute("data-mat");
3363
- else
3364
- node.setAttribute("data-mat", mat);
3365
- if (mat === null || isMatName(mat)) {
3366
- for (const name of MAT_VARIABLES)
3367
- node.style.removeProperty(name);
3368
- return;
3369
- }
3370
- const paint = matPaint(mat);
3371
- node.style.setProperty("--mat", matGradient(paint.srgb));
3372
- node.style.setProperty("--mat-p3", matGradient(paint.p3));
3373
- node.style.setProperty("--mat-line", paint.line);
3374
- }
3375
-
3376
- // src/engine/placeholder.ts
3377
- var Z_INDEX = 2147483645;
3378
- var EARLY2 = "early";
3379
- var SNAPSHOT_KEY = "devknobs:snapshot";
3380
- var SNAPSHOT_VERSION = 1;
3381
- var EARLY_FRAMES = 60;
3382
- var earlyWait = 0;
3383
- function snapshotKey(knobs, view) {
3384
- return JSON.stringify([
3385
- knobs.width,
3386
- knobs.height,
3387
- knobs.frame,
3388
- knobs.dpr,
3389
- knobs.vision,
3390
- knobs.scheme,
3391
- knobs.device,
3392
- knobs.orientation,
3393
- knobs.posture,
3394
- knobs.mock,
3395
- knobs.browser,
3396
- knobs.bars,
3397
- knobs.edgeToEdge,
3398
- knobs.zoom,
3399
- knobs.mat,
3400
- knobs.panel.open,
3401
- knobs.panel.side,
3402
- knobs.panel.docked,
3403
- view.innerWidth,
3404
- view.innerHeight,
3405
- view.devicePixelRatio
3406
- ]);
3407
- }
3408
- var RGB = /^rgb\(\d{1,3}, \d{1,3}, \d{1,3}\)$/;
3409
- function lookOf(value) {
3410
- if (typeof value !== "object" || value === null)
3411
- return null;
3412
- const read2 = (key) => Reflect.get(value, key);
3413
- const background = read2("background");
3414
- const scheme = read2("scheme");
3415
- const host = read2("host");
3416
- const flags = [read2("dark"), read2("canBack"), read2("canForward")];
3417
- if (typeof background !== "string" || !RGB.test(background)) {
3418
- return null;
3419
- }
3420
- if (scheme !== "light" && scheme !== "dark" || typeof host !== "string")
3421
- return null;
3422
- const [dark, canBack, canForward] = flags;
3423
- if (typeof dark !== "boolean" || typeof canBack !== "boolean")
3424
- return null;
3425
- if (typeof canForward !== "boolean")
3426
- return null;
3427
- const color = (key) => {
3428
- const value2 = read2(key);
3429
- return typeof value2 === "string" && RGB.test(value2) ? value2 : background;
3430
- };
3431
- const top2 = color("top");
3432
- const bottom = color("bottom");
3433
- const header = read2("header");
3434
- if (typeof header !== "boolean")
3435
- return null;
3436
- return { background, top: top2, bottom, header, footer: read2("footer") === true, under: [], dark, scheme, host, canBack, canForward };
3437
- }
3438
- function readSnapshot(knobs, view) {
3439
- try {
3440
- const text2 = webStorage("session")?.getItem(SNAPSHOT_KEY);
3441
- if (!text2)
3442
- return null;
3443
- const data = JSON.parse(text2);
3444
- if (typeof data !== "object" || data === null || newer(data, SNAPSHOT_VERSION))
3445
- return null;
3446
- const key = Reflect.get(data, "key");
3447
- const css = Reflect.get(data, "css");
3448
- const html = Reflect.get(data, "html");
3449
- const look = lookOf(Reflect.get(data, "look"));
3450
- if (key !== snapshotKey(knobs, view) || typeof css !== "string")
3451
- return null;
3452
- if (typeof html !== "string" || !look)
3453
- return null;
3454
- return { key, css, html, look };
3455
- } catch {
3456
- return null;
3457
- }
3458
- }
3459
- function writeSnapshot(snapshot) {
3460
- try {
3461
- webStorage("session")?.setItem(SNAPSHOT_KEY, JSON.stringify(stamped(snapshot, SNAPSHOT_VERSION)));
3462
- } catch {
3463
- clearSnapshot();
3464
- }
3465
- }
3466
- function keepDrawing({ letterbox, zoom, key, css, look }) {
3467
- const copy2 = letterbox.cloneNode(true);
3468
- if (!(copy2 instanceof HTMLElement))
3469
- return;
3470
- copy2.querySelector("iframe")?.remove();
3471
- copy2.querySelector(".touchdot")?.remove();
3472
- copy2.querySelector(".glass")?.removeAttribute("data-touch");
3473
- for (const line of Array.from(copy2.querySelectorAll(".progress")))
3474
- line.hidden = true;
3475
- const blank = copy2.querySelector(".screenblank");
3476
- if (blank) {
3477
- blank.hidden = false;
3478
- blank.style.background = look.background;
3479
- }
3480
- for (const option of Array.from(copy2.querySelectorAll("option"))) {
3481
- option.toggleAttribute("selected", option.value === zoom);
3482
- }
3483
- writeSnapshot({ key, css, html: copy2.outerHTML, look });
3484
- }
3485
- function clearSnapshot() {
3486
- try {
3487
- webStorage("session")?.removeItem(SNAPSHOT_KEY);
3488
- } catch {}
3489
- }
3490
- function earlyHost() {
3491
- return document.querySelector(`div[data-devknobs="${EARLY2}"]`);
3492
- }
3493
- function dropEarly() {
3494
- for (const node of Array.from(document.querySelectorAll(`[data-devknobs="${EARLY2}"]`))) {
3495
- node.remove();
3496
- }
3497
- removeStyle(EARLY2);
3498
- }
3499
- function adoptEarly(pictureLoading) {
3500
- const early = earlyHost();
3501
- if (!early || !document.body) {
3502
- dropEarly();
3503
- return;
3504
- }
3505
- document.body.append(early);
3506
- let frames = 0;
3507
- const step = () => {
3508
- earlyWait = 0;
3509
- if (pictureLoading() && ++frames < EARLY_FRAMES) {
3510
- earlyWait = window.requestAnimationFrame(step);
3511
- return;
3512
- }
3513
- earlyWait = window.requestAnimationFrame(() => {
3514
- earlyWait = 0;
3515
- dropEarly();
3516
- });
3517
- };
3518
- earlyWait = window.requestAnimationFrame(step);
3519
- }
3520
- function stopAdopting() {
3521
- if (earlyWait)
3522
- window.cancelAnimationFrame(earlyWait);
3523
- earlyWait = 0;
3524
- }
3525
-
3526
- // src/requests/shared.ts
3527
- var SHARED_VERSION = 2;
3528
- var SHARED3 = Symbol.for("devknobs.requests");
3529
- var QUIET = Symbol.for("devknobs.quiet");
3530
- function isShared2(value) {
3531
- return typeof value === "object" && value !== null && Reflect.get(value, "version") === SHARED_VERSION;
3532
- }
3533
- function shared2(scope = globalThis) {
3534
- try {
3535
- const value = Reflect.get(scope, SHARED3);
3536
- return isShared2(value) ? value : null;
3537
- } catch {
3538
- return null;
3539
- }
3540
- }
3541
- function share(recorder) {
3542
- if (recorder)
3543
- Reflect.set(globalThis, SHARED3, recorder);
3544
- else
3545
- Reflect.deleteProperty(globalThis, SHARED3);
3546
- }
3547
- function evict() {
3548
- const other = Reflect.get(globalThis, SHARED3);
3549
- if (typeof other !== "object" || other === null)
3550
- return;
3551
- const uninstall = Reflect.get(other, "uninstall");
3552
- try {
3553
- if (typeof uninstall === "function")
3554
- uninstall.call(other);
3555
- } catch {}
3556
- Reflect.deleteProperty(globalThis, SHARED3);
3557
- }
3558
-
3559
1758
  // src/engine/owninline.ts
3560
- var OWN2 = Symbol.for("devknobs.inline");
1759
+ var OWN = Symbol.for("devknobs.inline");
3561
1760
  function notes(element) {
3562
- const value = Reflect.get(element, OWN2);
1761
+ const value = Reflect.get(element, OWN);
3563
1762
  return typeof value === "object" && value !== null ? value : null;
3564
1763
  }
3565
1764
  function markInline(element, property, value) {
@@ -3572,7 +1771,7 @@ function markInline(element, property, value) {
3572
1771
  if (kept)
3573
1772
  Reflect.set(kept, property, value);
3574
1773
  else
3575
- Reflect.set(element, OWN2, { [property]: value });
1774
+ Reflect.set(element, OWN, { [property]: value });
3576
1775
  }
3577
1776
  function ownInline(element, property) {
3578
1777
  const kept = notes(element);
@@ -3612,24 +1811,24 @@ function emulatedFontSize(value, size) {
3612
1811
  if (keyword !== undefined)
3613
1812
  return px(keyword * size);
3614
1813
  let relative = false;
3615
- const next2 = value.replace(RELATIVE, (_whole, amount, unit) => {
1814
+ const next = value.replace(RELATIVE, (_whole, amount, unit) => {
3616
1815
  relative = true;
3617
1816
  return px(Number(amount) * size / (unit === "%" ? 100 : 1));
3618
1817
  });
3619
- return relative ? next2 : null;
1818
+ return relative ? next : null;
3620
1819
  }
3621
1820
  function emulateMediaText(text2, size) {
3622
1821
  return text2.replace(MEDIA_RELATIVE, (_whole, amount) => px(Number(amount) * size));
3623
1822
  }
3624
1823
  function substituteVars(value, lookup) {
3625
- let next2 = value;
3626
- for (let depth = 0;depth < 5 && next2.includes("var("); depth++) {
3627
- next2 = next2.replace(VAR, (_whole, name, fallback) => {
1824
+ let next = value;
1825
+ for (let depth = 0;depth < 5 && next.includes("var("); depth++) {
1826
+ next = next.replace(VAR, (_whole, name, fallback) => {
3628
1827
  const found = lookup(name).trim();
3629
1828
  return found || fallback?.trim() || "var()";
3630
1829
  });
3631
1830
  }
3632
- return next2.includes("var(") ? null : next2;
1831
+ return next.includes("var(") ? null : next;
3633
1832
  }
3634
1833
  function splitSelectors(text2) {
3635
1834
  const parts = [];
@@ -3740,12 +1939,12 @@ function rewriteMedia() {
3740
1939
  const known = rewrites.get(rule);
3741
1940
  const ours = known !== undefined && text2 === known.written;
3742
1941
  const source = ours ? known.original : text2;
3743
- const next2 = size === null ? source : emulateMediaText(source, size);
3744
- if (next2 === source && !ours)
1942
+ const next = size === null ? source : emulateMediaText(source, size);
1943
+ if (next === source && !ours)
3745
1944
  return;
3746
- if (next2 !== text2) {
1945
+ if (next !== text2) {
3747
1946
  try {
3748
- rule.media.mediaText = next2;
1947
+ rule.media.mediaText = next;
3749
1948
  } catch {}
3750
1949
  }
3751
1950
  if (size === null)
@@ -3806,8 +2005,8 @@ function rootDeclarations() {
3806
2005
  continue;
3807
2006
  seen.add(imported.styleSheet);
3808
2007
  const media = imported.media.mediaText;
3809
- const next2 = media ? [...conditions, () => matches(media)] : conditions;
3810
- walk(rulesOf(imported.styleSheet), layered || imported.layerName != null, next2);
2008
+ const next = media ? [...conditions, () => matches(media)] : conditions;
2009
+ walk(rulesOf(imported.styleSheet), layered || imported.layerName != null, next);
3811
2010
  } else if (kind === "CSSMediaRule") {
3812
2011
  const media = rule.media.mediaText;
3813
2012
  walk(rule.cssRules, layered, [...conditions, () => matches(media)]);
@@ -3886,12 +2085,12 @@ function applyRoot() {
3886
2085
  const value = authorFontSize();
3887
2086
  const lookup = (name) => getComputedStyle(root).getPropertyValue(name);
3888
2087
  const resolved = value === null ? null : substituteVars(value, lookup);
3889
- const next2 = resolved === null ? px(computedSize() * size / INITIAL) : emulatedFontSize(resolved, size);
3890
- if (next2 === null) {
2088
+ const next = resolved === null ? px(computedSize() * size / INITIAL) : emulatedFontSize(resolved, size);
2089
+ if (next === null) {
3891
2090
  restoreRoot();
3892
2091
  return;
3893
2092
  }
3894
- root.style.setProperty("font-size", next2, "important");
2093
+ root.style.setProperty("font-size", next, "important");
3895
2094
  wrote = root.style.getPropertyValue("font-size");
3896
2095
  markInline(root, "font-size", wrote);
3897
2096
  }
@@ -3934,16 +2133,16 @@ function watchSheets() {
3934
2133
  observer.observe(document.documentElement, { childList: true, subtree: true });
3935
2134
  window.addEventListener("resize", onResize);
3936
2135
  }
3937
- function sizeQuery(query, next2) {
2136
+ function sizeQuery(query, next) {
3938
2137
  const emulated = size === null ? query : emulateMediaText(query, size);
3939
- const list = next2(emulated);
2138
+ const list = next(emulated);
3940
2139
  if (emulated !== query)
3941
2140
  Object.defineProperty(list, "media", { configurable: true, value: query });
3942
2141
  return list;
3943
2142
  }
3944
- function apply3(value) {
2143
+ function apply2(value) {
3945
2144
  if (typeof value !== "number" || !(value > 0)) {
3946
- reset3();
2145
+ reset2();
3947
2146
  return;
3948
2147
  }
3949
2148
  active = true;
@@ -3952,7 +2151,7 @@ function apply3(value) {
3952
2151
  watchSheets();
3953
2152
  refresh();
3954
2153
  }
3955
- function reset3() {
2154
+ function reset2() {
3956
2155
  if (!active)
3957
2156
  return;
3958
2157
  size = null;
@@ -3970,7 +2169,7 @@ function reset3() {
3970
2169
  }
3971
2170
 
3972
2171
  // src/engine/media.ts
3973
- var SYSTEM_MEDIA2 = {
2172
+ var SYSTEM_MEDIA = {
3974
2173
  scheme: "system",
3975
2174
  motion: "system",
3976
2175
  contrast: "system",
@@ -4063,16 +2262,16 @@ function rewriteMediaText(text2, feature, value) {
4063
2262
  return queries.map((query) => rewriteQuery(query, feature, value)).join(", ");
4064
2263
  }
4065
2264
  function rewriteAll(text2, value) {
4066
- let next2 = text2;
2265
+ let next = text2;
4067
2266
  for (const [feature, reads] of emulated(value))
4068
- next2 = rewriteMediaText(next2, feature, reads);
4069
- return next2;
2267
+ next = rewriteMediaText(next, feature, reads);
2268
+ return next;
4070
2269
  }
4071
2270
  function mentionsFeature(text2) {
4072
2271
  const lower = text2.toLowerCase();
4073
2272
  return FEATURES.some((feature) => lower.includes(feature));
4074
2273
  }
4075
- var EARLY3 = Symbol.for("devknobs.early");
2274
+ var EARLY2 = Symbol.for("devknobs.early");
4076
2275
  var originals = new WeakMap;
4077
2276
  var tracked = new Set;
4078
2277
  var heard = new WeakMap;
@@ -4080,7 +2279,7 @@ var queries = new WeakMap;
4080
2279
  var guarded = new WeakSet;
4081
2280
  var PRUNE_FROM = 256;
4082
2281
  var pruneAt = PRUNE_FROM;
4083
- var current2 = SYSTEM_MEDIA2;
2282
+ var current2 = SYSTEM_MEDIA;
4084
2283
  var nativeMatches = null;
4085
2284
  var readMatches = null;
4086
2285
  var nativeListen = null;
@@ -4139,11 +2338,11 @@ function applyCss() {
4139
2338
  return;
4140
2339
  originals.set(rule, original2);
4141
2340
  }
4142
- const next2 = rewriteAll(original2, current2);
4143
- if (next2 === text2)
2341
+ const next = rewriteAll(original2, current2);
2342
+ if (next === text2)
4144
2343
  return;
4145
2344
  try {
4146
- rule.media.mediaText = next2;
2345
+ rule.media.mediaText = next;
4147
2346
  } catch {}
4148
2347
  }, seen);
4149
2348
  }
@@ -4292,8 +2491,8 @@ function restoreListen() {
4292
2491
  nativeListen = null;
4293
2492
  addNative = null;
4294
2493
  }
4295
- function trackLists(query, next2) {
4296
- const list = next2(query);
2494
+ function trackLists(query, next) {
2495
+ const list = next(query);
4297
2496
  if (mentionsFeature(query))
4298
2497
  track2(list, query);
4299
2498
  return list;
@@ -4302,8 +2501,8 @@ function ensureMatchMedia() {
4302
2501
  if (patched)
4303
2502
  return;
4304
2503
  const scope = window;
4305
- const early = scope[EARLY3];
4306
- scope[EARLY3] = null;
2504
+ const early = scope[EARLY2];
2505
+ scope[EARLY2] = null;
4307
2506
  const handed = early?.release(guard) ?? [];
4308
2507
  patched = true;
4309
2508
  for (const { list, query, heard: value, guarded: on } of handed) {
@@ -4346,12 +2545,12 @@ function applyColorScheme() {
4346
2545
  }
4347
2546
  function coarse(view) {
4348
2547
  const below = view.matchMedia;
4349
- const touch = { ...SYSTEM_MEDIA2, touch: true };
2548
+ const touch = { ...SYSTEM_MEDIA, touch: true };
4350
2549
  view.matchMedia = function matchMedia(query) {
4351
2550
  return below.call(view, rewriteAll(String(query), touch));
4352
2551
  };
4353
2552
  }
4354
- function apply4(value) {
2553
+ function apply3(value) {
4355
2554
  current2 = value;
4356
2555
  ensureMatchMedia();
4357
2556
  ensureObserver();
@@ -4359,8 +2558,8 @@ function apply4(value) {
4359
2558
  applyCss();
4360
2559
  refresh2();
4361
2560
  }
4362
- function reset4() {
4363
- apply4(SYSTEM_MEDIA2);
2561
+ function reset3() {
2562
+ apply3(SYSTEM_MEDIA);
4364
2563
  }
4365
2564
  function teardown() {
4366
2565
  observer2?.disconnect();
@@ -4381,218 +2580,147 @@ function teardown() {
4381
2580
  colorScheme = null;
4382
2581
  }
4383
2582
  function destroy() {
4384
- reset4();
2583
+ reset3();
4385
2584
  for (const ref of tracked) {
4386
2585
  const list = ref.deref();
4387
2586
  if (list)
4388
2587
  guardFirst(list);
4389
2588
  }
4390
2589
  teardown();
4391
- Reflect.deleteProperty(window, EARLY3);
2590
+ Reflect.deleteProperty(window, EARLY2);
4392
2591
  }
4393
2592
 
4394
- // src/engine/screen.ts
4395
- var KEYS2 = ["width", "height", "availWidth", "availHeight"];
4396
- function screenSizeOf(state) {
4397
- const device = formOf(state.device, state.posture);
4398
- if (!device || device.kind !== "phone" && device.kind !== "tablet")
4399
- return null;
4400
- if (device.ua !== "iphone-safari")
4401
- return turn(device, state.orientation);
4402
- const { width, height } = turn(deviceOf(state.device) ?? device, "portrait");
4403
- const across = device.postures !== undefined && state.posture !== "open" && state.orientation === "landscape";
4404
- return across ? { width, height, availHeight: width } : { width, height };
4405
- }
4406
- var ORIGINALS = Symbol.for("devknobs.screen");
4407
- function originalsOf(own) {
4408
- const held = Reflect.get(own, ORIGINALS);
4409
- return held instanceof Map ? held : undefined;
4410
- }
4411
- function apply5(size2, scope = globalThis) {
4412
- const own = Reflect.get(scope, "screen");
4413
- if (typeof own !== "object" || own === null)
4414
- return;
4415
- const originals2 = originalsOf(own);
4416
- if (!size2) {
4417
- if (!originals2)
4418
- return;
4419
- for (const [key, descriptor] of originals2) {
4420
- if (descriptor)
4421
- Object.defineProperty(own, key, descriptor);
4422
- else
4423
- Reflect.deleteProperty(own, key);
4424
- }
4425
- Reflect.deleteProperty(own, ORIGINALS);
4426
- return;
4427
- }
4428
- if (!originals2) {
4429
- const kept = new Map(KEYS2.map((key) => [key, Object.getOwnPropertyDescriptor(own, key)]));
4430
- Object.defineProperty(own, ORIGINALS, { configurable: true, value: kept });
4431
- }
4432
- for (const key of KEYS2) {
4433
- const value = key === "width" || key === "availWidth" ? size2.width : key === "availHeight" ? size2.availHeight ?? size2.height : size2.height;
4434
- Object.defineProperty(own, key, { configurable: true, enumerable: true, get: () => value });
4435
- }
2593
+ // src/engine/style.ts
2594
+ var OWN2 = Symbol.for("devknobs.own");
2595
+ var NAME = Symbol.for("devknobs.name");
2596
+ var TEXT = Symbol.for("devknobs.text");
2597
+ var wrapped = new WeakMap;
2598
+ function isDocument(root) {
2599
+ return root.nodeType === 9;
4436
2600
  }
4437
- function reset5() {
4438
- apply5(null);
2601
+ function documentOf(root) {
2602
+ return isDocument(root) ? root : root.ownerDocument ?? document;
4439
2603
  }
4440
-
4441
- // src/engine/scrollbars.ts
4442
- var NAME2 = "scrollbars";
4443
- var COMMIT_WAIT = 1000;
4444
- var CSS2 = "*{scrollbar-width:none!important}::-webkit-scrollbar{display:none!important}";
4445
- function apply6(value) {
4446
- if (!value) {
4447
- reset6();
4448
- return;
4449
- }
4450
- ensureStyle(NAME2).textContent = CSS2;
2604
+ function constructable(root) {
2605
+ const doc = isDocument(root) ? root : root.ownerDocument;
2606
+ const Sheet = doc?.defaultView?.CSSStyleSheet;
2607
+ if (typeof Sheet !== "function" || typeof Sheet.prototype.replaceSync !== "function")
2608
+ return null;
2609
+ return "adoptedStyleSheets" in root ? Sheet : null;
4451
2610
  }
4452
- function place(doc) {
4453
- if (doc.documentElement) {
4454
- ensureStyle(NAME2, doc).textContent = CSS2;
4455
- return;
4456
- }
4457
- const observer3 = new MutationObserver(() => {
4458
- if (!doc.documentElement)
4459
- return;
4460
- observer3.disconnect();
4461
- ensureStyle(NAME2, doc).textContent = CSS2;
4462
- });
4463
- observer3.observe(doc, { childList: true });
2611
+ function styleNode(style) {
2612
+ return "nodeType" in style ? style : null;
4464
2613
  }
4465
- function equip(view) {
4466
- const blank = view.document;
4467
- if (!blank)
4468
- return;
4469
- if (blank.URL !== "about:blank") {
4470
- place(blank);
4471
- return;
4472
- }
4473
- const until = performance.now() + COMMIT_WAIT;
4474
- const channel = new MessageChannel;
4475
- channel.port1.onmessage = () => {
4476
- let doc = null;
4477
- try {
4478
- doc = view.document;
4479
- } catch {}
4480
- if (doc && doc !== blank)
4481
- place(doc);
4482
- else if (doc && performance.now() < until) {
4483
- channel.port2.postMessage(null);
4484
- return;
2614
+ function isOwnSheet(sheet) {
2615
+ return Reflect.get(sheet, OWN2) === true;
2616
+ }
2617
+ function wrap(root, sheet) {
2618
+ const had = wrapped.get(sheet);
2619
+ if (had)
2620
+ return had;
2621
+ const style = {
2622
+ get textContent() {
2623
+ const text2 = Reflect.get(sheet, TEXT);
2624
+ return typeof text2 === "string" ? text2 : "";
2625
+ },
2626
+ set textContent(value) {
2627
+ Reflect.set(sheet, TEXT, value ?? "");
2628
+ sheet.replaceSync(value ?? "");
2629
+ },
2630
+ sheet,
2631
+ remove() {
2632
+ root.adoptedStyleSheets = root.adoptedStyleSheets.filter((other) => other !== sheet);
4485
2633
  }
4486
- channel.port1.close();
4487
2634
  };
4488
- channel.port2.postMessage(null);
2635
+ wrapped.set(sheet, style);
2636
+ return style;
4489
2637
  }
4490
- function reset6() {
4491
- removeStyle(NAME2);
2638
+ function adopt(root, Sheet, name) {
2639
+ const sheet = new Sheet;
2640
+ Reflect.set(sheet, OWN2, true);
2641
+ if (name !== undefined)
2642
+ Reflect.set(sheet, NAME, name);
2643
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
2644
+ return wrap(root, sheet);
4492
2645
  }
4493
-
4494
- // src/engine/touch.ts
4495
- var TOUCH_POINTS = 5;
4496
- var handler = false;
4497
- var points = false;
4498
- function apply7(value) {
4499
- if (value.on && !handler && !("ontouchstart" in window)) {
4500
- Object.defineProperty(window, "ontouchstart", {
4501
- configurable: true,
4502
- enumerable: true,
4503
- writable: true,
4504
- value: null
4505
- });
4506
- handler = true;
4507
- } else if (!value.on && handler) {
4508
- Reflect.deleteProperty(window, "ontouchstart");
4509
- handler = false;
4510
- }
4511
- const report = value.on && value.points;
4512
- if (report && !points) {
4513
- Object.defineProperty(navigator, "maxTouchPoints", {
4514
- configurable: true,
4515
- enumerable: true,
4516
- get: () => TOUCH_POINTS
4517
- });
4518
- points = true;
4519
- } else if (!report && points) {
4520
- Reflect.deleteProperty(navigator, "maxTouchPoints");
4521
- points = false;
2646
+ function addStyle(root, css) {
2647
+ const Sheet = constructable(root);
2648
+ if (Sheet) {
2649
+ const style2 = adopt(root, Sheet);
2650
+ style2.textContent = css;
2651
+ return style2;
4522
2652
  }
2653
+ const style = documentOf(root).createElement("style");
2654
+ style.textContent = css;
2655
+ if (isDocument(root))
2656
+ (root.head ?? root.documentElement).appendChild(style);
2657
+ else
2658
+ root.append(style);
2659
+ return style;
4523
2660
  }
4524
- function equip2(view, points2) {
4525
- if (!("ontouchstart" in view)) {
4526
- Object.defineProperty(view, "ontouchstart", {
4527
- configurable: true,
4528
- enumerable: true,
4529
- writable: true,
4530
- value: null
4531
- });
2661
+ function switchedSheet(root, name) {
2662
+ const Sheet = constructable(root);
2663
+ if (Sheet) {
2664
+ const sheet2 = new Sheet;
2665
+ Reflect.set(sheet2, OWN2, true);
2666
+ const off = () => {
2667
+ root.adoptedStyleSheets = root.adoptedStyleSheets.filter((other) => other !== sheet2);
2668
+ };
2669
+ let gone = false;
2670
+ return {
2671
+ sheet: sheet2,
2672
+ on() {
2673
+ if (!gone && !root.adoptedStyleSheets.includes(sheet2))
2674
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet2];
2675
+ },
2676
+ off,
2677
+ remove() {
2678
+ gone = true;
2679
+ off();
2680
+ }
2681
+ };
4532
2682
  }
4533
- if (!points2)
4534
- return;
4535
- Object.defineProperty(view.navigator, "maxTouchPoints", {
4536
- configurable: true,
4537
- enumerable: true,
4538
- get: () => TOUCH_POINTS
4539
- });
2683
+ const style = documentOf(root).createElement("style");
2684
+ style.setAttribute("data-devknobs", name);
2685
+ if (isDocument(root))
2686
+ (root.head ?? root.documentElement).appendChild(style);
2687
+ else
2688
+ root.append(style);
2689
+ const sheet = style.sheet;
2690
+ if (!sheet) {
2691
+ style.remove();
2692
+ return null;
2693
+ }
2694
+ sheet.disabled = true;
2695
+ return {
2696
+ sheet,
2697
+ on() {
2698
+ sheet.disabled = false;
2699
+ },
2700
+ off() {
2701
+ sheet.disabled = true;
2702
+ },
2703
+ remove: () => style.remove()
2704
+ };
4540
2705
  }
4541
- function reset7() {
4542
- apply7({ on: false, points: false });
2706
+ function findStyle(name, doc = document) {
2707
+ const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME) === name) : undefined;
2708
+ return sheet ? wrap(doc, sheet) : doc.querySelector(`style[data-devknobs="${name}"]`);
4543
2709
  }
4544
-
4545
- // src/engine/touchmark.ts
4546
- var RADIUS = 11;
4547
- var DOT_LOOK = `
4548
- .dot {
4549
- left: 0;
4550
- top: 0;
4551
- width: ${RADIUS * 2}px;
4552
- height: ${RADIUS * 2}px;
4553
- margin: -${RADIUS}px 0 0 -${RADIUS}px;
4554
- pointer-events: none;
4555
- will-change: transform;
4556
- }
4557
- .dot[hidden] { display: none; }
4558
- .dot::after {
4559
- content: "";
4560
- position: absolute;
4561
- inset: 0;
4562
- box-sizing: border-box;
4563
- border-radius: 50%;
4564
- background: rgb(0 0 0 / 0.28);
4565
- border: 1.5px solid rgb(255 255 255 / 0.85);
4566
- box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25);
4567
- transition: transform 80ms ease-out, background-color 80ms ease-out;
4568
- }
4569
- .dot.pressed::after {
4570
- transform: scale(0.82);
4571
- background: rgb(0 0 0 / 0.45);
4572
- }
4573
- @media (prefers-reduced-motion: reduce) {
4574
- .dot::after { transition: none; }
4575
- }
4576
- `;
4577
- var MARK_EVENT = "devknobs-touch-mark";
4578
- function finite(value) {
4579
- return typeof value === "number" && Number.isFinite(value);
4580
- }
4581
- function readMark(detail) {
4582
- if (typeof detail !== "object" || detail === null)
4583
- return null;
4584
- const at = Reflect.get(detail, "at");
4585
- const pressed = Reflect.get(detail, "pressed");
4586
- const held = Reflect.get(detail, "held");
4587
- if (typeof pressed !== "boolean" || typeof held !== "boolean")
4588
- return null;
4589
- if (at === null)
4590
- return { at: null, pressed, held };
4591
- if (typeof at !== "object")
4592
- return null;
4593
- const x = Reflect.get(at, "x");
4594
- const y = Reflect.get(at, "y");
4595
- return finite(x) && finite(y) ? { at: { x, y }, pressed, held } : null;
2710
+ function ensureStyle(name, doc = document) {
2711
+ const existing = findStyle(name, doc);
2712
+ if (existing)
2713
+ return existing;
2714
+ const Sheet = constructable(doc);
2715
+ if (Sheet)
2716
+ return adopt(doc, Sheet, name);
2717
+ const style = doc.createElement("style");
2718
+ style.setAttribute("data-devknobs", name);
2719
+ (doc.head ?? doc.documentElement).appendChild(style);
2720
+ return style;
2721
+ }
2722
+ function removeStyle(name, doc = document) {
2723
+ findStyle(name, doc)?.remove();
4596
2724
  }
4597
2725
 
4598
- export { __export, __require, CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, SHARED_VERSION, QUIET, shared2 as shared, share, evict, follow, keep, keepOwn, resume, systemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply3 as apply1, reset3 as reset1, rewriteMediaText, authoredQuery, coarse, apply4 as apply2, destroy, runsUnderBars, platformOf, layoutOptions, layoutOf, viewportOf, alphaAt, SAFARI_TEXT, barsOf, BARS_START, barsStep, islandOf, round, turnRect, turnSides, turnRadius, placeIn2 as placeIn, mockOf, UA_PRESETS, uaPreset, userAgentOf, apply2 as apply3, isMac, reset2, nativeViewport, inPage, framing, nativeEnabled, enableNative, handing, settles, drive, driveUa, release, styleNode, isOwnSheet, addStyle, ensureStyle, removeStyle, screenSizeOf, apply5 as apply4, reset5 as reset3, apply6 as apply5, equip, reset6 as reset4, apply7 as apply6, equip2 as equip1, reset7 as reset5, DOT_LOOK, MARK_EVENT, readMark, MAT_COLORS2 as MAT_COLORS, MAT_COLOR_NAMES, matGradient, isMatName, putMat, Z_INDEX, snapshotKey, readSnapshot, keepDrawing, clearSnapshot, dropEarly, adoptEarly, stopAdopting };
2726
+ export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, authoredQuery, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };