@vinena/knobs 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +7 -0
  3. package/dist/early.global.js +6 -6
  4. package/dist/{elementsview-tf4qzmtw.js → elementsview-1wsxcdtj.js} +4 -4
  5. package/dist/{elementsview-jnkbhzkj.js → elementsview-3kv34jfx.js} +4 -4
  6. package/dist/engine/browserdraw.d.ts +29 -2
  7. package/dist/engine/browserkit.d.ts +20 -1
  8. package/dist/engine/browserui.d.ts +162 -22
  9. package/dist/engine/devices.d.ts +3 -2
  10. package/dist/engine/devicon.d.ts +59 -0
  11. package/dist/engine/fit.d.ts +4 -3
  12. package/dist/engine/foldflip.d.ts +40 -0
  13. package/dist/engine/frames.d.ts +1 -0
  14. package/dist/engine/identity.d.ts +12 -5
  15. package/dist/engine/index.d.ts +2 -0
  16. package/dist/engine/mock.d.ts +14 -0
  17. package/dist/engine/mockdata.d.ts +5 -1
  18. package/dist/engine/morphrun.d.ts +4 -0
  19. package/dist/engine/native.d.ts +31 -3
  20. package/dist/engine/notice.d.ts +1 -2
  21. package/dist/engine/pageshot.d.ts +5 -2
  22. package/dist/engine/safaridraw.d.ts +162 -10
  23. package/dist/engine/screen.d.ts +24 -0
  24. package/dist/engine/store.d.ts +2 -1
  25. package/dist/engine/tabicon.d.ts +43 -0
  26. package/dist/engine/toplayer.d.ts +62 -0
  27. package/dist/engine/touchpointer.d.ts +0 -21
  28. package/dist/engine/underbar.d.ts +61 -0
  29. package/dist/engine/width.d.ts +3 -0
  30. package/dist/{framekit-3n7p79ht.js → framekit-cjz0e4y8.js} +2492 -1587
  31. package/dist/{framekit-g96t6nmq.js → framekit-yk1jxjv7.js} +2492 -1587
  32. package/dist/host.d.ts +51 -0
  33. package/dist/{index-33x9hxe3.js → index-6wbgqkdz.js} +626 -189
  34. package/dist/{index-2d6wvs8h.js → index-9jhatmky.js} +4 -4
  35. package/dist/{index-zvze25nf.js → index-begsqdm0.js} +1 -1
  36. package/dist/{index-peh33xjv.js → index-j1h13ahg.js} +1 -1
  37. package/dist/{index-5baxvd3v.js → index-p57fdttx.js} +307 -129
  38. package/dist/{index-dvr4x91q.js → index-prjpx67p.js} +20 -8
  39. package/dist/{index-d0cjxjsm.js → index-q73py563.js} +1 -1
  40. package/dist/{index-ke6v7919.js → index-sn2y6j09.js} +20 -8
  41. package/dist/{index-0casarhy.js → index-vgfn2n1h.js} +1 -1
  42. package/dist/{index-k015tb6c.js → index-zt3rheck.js} +4 -4
  43. package/dist/index.d.ts +26 -1
  44. package/dist/index.global.js +299 -176
  45. package/dist/index.js +424 -124
  46. package/dist/instance.d.ts +23 -4
  47. package/dist/{react-qv0nykcv.js → react-3rhdj2k1.js} +623 -186
  48. package/dist/{react-carf84xv.js → react-6tss0r9f.js} +307 -129
  49. package/dist/{react-eygws6cx.js → react-7vjfsh40.js} +4 -4
  50. package/dist/{react-71a9ypex.js → react-806qmkyz.js} +4 -4
  51. package/dist/{react-65tgdbs8.js → react-gefkdkdz.js} +1 -1
  52. package/dist/{react-sq9pkw4k.js → react-mmq2zya3.js} +1 -1
  53. package/dist/{react-xxfpfddf.js → react-qfpg79hs.js} +1 -1
  54. package/dist/{react-pdvseef0.js → react-qgz9afa2.js} +1 -1
  55. package/dist/react.js +420 -123
  56. package/dist/{storageview-sb23henh.js → storageview-7cv0vpdm.js} +4 -4
  57. package/dist/{storageview-vf8v8q8j.js → storageview-dyhpgt8f.js} +4 -4
  58. package/dist/types.d.ts +14 -0
  59. package/dist/ui/footer.d.ts +9 -2
  60. package/dist/ui/panel.d.ts +16 -2
  61. package/dist/ui/settings.d.ts +25 -1
  62. package/dist/version.d.ts +2 -0
  63. package/package.json +3 -2
  64. package/skills/devknobs/SKILL.md +1 -1
  65. package/dist/engine/endroom.d.ts +0 -21
package/dist/react.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  lerp,
10
10
  setDockWidth,
11
11
  watchColumn
12
- } from "./react-xxfpfddf.js";
12
+ } from "./react-qfpg79hs.js";
13
13
  import {
14
14
  GRAB_COLORS as GRAB_COLORS2,
15
15
  GRAB_COLOR_NAMES,
@@ -18,10 +18,10 @@ import {
18
18
  createGrab,
19
19
  createInspect,
20
20
  oneAtATime
21
- } from "./react-71a9ypex.js";
21
+ } from "./react-806qmkyz.js";
22
22
  import {
23
23
  hushOnce
24
- } from "./react-65tgdbs8.js";
24
+ } from "./react-gefkdkdz.js";
25
25
  import {
26
26
  label
27
27
  } from "./react-adky72h9.js";
@@ -39,7 +39,7 @@ import {
39
39
  showPane,
40
40
  stopOnLoad,
41
41
  viewHead
42
- } from "./react-eygws6cx.js";
42
+ } from "./react-7vjfsh40.js";
43
43
  import {
44
44
  actButton,
45
45
  button,
@@ -68,11 +68,13 @@ import {
68
68
  tabBar,
69
69
  textField,
70
70
  toolbar
71
- } from "./react-sq9pkw4k.js";
71
+ } from "./react-mmq2zya3.js";
72
72
  import {
73
73
  BINDING_ICONS,
74
74
  BODY_CAP,
75
+ HOST_RESET,
75
76
  KEYS_FIELD,
77
+ LAYER,
76
78
  LOCALE_PRESETS,
77
79
  READ_MS,
78
80
  ROW_ICONS,
@@ -85,6 +87,8 @@ import {
85
87
  comboSpoken,
86
88
  comboText,
87
89
  defaultKeys,
90
+ devIconFor,
91
+ devIconShown,
88
92
  escapeStep,
89
93
  exports_engine,
90
94
  foldRest,
@@ -93,7 +97,9 @@ import {
93
97
  getState,
94
98
  glyph,
95
99
  highlightAt,
100
+ holdInTopLayer,
96
101
  holdingHinge,
102
+ hostSendsUa,
97
103
  icon,
98
104
  isFunctionKey,
99
105
  isSearchKey,
@@ -128,7 +134,7 @@ import {
128
134
  watchPanel,
129
135
  zoomAction,
130
136
  zoomKey
131
- } from "./react-qv0nykcv.js";
137
+ } from "./react-3rhdj2k1.js";
132
138
  import {
133
139
  BARS,
134
140
  BROWSERS,
@@ -141,6 +147,7 @@ import {
141
147
  DEFAULT_PINNED,
142
148
  DEFAULT_STATE,
143
149
  DEVICES,
150
+ DEV_ICONS,
144
151
  DIRS,
145
152
  DPR_MAX,
146
153
  DPR_MIN,
@@ -197,6 +204,7 @@ import {
197
204
  realNow,
198
205
  resolveGeo,
199
206
  rewriteMediaText,
207
+ runsUnderBars,
200
208
  stamped,
201
209
  still,
202
210
  toHex,
@@ -204,7 +212,7 @@ import {
204
212
  userAgentOf,
205
213
  watchSystemMedia,
206
214
  webStorage
207
- } from "./react-carf84xv.js";
215
+ } from "./react-6tss0r9f.js";
208
216
 
209
217
  // src/react.tsx
210
218
  import { useEffect, useRef } from "react";
@@ -809,6 +817,9 @@ var BARS2 = {
809
817
  function safariShown(state) {
810
818
  return platformOf(screenNow(state)) === "safari" && barsShown(state);
811
819
  }
820
+ function safariSideways(state) {
821
+ return safariShown(state) && state.orientation === "landscape" && runsUnderBars(screenNow(state));
822
+ }
812
823
  var EDGE_TO_EDGE = {
813
824
  id: "edgeToEdge",
814
825
  label: "edge to edge",
@@ -816,11 +827,11 @@ var EDGE_TO_EDGE = {
816
827
  control: "switch",
817
828
  options: OFF_ON,
818
829
  aliases: ["edge", "under bars", "true height", "full height"],
819
- read: (state) => flag(state.edgeToEdge && safariShown(state)),
830
+ read: (state) => flag(state.edgeToEdge && safariSideways(state)),
820
831
  write: (value) => ({ edgeToEdge: value === "on" }),
821
832
  reset: { edgeToEdge: DEFAULT_STATE.edgeToEdge },
822
833
  brief: () => "",
823
- offers: (state) => safariShown(state) ? ["off", "on"] : []
834
+ offers: (state) => safariSideways(state) ? ["off", "on"] : []
824
835
  };
825
836
  var WIDTH = {
826
837
  id: "width",
@@ -1415,7 +1426,7 @@ function knobs() {
1415
1426
  touchPointer: spec("On a touch device, the mouse acts as a finger in its frame.", flag2),
1416
1427
  browser: spec("Where a phone's browser keeps its bars, or off.", oneOf(BROWSERS)),
1417
1428
  bars: spec("Whether the browser bars follow the scroll or stay one way.", oneOf(BARS)),
1418
- edgeToEdge: spec("Safari draws the page under its bars to the bottom of the screen.", flag2),
1429
+ edgeToEdge: spec("On an iPhone held sideways, the page runs under Safari's top row. Upright, and on the iPhone Duo, it is ignored.", flag2),
1419
1430
  frame: spec("Render the page in a full-width frame even at full width.", flag2, "frame"),
1420
1431
  dpr: spec("Device pixel ratio inside the frame.", { type: "number", min: DPR_MIN, max: DPR_MAX, or: ["system"] }, "frame"),
1421
1432
  zoom: spec("How big the frame is drawn. The page sees the same viewport.", {
@@ -1444,7 +1455,9 @@ function knobs() {
1444
1455
  fields: {
1445
1456
  open: field2("The panel is open.", flag2),
1446
1457
  docked: field2("Pinned to its side as a column, with the page in a frame beside it.", flag2),
1447
- handle: field2("Show the knobs handle on the window's edge while the panel is closed. false keeps it out of screenshots for this tab.", flag2)
1458
+ handle: field2("Show the knobs handle on the window's edge while the panel is closed. false keeps it out of screenshots for this tab.", flag2),
1459
+ devIcon: field2("The yellow DEV ribbon on the tab's icon and the apple-touch-icon. auto shows it on a local host only: localhost, *.localhost, *.local, 0.0.0.0, a loopback or private network address.", oneOf(DEV_ICONS)),
1460
+ realPhone: field2("Real phone mode. true has a host that sends requests as another browser, the extension, send the device's user agent to servers for the frame's page loads, so a site serves its mobile site; some sites may sign you out. false sends none for a device in the frame. The extension saves a change made during a user gesture, such as a click (the panel's switch included), for every tab and site; a change a script makes without one stays in this tab.", flag2)
1448
1461
  }
1449
1462
  }, "frame")
1450
1463
  };
@@ -1456,8 +1469,8 @@ function describe() {
1456
1469
  }
1457
1470
  function defaultOf(key) {
1458
1471
  if (key === "panel") {
1459
- const { open, docked, handle } = DEFAULT_STATE.panel;
1460
- return { open, docked, handle };
1472
+ const { open, docked, handle, devIcon, realPhone } = DEFAULT_STATE.panel;
1473
+ return { open, docked, handle, devIcon, realPhone };
1461
1474
  }
1462
1475
  if (key === "clock") {
1463
1476
  const { mode, at, speed, header } = DEFAULT_STATE.clock;
@@ -1582,6 +1595,62 @@ function pageChoices(options2) {
1582
1595
  }
1583
1596
  return chosen;
1584
1597
  }
1598
+ var PREFER_HINT = "page: a site's own knobs, say a local build, runs the panel where the site has one; real browser settings are off then";
1599
+ function preferOf(handed) {
1600
+ const prefer = Reflect.get(handed, "prefer");
1601
+ if (typeof prefer !== "object" || prefer === null)
1602
+ return null;
1603
+ const value = Reflect.get(prefer, "value");
1604
+ const change = Reflect.get(prefer, "change");
1605
+ if (value !== "extension" && value !== "page" || typeof change !== "function")
1606
+ return null;
1607
+ const now2 = Reflect.get(prefer, "now");
1608
+ return {
1609
+ value,
1610
+ change: (next) => void Reflect.apply(change, prefer, [next]),
1611
+ ...typeof now2 === "function" ? {
1612
+ now: () => {
1613
+ const current = Reflect.apply(now2, prefer, []);
1614
+ return current === "extension" ? "extension" : "page";
1615
+ }
1616
+ } : {}
1617
+ };
1618
+ }
1619
+ function stepsAside(prefer, take) {
1620
+ return prefer === "page" && typeof take === "function";
1621
+ }
1622
+ function takesBack(prefer) {
1623
+ return prefer !== "page";
1624
+ }
1625
+ function rankOf(host) {
1626
+ const rank = Reflect.get(host, "rank");
1627
+ if (typeof rank !== "object" || rank === null)
1628
+ return null;
1629
+ const build = Reflect.get(rank, "build");
1630
+ const version = Reflect.get(rank, "version");
1631
+ if (build !== "store" && build !== "local" || typeof version !== "string")
1632
+ return null;
1633
+ return { build, version };
1634
+ }
1635
+ function numbers(version) {
1636
+ const found = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
1637
+ return found ? found.slice(1).map(Number) : [0, 0, 0];
1638
+ }
1639
+ function outranks(a, b) {
1640
+ if (!b)
1641
+ return true;
1642
+ if (a.build !== b.build)
1643
+ return a.build === "local";
1644
+ const [x, y] = [numbers(a.version), numbers(b.version)];
1645
+ for (let index = 0;index < 3; index++) {
1646
+ if (x[index] !== y[index])
1647
+ return (x[index] ?? 0) > (y[index] ?? 0);
1648
+ }
1649
+ return a.version > b.version;
1650
+ }
1651
+ function stoodDownNote(other) {
1652
+ return `${other?.build ?? "older"} extension stood down`;
1653
+ }
1585
1654
 
1586
1655
  // src/instance.ts
1587
1656
  var OWNER = Symbol.for("devknobs.owner");
@@ -1589,13 +1658,13 @@ var HOST = Symbol.for("devknobs.host");
1589
1658
  function isHost(value) {
1590
1659
  return typeof value === "object" && value !== null && typeof Reflect.get(value, "release") === "function" && typeof Reflect.get(value, "adopt") === "function";
1591
1660
  }
1592
- function claim(scope, release, adopt, api) {
1661
+ function claim(scope, release, adopt, api, extras = {}) {
1593
1662
  const previous = Reflect.get(scope, OWNER);
1594
1663
  if (typeof previous === "function" && previous !== release)
1595
1664
  previous();
1596
1665
  Reflect.set(scope, OWNER, release);
1597
1666
  if (adopt)
1598
- Reflect.set(scope, HOST, { release, adopt, api });
1667
+ Reflect.set(scope, HOST, { release, adopt, api, ...extras });
1599
1668
  else
1600
1669
  Reflect.deleteProperty(scope, HOST);
1601
1670
  }
@@ -1855,6 +1924,101 @@ function createKeys(options2 = {}) {
1855
1924
  };
1856
1925
  }
1857
1926
 
1927
+ // src/ui/footer.ts
1928
+ var FRESH_NOTE = "fresh mode: nothing is kept";
1929
+ function runtimeLabel(host, version) {
1930
+ return `${host ? "extension" : "page"} ${version}`;
1931
+ }
1932
+ function overflowBadge(on, count) {
1933
+ return on && count !== null ? `${count} overflowing` : "";
1934
+ }
1935
+ function keyLabel(combo, mac) {
1936
+ return combo ? comboLabel(combo, mac) : "";
1937
+ }
1938
+ function keyChips(keys, grab, mac, inspect = false) {
1939
+ const chips = [
1940
+ { command: "panel", key: comboLabel(keys.panel, mac), word: BINDING_WORDS.panel },
1941
+ { command: "search", key: "/", word: "search" }
1942
+ ];
1943
+ if (grab) {
1944
+ chips.push({ command: "grab", key: keyLabel(keys.grab, mac), word: BINDING_WORDS.grab });
1945
+ }
1946
+ if (inspect) {
1947
+ const key = keyLabel(keys.inspect, mac);
1948
+ chips.push({ command: "inspect", key, word: BINDING_WORDS.inspect });
1949
+ }
1950
+ chips.push({ command: "replay", key: keyLabel(keys.replay, mac), word: BINDING_WORDS.replay }, { command: "reset", key: keyLabel(keys.reset, mac), word: BINDING_WORDS.reset });
1951
+ return chips;
1952
+ }
1953
+ function iconHint(className, label2, glyph2) {
1954
+ const node = button(`hint ${className}`, "");
1955
+ if (glyph2)
1956
+ node.append(glyph2);
1957
+ node.setAttribute("aria-label", label2);
1958
+ return node;
1959
+ }
1960
+ function createFooter(keys, grab, mac, inspect = null, runtime = null) {
1961
+ const foot = el("div", "foot");
1962
+ const badge = el("span", "badge");
1963
+ const meta = el("div", "meta");
1964
+ const hints = new Map;
1965
+ const hintKeys = new Map;
1966
+ for (const chip of keyChips(keys.get(), grab !== null, mac, inspect !== null)) {
1967
+ const node = button("hint", "");
1968
+ node.dataset.command = chip.command;
1969
+ const key = el("kbd", "hint-key", chip.key);
1970
+ node.append(key, chip.word);
1971
+ meta.append(node);
1972
+ hints.set(chip.command, node);
1973
+ hintKeys.set(chip.command, key);
1974
+ }
1975
+ const pin = iconHint("pin-toggle", pinWord(false));
1976
+ let pinShown = null;
1977
+ const sided = (name) => {
1978
+ const glyph2 = icon(name, 12);
1979
+ glyph2.setAttribute("class", "glyph sided");
1980
+ return glyph2;
1981
+ };
1982
+ const flip = iconHint("flip-toggle", SIDE_WORD, sided("panel-left"));
1983
+ const collapse = iconHint("collapse-toggle", COLLAPSE_WORD, sided("panel-right-close"));
1984
+ const keysToggle = iconHint("keys-toggle", "settings", icon("settings", 12));
1985
+ meta.append(flip, collapse, pin, keysToggle);
1986
+ function drawPin(docked) {
1987
+ if (docked === pinShown)
1988
+ return;
1989
+ pinShown = docked;
1990
+ flip.hidden = !docked;
1991
+ collapse.hidden = !docked;
1992
+ pin.replaceChildren(icon(docked ? "pin-off" : "pin", 12));
1993
+ pin.setAttribute("aria-label", pinWord(docked));
1994
+ pin.setAttribute("aria-pressed", docked ? "true" : "false");
1995
+ }
1996
+ drawPin(false);
1997
+ foot.append(badge);
1998
+ if (fresh())
1999
+ foot.append(el("span", "fresh-note", FRESH_NOTE));
2000
+ if (runtime)
2001
+ foot.append(el("span", "runtime", runtime));
2002
+ foot.append(meta);
2003
+ return {
2004
+ foot,
2005
+ badge,
2006
+ hints,
2007
+ pin,
2008
+ flip,
2009
+ collapse,
2010
+ keysToggle,
2011
+ drawPin,
2012
+ drawKeys(now2) {
2013
+ for (const chip of keyChips(now2, grab !== null, mac, inspect !== null)) {
2014
+ const key = hintKeys.get(chip.command);
2015
+ if (key)
2016
+ key.textContent = chip.key;
2017
+ }
2018
+ }
2019
+ };
2020
+ }
2021
+
1858
2022
  // src/ui/list.ts
1859
2023
  function rowOrder(state) {
1860
2024
  const ids = ROWS.map((row) => row.id);
@@ -2260,8 +2424,8 @@ function createDrag(context) {
2260
2424
  if (wrap.dataset.side !== side) {
2261
2425
  jump(() => {
2262
2426
  wrap.dataset.side = side;
2263
- host.style.left = side === "left" ? "0" : "";
2264
- host.style.right = side === "right" ? "0" : "";
2427
+ host.style.left = side === "left" ? "0" : "auto";
2428
+ host.style.right = side === "right" ? "0" : "auto";
2265
2429
  });
2266
2430
  }
2267
2431
  if (getState().panel.docked) {
@@ -2503,96 +2667,6 @@ function createDrag(context) {
2503
2667
  };
2504
2668
  }
2505
2669
 
2506
- // src/ui/footer.ts
2507
- var FRESH_NOTE = "fresh mode: nothing is kept";
2508
- function overflowBadge(on, count) {
2509
- return on && count !== null ? `${count} overflowing` : "";
2510
- }
2511
- function keyLabel(combo, mac) {
2512
- return combo ? comboLabel(combo, mac) : "";
2513
- }
2514
- function keyChips(keys, grab, mac, inspect = false) {
2515
- const chips = [
2516
- { command: "panel", key: comboLabel(keys.panel, mac), word: BINDING_WORDS.panel },
2517
- { command: "search", key: "/", word: "search" }
2518
- ];
2519
- if (grab) {
2520
- chips.push({ command: "grab", key: keyLabel(keys.grab, mac), word: BINDING_WORDS.grab });
2521
- }
2522
- if (inspect) {
2523
- const key = keyLabel(keys.inspect, mac);
2524
- chips.push({ command: "inspect", key, word: BINDING_WORDS.inspect });
2525
- }
2526
- chips.push({ command: "replay", key: keyLabel(keys.replay, mac), word: BINDING_WORDS.replay }, { command: "reset", key: keyLabel(keys.reset, mac), word: BINDING_WORDS.reset });
2527
- return chips;
2528
- }
2529
- function iconHint(className, label2, glyph2) {
2530
- const node = button(`hint ${className}`, "");
2531
- if (glyph2)
2532
- node.append(glyph2);
2533
- node.setAttribute("aria-label", label2);
2534
- return node;
2535
- }
2536
- function createFooter(keys, grab, mac, inspect = null) {
2537
- const foot = el("div", "foot");
2538
- const badge = el("span", "badge");
2539
- const meta = el("div", "meta");
2540
- const hints = new Map;
2541
- const hintKeys = new Map;
2542
- for (const chip of keyChips(keys.get(), grab !== null, mac, inspect !== null)) {
2543
- const node = button("hint", "");
2544
- node.dataset.command = chip.command;
2545
- const key = el("kbd", "hint-key", chip.key);
2546
- node.append(key, chip.word);
2547
- meta.append(node);
2548
- hints.set(chip.command, node);
2549
- hintKeys.set(chip.command, key);
2550
- }
2551
- const pin = iconHint("pin-toggle", pinWord(false));
2552
- let pinShown = null;
2553
- const sided = (name) => {
2554
- const glyph2 = icon(name, 12);
2555
- glyph2.setAttribute("class", "glyph sided");
2556
- return glyph2;
2557
- };
2558
- const flip = iconHint("flip-toggle", SIDE_WORD, sided("panel-left"));
2559
- const collapse = iconHint("collapse-toggle", COLLAPSE_WORD, sided("panel-right-close"));
2560
- const keysToggle = iconHint("keys-toggle", "settings", icon("settings", 12));
2561
- meta.append(flip, collapse, pin, keysToggle);
2562
- function drawPin(docked) {
2563
- if (docked === pinShown)
2564
- return;
2565
- pinShown = docked;
2566
- flip.hidden = !docked;
2567
- collapse.hidden = !docked;
2568
- pin.replaceChildren(icon(docked ? "pin-off" : "pin", 12));
2569
- pin.setAttribute("aria-label", pinWord(docked));
2570
- pin.setAttribute("aria-pressed", docked ? "true" : "false");
2571
- }
2572
- drawPin(false);
2573
- foot.append(badge);
2574
- if (fresh())
2575
- foot.append(el("span", "fresh-note", FRESH_NOTE));
2576
- foot.append(meta);
2577
- return {
2578
- foot,
2579
- badge,
2580
- hints,
2581
- pin,
2582
- flip,
2583
- collapse,
2584
- keysToggle,
2585
- drawPin,
2586
- drawKeys(now2) {
2587
- for (const chip of keyChips(now2, grab !== null, mac, inspect !== null)) {
2588
- const key = hintKeys.get(chip.command);
2589
- if (key)
2590
- key.textContent = chip.key;
2591
- }
2592
- }
2593
- };
2594
- }
2595
-
2596
2670
  // src/ui/inspector.ts
2597
2671
  var STYLES_VIEW = "styles";
2598
2672
  var SELECT = "select an element";
@@ -2600,7 +2674,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
2600
2674
  function here(element) {
2601
2675
  return element.isConnected && element.ownerDocument.defaultView !== null;
2602
2676
  }
2603
- function createInspector(context, load = () => import("./elementsview-tf4qzmtw.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2677
+ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2604
2678
  const { inspect, tips, prefs } = context;
2605
2679
  const listeners = new Set;
2606
2680
  let view = null;
@@ -6563,6 +6637,7 @@ var HANDLE_HINT = 4000;
6563
6637
  function handleHint(keys, mac) {
6564
6638
  return `press ${comboLabel(keys.panel, mac)} to open knobs`;
6565
6639
  }
6640
+ var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
6566
6641
  function createSettings(context) {
6567
6642
  const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
6568
6643
  const keysView = el("div", "keys pane");
@@ -6606,6 +6681,56 @@ function createSettings(context) {
6606
6681
  keysView.append(row);
6607
6682
  nativeSwitch2.addEventListener("click", () => context.setNative(nativeSwitch2.getAttribute("aria-checked") !== "true"));
6608
6683
  }
6684
+ const prefer = context.prefer;
6685
+ const preferChoice = segments({
6686
+ options: [
6687
+ { value: "extension", label: "extension" },
6688
+ { value: "page", label: "page" }
6689
+ ],
6690
+ label: "prefer",
6691
+ onChange: (value) => context.setPrefer(value === "page" ? "page" : "extension")
6692
+ });
6693
+ if (prefer) {
6694
+ preferChoice.node.classList.add("row-control");
6695
+ const hint = el("div", "row-hint", PREFER_HINT);
6696
+ hint.id = "devknobs-prefer-hint";
6697
+ preferChoice.node.setAttribute("aria-describedby", hint.id);
6698
+ const row = rowBox({
6699
+ main: el("div", "main"),
6700
+ glyph: icon("chevrons-left-right"),
6701
+ title: "prefer",
6702
+ ends: [preferChoice.node]
6703
+ }).box;
6704
+ row.append(hint);
6705
+ keysView.append(row);
6706
+ }
6707
+ const realPhoneSwitch = button("switch row-control", "");
6708
+ if (context.realPhone) {
6709
+ realPhoneSwitch.setAttribute("role", "switch");
6710
+ realPhoneSwitch.setAttribute("aria-label", "real phone mode");
6711
+ const hint = el("div", "row-hint", REAL_PHONE_HINT);
6712
+ hint.id = "devknobs-real-phone-hint";
6713
+ realPhoneSwitch.setAttribute("aria-describedby", hint.id);
6714
+ const row = rowBox({
6715
+ main: el("div", "main"),
6716
+ glyph: icon("smartphone"),
6717
+ title: "real phone mode",
6718
+ ends: [realPhoneSwitch]
6719
+ }).box;
6720
+ row.append(hint);
6721
+ keysView.append(row);
6722
+ realPhoneSwitch.addEventListener("click", () => context.setRealPhone(realPhoneSwitch.getAttribute("aria-checked") !== "true"));
6723
+ }
6724
+ const devIconSwitch = button("switch row-control", "");
6725
+ devIconSwitch.setAttribute("role", "switch");
6726
+ devIconSwitch.setAttribute("aria-label", "dev tab icon");
6727
+ keysView.append(rowBox({
6728
+ main: el("div", "main"),
6729
+ glyph: icon("image"),
6730
+ title: "dev tab icon",
6731
+ ends: [devIconSwitch]
6732
+ }).box);
6733
+ devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
6609
6734
  keysView.append(rowsLabel("shortcuts"));
6610
6735
  const keyViews = new Map;
6611
6736
  for (const binding of bindingsHere) {
@@ -6737,6 +6862,12 @@ function createSettings(context) {
6737
6862
  drawHandle(shown2) {
6738
6863
  mark(handleSwitch, shown2, "aria-checked");
6739
6864
  },
6865
+ drawDevIcon(shown2) {
6866
+ mark(devIconSwitch, shown2, "aria-checked");
6867
+ },
6868
+ drawRealPhone(on) {
6869
+ mark(realPhoneSwitch, on, "aria-checked");
6870
+ },
6740
6871
  drawNative(on, note) {
6741
6872
  mark(nativeSwitch2, on, "aria-checked");
6742
6873
  const hint = note ?? native?.hint ?? "";
@@ -6746,6 +6877,10 @@ function createSettings(context) {
6746
6877
  if (note)
6747
6878
  said.textContent = note;
6748
6879
  },
6880
+ drawPrefer() {
6881
+ if (prefer)
6882
+ preferChoice.set(prefer.value());
6883
+ },
6749
6884
  recordingKey(event) {
6750
6885
  if (recording === null)
6751
6886
  return false;
@@ -7635,6 +7770,8 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7635
7770
  .badge.hot { color: var(--hot); }
7636
7771
  /* Says fresh mode is on, as quiet as the key hints under it. */
7637
7772
  .fresh-note { font-size: 10px; line-height: 1.4; color: var(--faint); }
7773
+ /* Which copy runs the panel, as quiet. */
7774
+ .runtime { font-size: 10px; line-height: 1.4; color: var(--faint); font-variant-numeric: tabular-nums; }
7638
7775
  /* The key hints, each a button for what its key does. Where they leave no
7639
7776
  room, the line wraps. */
7640
7777
  .meta {
@@ -7720,6 +7857,8 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7720
7857
  takes no height of its own, so the row is as tall as any. */
7721
7858
  .main > .row-button { align-self: center; margin: -2px 0 -2px auto; }
7722
7859
  .main > .row-button:not([hidden]) + .row-control { margin-left: 0; }
7860
+ /* Segments at a row's end, as the settings' choice of who runs the panel, take no more height than its title. */
7861
+ .main > .seg.row-control { margin-top: -3px; margin-bottom: -3px; }
7723
7862
  /* The panel's icons face the side the panel is on. */
7724
7863
  .wrap[data-side="left"] .glyph.sided { transform: scaleX(-1); }
7725
7864
  .key-set {
@@ -7766,11 +7905,17 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7766
7905
  its slots, and starts where the view's layout says. Its body under that scrolls on its own. The view asks for the panel's tallest and the panel's
7767
7906
  own limit shrinks it to what the window has, so the panel is as tall as it
7768
7907
  gets whatever the view holds. The body is a container, so what a view
7769
- holds can lay itself out by how wide the view is. */
7908
+ holds can lay itself out by how wide the view is. A view takes the
7909
+ window's whole height, past the limit a list keeps. */
7910
+ .wrap[data-mode="view"] .panel {
7911
+ max-height: calc(100vh - 16px);
7912
+ max-height: calc(100dvh - 16px);
7913
+ }
7770
7914
  .view {
7771
7915
  flex: 0 1 auto;
7772
7916
  min-height: 0;
7773
- height: 672px;
7917
+ height: 100vh;
7918
+ height: 100dvh;
7774
7919
  display: flex;
7775
7920
  flex-direction: column;
7776
7921
  gap: 4px;
@@ -8124,9 +8269,13 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8124
8269
  as deep lines do in the browser's tools. The selected line has a ground of
8125
8270
  its own, a blue one while the tree has the focus, and ends with a quiet
8126
8271
  reference to it. A node that changed lights for a moment. */
8127
- .elements { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
8272
+ /* The tree takes what the styles leave of the view, and keeps the height its
8273
+ edge was dragged to once it was. */
8274
+ .elements { display: flex; flex-direction: column; min-height: 100%; gap: 4px; }
8275
+ .elements > * { min-width: 0; }
8128
8276
  .dom {
8129
8277
  position: relative;
8278
+ flex: 1 0 auto;
8130
8279
  height: 40vh;
8131
8280
  min-height: 96px;
8132
8281
  max-height: 85vh;
@@ -8136,6 +8285,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8136
8285
  scrollbar-width: thin;
8137
8286
  scrollbar-color: var(--line) transparent;
8138
8287
  }
8288
+ .dom[style*="height"] { flex-grow: 0; }
8139
8289
  .dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
8140
8290
  .dom-row {
8141
8291
  display: flex;
@@ -8578,7 +8728,7 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
8578
8728
  `;
8579
8729
 
8580
8730
  // src/ui/panel.ts
8581
- var HOST_STYLE = "position:fixed;top:0;z-index:2147483646;pointer-events:none";
8731
+ var HOST_STYLE = "position:fixed;top:0;right:auto;bottom:auto;left:auto;width:auto;height:auto;z-index:2147483647;pointer-events:none";
8582
8732
  function ownCss(media) {
8583
8733
  const settle2 = (_whole, query) => {
8584
8734
  const scheme = rewriteMediaText(query.trim(), "prefers-color-scheme", media.scheme);
@@ -8616,6 +8766,7 @@ function createPanel(options2 = {}) {
8616
8766
  host.setAttribute("data-devknobs", "panel");
8617
8767
  host.style.cssText = HOST_STYLE;
8618
8768
  const root = host.attachShadow({ mode: "open" });
8769
+ addStyle(root, HOST_RESET);
8619
8770
  const style = addStyle(root, "");
8620
8771
  const stopSystem = watchSystemMedia((media) => {
8621
8772
  style.textContent = media ? ownCss(media) : CSS;
@@ -8657,7 +8808,7 @@ function createPanel(options2 = {}) {
8657
8808
  const home = el("div", "home pane");
8658
8809
  lay(home, "rows");
8659
8810
  home.append(rows, empty, add, head, results);
8660
- const footer = createFooter(keys, grab, mac, inspect);
8811
+ const footer = createFooter(keys, grab, mac, inspect, options2.prefer?.runtime ?? null);
8661
8812
  const { foot, badge, hints, keysToggle, pin, collapse } = footer;
8662
8813
  const tip = el("div", "tip");
8663
8814
  tip.setAttribute("aria-hidden", "true");
@@ -8682,11 +8833,17 @@ function createPanel(options2 = {}) {
8682
8833
  renderKeys,
8683
8834
  handleShown: handleShows,
8684
8835
  showHandle: () => setState({ panel: { handle: true } }),
8836
+ devIconShown: () => devIconShown(getState().panel.devIcon, window.location.hostname),
8837
+ setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
8838
+ realPhone: hostSendsUa(),
8839
+ setRealPhone: (on) => setState({ panel: { realPhone: on } }),
8685
8840
  native: nativeSwitch()?.setting ?? null,
8686
8841
  setNative: (on) => {
8687
8842
  nativeSwitch()?.setting.change(on);
8688
8843
  setNative(on, null);
8689
8844
  },
8845
+ prefer: options2.prefer ?? null,
8846
+ setPrefer: (value) => options2.prefer?.change(value),
8690
8847
  searching: () => palette.searching(),
8691
8848
  leaveSearch: () => palette.leaveSearch()
8692
8849
  });
@@ -8780,9 +8937,12 @@ function createPanel(options2 = {}) {
8780
8937
  const handleShown = handleShows();
8781
8938
  wrap.dataset.handle = handleShown ? "shown" : "hidden";
8782
8939
  settings.drawHandle(handleShown);
8940
+ settings.drawDevIcon(devIconShown(state.panel.devIcon, window.location.hostname));
8941
+ settings.drawRealPhone(state.panel.realPhone);
8783
8942
  const nativeNow = nativeSwitch();
8784
8943
  if (nativeNow)
8785
8944
  settings.drawNative(nativeNow.on, nativeNow.note);
8945
+ settings.drawPrefer();
8786
8946
  dockSlide.aim({
8787
8947
  docked: state.panel.docked,
8788
8948
  side: state.panel.side,
@@ -9031,16 +9191,20 @@ function createPanel(options2 = {}) {
9031
9191
  const resizes = new ResizeObserver(() => layout());
9032
9192
  resizes.observe(panel);
9033
9193
  function attach() {
9034
- if (document.body && host.parentNode !== document.body)
9035
- document.body.append(host);
9194
+ if (!document.body || host.parentNode === document.body)
9195
+ return;
9196
+ document.body.append(host);
9197
+ hold.raise();
9036
9198
  }
9037
9199
  render();
9038
9200
  (document.body ?? document.documentElement).append(host);
9201
+ const hold = holdInTopLayer(host, LAYER.panel);
9039
9202
  if (!document.body)
9040
9203
  document.addEventListener("DOMContentLoaded", attach, { once: true });
9041
- const stopKeeping = keepMounted(host);
9204
+ const stopKeeping = keepMounted(host, { restored: () => hold.raise() });
9042
9205
  layout("edge");
9043
9206
  return {
9207
+ drawPrefer: () => settings.drawPrefer(),
9044
9208
  destroy() {
9045
9209
  settings.stopRecording();
9046
9210
  unsubscribe();
@@ -9088,10 +9252,14 @@ function createPanel(options2 = {}) {
9088
9252
  dockSlide.destroy();
9089
9253
  document.removeEventListener("DOMContentLoaded", attach);
9090
9254
  stopKeeping();
9255
+ hold.release();
9091
9256
  host.remove();
9092
9257
  }
9093
9258
  };
9094
9259
  }
9260
+
9261
+ // src/version.ts
9262
+ var VERSION = "0.5.3";
9095
9263
  // src/index.ts
9096
9264
  var panel = null;
9097
9265
  var stopKeys = null;
@@ -9102,18 +9270,40 @@ var mounted = null;
9102
9270
  var hostedBy = null;
9103
9271
  var RETAKES = 3;
9104
9272
  var retaken = 0;
9273
+ var preferNow = null;
9274
+ var waiting = null;
9275
+ var deferred = null;
9276
+ var handedPrefer = null;
9277
+ var beaten = null;
9105
9278
  function mount(options2 = {}) {
9106
9279
  if (panel || stopKeys)
9107
9280
  return;
9108
9281
  const host = options2.host ? null : hostOf(window);
9109
9282
  if (host) {
9283
+ handedPrefer = null;
9110
9284
  hostedBy = host;
9111
- host.adopt(options2);
9285
+ deferred = options2;
9286
+ const take = Object.assign((handed) => takeFrom(options2, handed), {
9287
+ pending: () => deferred === options2 && !panel && !stopKeys
9288
+ });
9289
+ host.adopt(options2, take);
9112
9290
  return;
9113
9291
  }
9292
+ if (options2.host && options2.build) {
9293
+ const holder = hostOf(window);
9294
+ if (holder && !beats(options2.build, holder)) {
9295
+ standDown(options2, holder);
9296
+ return;
9297
+ }
9298
+ if (holder)
9299
+ beaten = { other: rankOf(holder) };
9300
+ }
9301
+ preferNow = options2.host ? options2.prefer?.value ?? null : null;
9302
+ if (!options2.host && !options2.prefer && handedPrefer)
9303
+ options2 = { ...options2, prefer: handedPrefer };
9114
9304
  applyOnLoad();
9115
9305
  if (options2.host)
9116
- claim(window, unmount, adopt, api);
9306
+ claim(window, unmount, adopt, api, options2.build ? { rank: rankFor(options2.build), outranked } : {});
9117
9307
  else
9118
9308
  claim(window, unmount);
9119
9309
  expose(window, api);
@@ -9140,7 +9330,57 @@ function attach(options2) {
9140
9330
  return;
9141
9331
  }
9142
9332
  choose(options2);
9143
- panel = createPanel({ keys: live, grab: grabControl, inspect, handle: options2.handle });
9333
+ panel = createPanel({
9334
+ keys: live,
9335
+ grab: grabControl,
9336
+ inspect,
9337
+ handle: options2.handle,
9338
+ prefer: panelPrefer(options2)
9339
+ });
9340
+ }
9341
+ function panelPrefer(options2) {
9342
+ const setting = options2.prefer;
9343
+ if (!setting)
9344
+ return;
9345
+ return {
9346
+ value: () => preferNow ?? setting.now?.() ?? setting.value,
9347
+ change: (value) => {
9348
+ setting.change(value);
9349
+ setPrefer(value);
9350
+ },
9351
+ runtime: [runtimeLabel(options2.host === true, VERSION), ...options2.host && beaten ? [stoodDownNote(beaten.other)] : []].join(" · ")
9352
+ };
9353
+ }
9354
+ function rankFor(build) {
9355
+ return { build, version: VERSION };
9356
+ }
9357
+ function beats(build, holder) {
9358
+ const theirs = rankOf(holder);
9359
+ if (!theirs && holder.rank !== undefined)
9360
+ return false;
9361
+ return outranks(rankFor(build), theirs);
9362
+ }
9363
+ function standDown(options2, holder) {
9364
+ options2.stoodDown?.();
9365
+ if (options2.build)
9366
+ holder.outranked?.(rankFor(options2.build));
9367
+ }
9368
+ function outranked(other) {
9369
+ beaten = { other: rankOf({ rank: other }) };
9370
+ if (!mounted || !panel)
9371
+ return;
9372
+ detach();
9373
+ attach(mounted);
9374
+ }
9375
+ function takeFrom(options2, handed) {
9376
+ if (deferred !== options2 || panel || stopKeys || hostOf(window))
9377
+ return false;
9378
+ deferred = null;
9379
+ hostedBy = null;
9380
+ const prefer = preferOf(handed);
9381
+ handedPrefer = prefer;
9382
+ mount(prefer ? { ...options2, prefer } : options2);
9383
+ return true;
9144
9384
  }
9145
9385
  function choose(options2) {
9146
9386
  if (options2.open !== undefined)
@@ -9160,9 +9400,15 @@ function detach() {
9160
9400
  keys?.destroy();
9161
9401
  keys = null;
9162
9402
  }
9163
- function adopt(options2) {
9403
+ function adopt(options2, take) {
9164
9404
  if (!mounted)
9165
9405
  return;
9406
+ if (typeof take === "function")
9407
+ waiting = take;
9408
+ if (stepsAside(preferNow, waiting)) {
9409
+ handOver();
9410
+ return;
9411
+ }
9166
9412
  const chosen = pageChoices(options2);
9167
9413
  const rebuild = ["hotkey", "grabKey", "grab"].some((key) => chosen[key] !== undefined && chosen[key] !== mounted?.[key]);
9168
9414
  mounted = { ...mounted, ...chosen };
@@ -9174,8 +9420,42 @@ function adopt(options2) {
9174
9420
  detach();
9175
9421
  attach(mounted);
9176
9422
  }
9423
+ function handOver() {
9424
+ const take = waiting;
9425
+ const options2 = mounted;
9426
+ if (!take || !options2?.host)
9427
+ return;
9428
+ const pending = Reflect.get(take, "pending");
9429
+ if (typeof pending === "function" && Reflect.apply(pending, take, []) !== true) {
9430
+ waiting = null;
9431
+ return;
9432
+ }
9433
+ const native = nativeSwitch();
9434
+ unmount();
9435
+ const prefer = options2.prefer;
9436
+ let took = false;
9437
+ try {
9438
+ took = take(prefer ? { prefer: { value: "page", change: prefer.change, now: prefer.now } } : {}) === true;
9439
+ } catch {}
9440
+ if (took)
9441
+ return;
9442
+ if (native && !native.on)
9443
+ setNative(false, native.note);
9444
+ mount(current(options2));
9445
+ }
9446
+ function current(options2) {
9447
+ return options2.prefer && preferNow ? { ...options2, prefer: { ...options2.prefer, value: preferNow } } : options2;
9448
+ }
9449
+ function setPrefer(value) {
9450
+ preferNow = value;
9451
+ panel?.drawPrefer();
9452
+ if (mounted?.host && stepsAside(value, waiting))
9453
+ handOver();
9454
+ }
9177
9455
  function unmount() {
9178
9456
  hostedBy = null;
9457
+ deferred = null;
9458
+ waiting = null;
9179
9459
  if (superseded(window, unmount))
9180
9460
  return;
9181
9461
  detach();
@@ -9189,8 +9469,25 @@ function unmount() {
9189
9469
  queueMicrotask(() => retake(was, native));
9190
9470
  }
9191
9471
  function retake(options2, native) {
9192
- if (mounted || !owned(window) || hostOf(window))
9472
+ if (mounted || !owned(window))
9473
+ return;
9474
+ const holder = hostOf(window);
9475
+ if (holder) {
9476
+ if (!options2.build)
9477
+ return;
9478
+ if (!beats(options2.build, holder)) {
9479
+ standDown(options2, holder);
9480
+ return;
9481
+ }
9482
+ if (native && !native.on)
9483
+ setNative(false, native.note);
9484
+ mount(current(options2));
9485
+ return;
9486
+ }
9487
+ if (!takesBack(preferNow)) {
9488
+ options2.prefer?.yielded?.();
9193
9489
  return;
9490
+ }
9194
9491
  if (retaken++ >= RETAKES) {
9195
9492
  if (retaken === RETAKES + 1) {
9196
9493
  console.warn("devknobs: this page runs its own copy of devknobs, which does not know hosts; it keeps the page");
@@ -9199,7 +9496,7 @@ function retake(options2, native) {
9199
9496
  }
9200
9497
  if (native && !native.on)
9201
9498
  setNative(false, native.note);
9202
- mount(options2);
9499
+ mount(current(options2));
9203
9500
  }
9204
9501
  function hosted(name) {
9205
9502
  if (!hostedBy)
@@ -9236,7 +9533,7 @@ async function grab(elements, options2) {
9236
9533
  const host = hosted("grab");
9237
9534
  if (host)
9238
9535
  return host(elements, options2);
9239
- const loaded = await import("./index-ke6v7919.js");
9536
+ const loaded = await import("./index-sn2y6j09.js");
9240
9537
  return loaded.grab(elements, options2);
9241
9538
  }
9242
9539
  var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2 };