@vinena/knobs 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +7 -0
  3. package/dist/early.global.js +6 -6
  4. package/dist/{elementsview-6g274ptr.js → elementsview-2z4pkrdz.js} +4 -4
  5. package/dist/{elementsview-pkzp9kc6.js → elementsview-qn8qyksa.js} +4 -4
  6. package/dist/engine/browserdraw.d.ts +24 -2
  7. package/dist/engine/browserkit.d.ts +18 -1
  8. package/dist/engine/browserui.d.ts +162 -22
  9. package/dist/engine/devicon.d.ts +59 -0
  10. package/dist/engine/fit.d.ts +4 -3
  11. package/dist/engine/foldflip.d.ts +40 -0
  12. package/dist/engine/identity.d.ts +7 -4
  13. package/dist/engine/mock.d.ts +16 -0
  14. package/dist/engine/mockdata.d.ts +4 -1
  15. package/dist/engine/mockdraw.d.ts +14 -2
  16. package/dist/engine/pageshot.d.ts +5 -2
  17. package/dist/engine/safaridraw.d.ts +162 -10
  18. package/dist/engine/screen.d.ts +24 -0
  19. package/dist/engine/store.d.ts +2 -1
  20. package/dist/engine/tabicon.d.ts +43 -0
  21. package/dist/engine/toplayer.d.ts +62 -0
  22. package/dist/engine/touchpointer.d.ts +0 -21
  23. package/dist/engine/underbar.d.ts +61 -0
  24. package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
  25. package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
  26. package/dist/host.d.ts +51 -0
  27. package/dist/{index-64rd634h.js → index-30fc6php.js} +1 -1
  28. package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
  29. package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
  30. package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
  31. package/dist/{index-kzsb9drs.js → index-hv02xka3.js} +20 -8
  32. package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
  33. package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
  34. package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
  35. package/dist/{index-5d6qzte3.js → index-trx7bxdk.js} +4 -4
  36. package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
  37. package/dist/index.d.ts +26 -1
  38. package/dist/index.global.js +270 -176
  39. package/dist/index.js +398 -124
  40. package/dist/instance.d.ts +23 -4
  41. package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
  42. package/dist/{react-4kbj1t4h.js → react-16spgn0h.js} +1 -1
  43. package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
  44. package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
  45. package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
  46. package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
  47. package/dist/{react-mv9y20jy.js → react-sw8d8c94.js} +4 -4
  48. package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
  49. package/dist/react.js +394 -123
  50. package/dist/{storageview-vdkbp6rt.js → storageview-r595qpt9.js} +4 -4
  51. package/dist/{storageview-j9d44f99.js → storageview-s7heg93p.js} +4 -4
  52. package/dist/types.d.ts +7 -0
  53. package/dist/ui/footer.d.ts +9 -2
  54. package/dist/ui/panel.d.ts +16 -2
  55. package/dist/ui/settings.d.ts +17 -1
  56. package/dist/version.d.ts +2 -0
  57. package/package.json +3 -2
  58. package/skills/devknobs/SKILL.md +1 -1
  59. package/dist/elementsview-jnkbhzkj.js +0 -2873
  60. package/dist/elementsview-tf4qzmtw.js +0 -2874
  61. package/dist/engine/endroom.d.ts +0 -21
  62. package/dist/framekit-095qevka.js +0 -8838
  63. package/dist/framekit-q5aad770.js +0 -8839
  64. package/dist/index-hw56t3zy.js +0 -4800
  65. package/dist/index-k015tb6c.js +0 -357
  66. package/dist/index-ke6v7919.js +0 -4801
  67. package/dist/index-qxye1j73.js +0 -528
  68. package/dist/index-z5ytnj01.js +0 -4563
  69. package/dist/index-zvze25nf.js +0 -686
  70. package/dist/react-eygws6cx.js +0 -358
  71. package/dist/react-sq9pkw4k.js +0 -687
  72. package/dist/react-vjm88w4t.js +0 -4564
  73. package/dist/react-znfrjqk8.js +0 -529
  74. package/dist/storageview-sb23henh.js +0 -2729
  75. package/dist/storageview-vf8v8q8j.js +0 -2728
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-exjcpxma.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-zy1mmhgz.js";
22
22
  import {
23
23
  hushOnce
24
- } from "./react-65tgdbs8.js";
24
+ } from "./react-4pvp6amm.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-sw8d8c94.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-16spgn0h.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,6 +97,7 @@ import {
93
97
  getState,
94
98
  glyph,
95
99
  highlightAt,
100
+ holdInTopLayer,
96
101
  holdingHinge,
97
102
  icon,
98
103
  isFunctionKey,
@@ -128,7 +133,7 @@ import {
128
133
  watchPanel,
129
134
  zoomAction,
130
135
  zoomKey
131
- } from "./react-qv0nykcv.js";
136
+ } from "./react-ayg1bgw3.js";
132
137
  import {
133
138
  BARS,
134
139
  BROWSERS,
@@ -141,6 +146,7 @@ import {
141
146
  DEFAULT_PINNED,
142
147
  DEFAULT_STATE,
143
148
  DEVICES,
149
+ DEV_ICONS,
144
150
  DIRS,
145
151
  DPR_MAX,
146
152
  DPR_MIN,
@@ -197,6 +203,7 @@ import {
197
203
  realNow,
198
204
  resolveGeo,
199
205
  rewriteMediaText,
206
+ runsUnderBars,
200
207
  stamped,
201
208
  still,
202
209
  toHex,
@@ -204,7 +211,7 @@ import {
204
211
  userAgentOf,
205
212
  watchSystemMedia,
206
213
  webStorage
207
- } from "./react-carf84xv.js";
214
+ } from "./react-fm9y8dbn.js";
208
215
 
209
216
  // src/react.tsx
210
217
  import { useEffect, useRef } from "react";
@@ -809,6 +816,9 @@ var BARS2 = {
809
816
  function safariShown(state) {
810
817
  return platformOf(screenNow(state)) === "safari" && barsShown(state);
811
818
  }
819
+ function safariSideways(state) {
820
+ return safariShown(state) && state.orientation === "landscape" && runsUnderBars(screenNow(state));
821
+ }
812
822
  var EDGE_TO_EDGE = {
813
823
  id: "edgeToEdge",
814
824
  label: "edge to edge",
@@ -816,11 +826,11 @@ var EDGE_TO_EDGE = {
816
826
  control: "switch",
817
827
  options: OFF_ON,
818
828
  aliases: ["edge", "under bars", "true height", "full height"],
819
- read: (state) => flag(state.edgeToEdge && safariShown(state)),
829
+ read: (state) => flag(state.edgeToEdge && safariSideways(state)),
820
830
  write: (value) => ({ edgeToEdge: value === "on" }),
821
831
  reset: { edgeToEdge: DEFAULT_STATE.edgeToEdge },
822
832
  brief: () => "",
823
- offers: (state) => safariShown(state) ? ["off", "on"] : []
833
+ offers: (state) => safariSideways(state) ? ["off", "on"] : []
824
834
  };
825
835
  var WIDTH = {
826
836
  id: "width",
@@ -1415,7 +1425,7 @@ function knobs() {
1415
1425
  touchPointer: spec("On a touch device, the mouse acts as a finger in its frame.", flag2),
1416
1426
  browser: spec("Where a phone's browser keeps its bars, or off.", oneOf(BROWSERS)),
1417
1427
  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),
1428
+ 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
1429
  frame: spec("Render the page in a full-width frame even at full width.", flag2, "frame"),
1420
1430
  dpr: spec("Device pixel ratio inside the frame.", { type: "number", min: DPR_MIN, max: DPR_MAX, or: ["system"] }, "frame"),
1421
1431
  zoom: spec("How big the frame is drawn. The page sees the same viewport.", {
@@ -1444,7 +1454,8 @@ function knobs() {
1444
1454
  fields: {
1445
1455
  open: field2("The panel is open.", flag2),
1446
1456
  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)
1457
+ 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
+ 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))
1448
1459
  }
1449
1460
  }, "frame")
1450
1461
  };
@@ -1456,8 +1467,8 @@ function describe() {
1456
1467
  }
1457
1468
  function defaultOf(key) {
1458
1469
  if (key === "panel") {
1459
- const { open, docked, handle } = DEFAULT_STATE.panel;
1460
- return { open, docked, handle };
1470
+ const { open, docked, handle, devIcon } = DEFAULT_STATE.panel;
1471
+ return { open, docked, handle, devIcon };
1461
1472
  }
1462
1473
  if (key === "clock") {
1463
1474
  const { mode, at, speed, header } = DEFAULT_STATE.clock;
@@ -1582,6 +1593,62 @@ function pageChoices(options2) {
1582
1593
  }
1583
1594
  return chosen;
1584
1595
  }
1596
+ 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";
1597
+ function preferOf(handed) {
1598
+ const prefer = Reflect.get(handed, "prefer");
1599
+ if (typeof prefer !== "object" || prefer === null)
1600
+ return null;
1601
+ const value = Reflect.get(prefer, "value");
1602
+ const change = Reflect.get(prefer, "change");
1603
+ if (value !== "extension" && value !== "page" || typeof change !== "function")
1604
+ return null;
1605
+ const now2 = Reflect.get(prefer, "now");
1606
+ return {
1607
+ value,
1608
+ change: (next) => void Reflect.apply(change, prefer, [next]),
1609
+ ...typeof now2 === "function" ? {
1610
+ now: () => {
1611
+ const current = Reflect.apply(now2, prefer, []);
1612
+ return current === "extension" ? "extension" : "page";
1613
+ }
1614
+ } : {}
1615
+ };
1616
+ }
1617
+ function stepsAside(prefer, take) {
1618
+ return prefer === "page" && typeof take === "function";
1619
+ }
1620
+ function takesBack(prefer) {
1621
+ return prefer !== "page";
1622
+ }
1623
+ function rankOf(host) {
1624
+ const rank = Reflect.get(host, "rank");
1625
+ if (typeof rank !== "object" || rank === null)
1626
+ return null;
1627
+ const build = Reflect.get(rank, "build");
1628
+ const version = Reflect.get(rank, "version");
1629
+ if (build !== "store" && build !== "local" || typeof version !== "string")
1630
+ return null;
1631
+ return { build, version };
1632
+ }
1633
+ function numbers(version) {
1634
+ const found = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
1635
+ return found ? found.slice(1).map(Number) : [0, 0, 0];
1636
+ }
1637
+ function outranks(a, b) {
1638
+ if (!b)
1639
+ return true;
1640
+ if (a.build !== b.build)
1641
+ return a.build === "local";
1642
+ const [x, y] = [numbers(a.version), numbers(b.version)];
1643
+ for (let index = 0;index < 3; index++) {
1644
+ if (x[index] !== y[index])
1645
+ return (x[index] ?? 0) > (y[index] ?? 0);
1646
+ }
1647
+ return a.version > b.version;
1648
+ }
1649
+ function stoodDownNote(other) {
1650
+ return `${other?.build ?? "older"} extension stood down`;
1651
+ }
1585
1652
 
1586
1653
  // src/instance.ts
1587
1654
  var OWNER = Symbol.for("devknobs.owner");
@@ -1589,13 +1656,13 @@ var HOST = Symbol.for("devknobs.host");
1589
1656
  function isHost(value) {
1590
1657
  return typeof value === "object" && value !== null && typeof Reflect.get(value, "release") === "function" && typeof Reflect.get(value, "adopt") === "function";
1591
1658
  }
1592
- function claim(scope, release, adopt, api) {
1659
+ function claim(scope, release, adopt, api, extras = {}) {
1593
1660
  const previous = Reflect.get(scope, OWNER);
1594
1661
  if (typeof previous === "function" && previous !== release)
1595
1662
  previous();
1596
1663
  Reflect.set(scope, OWNER, release);
1597
1664
  if (adopt)
1598
- Reflect.set(scope, HOST, { release, adopt, api });
1665
+ Reflect.set(scope, HOST, { release, adopt, api, ...extras });
1599
1666
  else
1600
1667
  Reflect.deleteProperty(scope, HOST);
1601
1668
  }
@@ -1855,6 +1922,101 @@ function createKeys(options2 = {}) {
1855
1922
  };
1856
1923
  }
1857
1924
 
1925
+ // src/ui/footer.ts
1926
+ var FRESH_NOTE = "fresh mode: nothing is kept";
1927
+ function runtimeLabel(host, version) {
1928
+ return `${host ? "extension" : "page"} ${version}`;
1929
+ }
1930
+ function overflowBadge(on, count) {
1931
+ return on && count !== null ? `${count} overflowing` : "";
1932
+ }
1933
+ function keyLabel(combo, mac) {
1934
+ return combo ? comboLabel(combo, mac) : "";
1935
+ }
1936
+ function keyChips(keys, grab, mac, inspect = false) {
1937
+ const chips = [
1938
+ { command: "panel", key: comboLabel(keys.panel, mac), word: BINDING_WORDS.panel },
1939
+ { command: "search", key: "/", word: "search" }
1940
+ ];
1941
+ if (grab) {
1942
+ chips.push({ command: "grab", key: keyLabel(keys.grab, mac), word: BINDING_WORDS.grab });
1943
+ }
1944
+ if (inspect) {
1945
+ const key = keyLabel(keys.inspect, mac);
1946
+ chips.push({ command: "inspect", key, word: BINDING_WORDS.inspect });
1947
+ }
1948
+ chips.push({ command: "replay", key: keyLabel(keys.replay, mac), word: BINDING_WORDS.replay }, { command: "reset", key: keyLabel(keys.reset, mac), word: BINDING_WORDS.reset });
1949
+ return chips;
1950
+ }
1951
+ function iconHint(className, label2, glyph2) {
1952
+ const node = button(`hint ${className}`, "");
1953
+ if (glyph2)
1954
+ node.append(glyph2);
1955
+ node.setAttribute("aria-label", label2);
1956
+ return node;
1957
+ }
1958
+ function createFooter(keys, grab, mac, inspect = null, runtime = null) {
1959
+ const foot = el("div", "foot");
1960
+ const badge = el("span", "badge");
1961
+ const meta = el("div", "meta");
1962
+ const hints = new Map;
1963
+ const hintKeys = new Map;
1964
+ for (const chip of keyChips(keys.get(), grab !== null, mac, inspect !== null)) {
1965
+ const node = button("hint", "");
1966
+ node.dataset.command = chip.command;
1967
+ const key = el("kbd", "hint-key", chip.key);
1968
+ node.append(key, chip.word);
1969
+ meta.append(node);
1970
+ hints.set(chip.command, node);
1971
+ hintKeys.set(chip.command, key);
1972
+ }
1973
+ const pin = iconHint("pin-toggle", pinWord(false));
1974
+ let pinShown = null;
1975
+ const sided = (name) => {
1976
+ const glyph2 = icon(name, 12);
1977
+ glyph2.setAttribute("class", "glyph sided");
1978
+ return glyph2;
1979
+ };
1980
+ const flip = iconHint("flip-toggle", SIDE_WORD, sided("panel-left"));
1981
+ const collapse = iconHint("collapse-toggle", COLLAPSE_WORD, sided("panel-right-close"));
1982
+ const keysToggle = iconHint("keys-toggle", "settings", icon("settings", 12));
1983
+ meta.append(flip, collapse, pin, keysToggle);
1984
+ function drawPin(docked) {
1985
+ if (docked === pinShown)
1986
+ return;
1987
+ pinShown = docked;
1988
+ flip.hidden = !docked;
1989
+ collapse.hidden = !docked;
1990
+ pin.replaceChildren(icon(docked ? "pin-off" : "pin", 12));
1991
+ pin.setAttribute("aria-label", pinWord(docked));
1992
+ pin.setAttribute("aria-pressed", docked ? "true" : "false");
1993
+ }
1994
+ drawPin(false);
1995
+ foot.append(badge);
1996
+ if (fresh())
1997
+ foot.append(el("span", "fresh-note", FRESH_NOTE));
1998
+ if (runtime)
1999
+ foot.append(el("span", "runtime", runtime));
2000
+ foot.append(meta);
2001
+ return {
2002
+ foot,
2003
+ badge,
2004
+ hints,
2005
+ pin,
2006
+ flip,
2007
+ collapse,
2008
+ keysToggle,
2009
+ drawPin,
2010
+ drawKeys(now2) {
2011
+ for (const chip of keyChips(now2, grab !== null, mac, inspect !== null)) {
2012
+ const key = hintKeys.get(chip.command);
2013
+ if (key)
2014
+ key.textContent = chip.key;
2015
+ }
2016
+ }
2017
+ };
2018
+ }
2019
+
1858
2020
  // src/ui/list.ts
1859
2021
  function rowOrder(state) {
1860
2022
  const ids = ROWS.map((row) => row.id);
@@ -2260,8 +2422,8 @@ function createDrag(context) {
2260
2422
  if (wrap.dataset.side !== side) {
2261
2423
  jump(() => {
2262
2424
  wrap.dataset.side = side;
2263
- host.style.left = side === "left" ? "0" : "";
2264
- host.style.right = side === "right" ? "0" : "";
2425
+ host.style.left = side === "left" ? "0" : "auto";
2426
+ host.style.right = side === "right" ? "0" : "auto";
2265
2427
  });
2266
2428
  }
2267
2429
  if (getState().panel.docked) {
@@ -2503,96 +2665,6 @@ function createDrag(context) {
2503
2665
  };
2504
2666
  }
2505
2667
 
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
2668
  // src/ui/inspector.ts
2597
2669
  var STYLES_VIEW = "styles";
2598
2670
  var SELECT = "select an element";
@@ -2600,7 +2672,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
2600
2672
  function here(element) {
2601
2673
  return element.isConnected && element.ownerDocument.defaultView !== null;
2602
2674
  }
2603
- function createInspector(context, load = () => import("./elementsview-tf4qzmtw.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2675
+ function createInspector(context, load = () => import("./elementsview-qn8qyksa.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2604
2676
  const { inspect, tips, prefs } = context;
2605
2677
  const listeners = new Set;
2606
2678
  let view = null;
@@ -6606,6 +6678,39 @@ function createSettings(context) {
6606
6678
  keysView.append(row);
6607
6679
  nativeSwitch2.addEventListener("click", () => context.setNative(nativeSwitch2.getAttribute("aria-checked") !== "true"));
6608
6680
  }
6681
+ const prefer = context.prefer;
6682
+ const preferChoice = segments({
6683
+ options: [
6684
+ { value: "extension", label: "extension" },
6685
+ { value: "page", label: "page" }
6686
+ ],
6687
+ label: "prefer",
6688
+ onChange: (value) => context.setPrefer(value === "page" ? "page" : "extension")
6689
+ });
6690
+ if (prefer) {
6691
+ preferChoice.node.classList.add("row-control");
6692
+ const hint = el("div", "row-hint", PREFER_HINT);
6693
+ hint.id = "devknobs-prefer-hint";
6694
+ preferChoice.node.setAttribute("aria-describedby", hint.id);
6695
+ const row = rowBox({
6696
+ main: el("div", "main"),
6697
+ glyph: icon("chevrons-left-right"),
6698
+ title: "prefer",
6699
+ ends: [preferChoice.node]
6700
+ }).box;
6701
+ row.append(hint);
6702
+ keysView.append(row);
6703
+ }
6704
+ const devIconSwitch = button("switch row-control", "");
6705
+ devIconSwitch.setAttribute("role", "switch");
6706
+ devIconSwitch.setAttribute("aria-label", "dev tab icon");
6707
+ keysView.append(rowBox({
6708
+ main: el("div", "main"),
6709
+ glyph: icon("image"),
6710
+ title: "dev tab icon",
6711
+ ends: [devIconSwitch]
6712
+ }).box);
6713
+ devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
6609
6714
  keysView.append(rowsLabel("shortcuts"));
6610
6715
  const keyViews = new Map;
6611
6716
  for (const binding of bindingsHere) {
@@ -6737,6 +6842,9 @@ function createSettings(context) {
6737
6842
  drawHandle(shown2) {
6738
6843
  mark(handleSwitch, shown2, "aria-checked");
6739
6844
  },
6845
+ drawDevIcon(shown2) {
6846
+ mark(devIconSwitch, shown2, "aria-checked");
6847
+ },
6740
6848
  drawNative(on, note) {
6741
6849
  mark(nativeSwitch2, on, "aria-checked");
6742
6850
  const hint = note ?? native?.hint ?? "";
@@ -6746,6 +6854,10 @@ function createSettings(context) {
6746
6854
  if (note)
6747
6855
  said.textContent = note;
6748
6856
  },
6857
+ drawPrefer() {
6858
+ if (prefer)
6859
+ preferChoice.set(prefer.value());
6860
+ },
6749
6861
  recordingKey(event) {
6750
6862
  if (recording === null)
6751
6863
  return false;
@@ -7635,6 +7747,8 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7635
7747
  .badge.hot { color: var(--hot); }
7636
7748
  /* Says fresh mode is on, as quiet as the key hints under it. */
7637
7749
  .fresh-note { font-size: 10px; line-height: 1.4; color: var(--faint); }
7750
+ /* Which copy runs the panel, as quiet. */
7751
+ .runtime { font-size: 10px; line-height: 1.4; color: var(--faint); font-variant-numeric: tabular-nums; }
7638
7752
  /* The key hints, each a button for what its key does. Where they leave no
7639
7753
  room, the line wraps. */
7640
7754
  .meta {
@@ -7720,6 +7834,8 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7720
7834
  takes no height of its own, so the row is as tall as any. */
7721
7835
  .main > .row-button { align-self: center; margin: -2px 0 -2px auto; }
7722
7836
  .main > .row-button:not([hidden]) + .row-control { margin-left: 0; }
7837
+ /* Segments at a row's end, as the settings' choice of who runs the panel, take no more height than its title. */
7838
+ .main > .seg.row-control { margin-top: -3px; margin-bottom: -3px; }
7723
7839
  /* The panel's icons face the side the panel is on. */
7724
7840
  .wrap[data-side="left"] .glyph.sided { transform: scaleX(-1); }
7725
7841
  .key-set {
@@ -7766,11 +7882,17 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7766
7882
  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
7883
  own limit shrinks it to what the window has, so the panel is as tall as it
7768
7884
  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. */
7885
+ holds can lay itself out by how wide the view is. A view takes the
7886
+ window's whole height, past the limit a list keeps. */
7887
+ .wrap[data-mode="view"] .panel {
7888
+ max-height: calc(100vh - 16px);
7889
+ max-height: calc(100dvh - 16px);
7890
+ }
7770
7891
  .view {
7771
7892
  flex: 0 1 auto;
7772
7893
  min-height: 0;
7773
- height: 672px;
7894
+ height: 100vh;
7895
+ height: 100dvh;
7774
7896
  display: flex;
7775
7897
  flex-direction: column;
7776
7898
  gap: 4px;
@@ -8124,9 +8246,13 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8124
8246
  as deep lines do in the browser's tools. The selected line has a ground of
8125
8247
  its own, a blue one while the tree has the focus, and ends with a quiet
8126
8248
  reference to it. A node that changed lights for a moment. */
8127
- .elements { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
8249
+ /* The tree takes what the styles leave of the view, and keeps the height its
8250
+ edge was dragged to once it was. */
8251
+ .elements { display: flex; flex-direction: column; min-height: 100%; gap: 4px; }
8252
+ .elements > * { min-width: 0; }
8128
8253
  .dom {
8129
8254
  position: relative;
8255
+ flex: 1 0 auto;
8130
8256
  height: 40vh;
8131
8257
  min-height: 96px;
8132
8258
  max-height: 85vh;
@@ -8136,6 +8262,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8136
8262
  scrollbar-width: thin;
8137
8263
  scrollbar-color: var(--line) transparent;
8138
8264
  }
8265
+ .dom[style*="height"] { flex-grow: 0; }
8139
8266
  .dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
8140
8267
  .dom-row {
8141
8268
  display: flex;
@@ -8578,7 +8705,7 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
8578
8705
  `;
8579
8706
 
8580
8707
  // src/ui/panel.ts
8581
- var HOST_STYLE = "position:fixed;top:0;z-index:2147483646;pointer-events:none";
8708
+ var HOST_STYLE = "position:fixed;top:0;right:auto;bottom:auto;left:auto;width:auto;height:auto;z-index:2147483647;pointer-events:none";
8582
8709
  function ownCss(media) {
8583
8710
  const settle2 = (_whole, query) => {
8584
8711
  const scheme = rewriteMediaText(query.trim(), "prefers-color-scheme", media.scheme);
@@ -8616,6 +8743,7 @@ function createPanel(options2 = {}) {
8616
8743
  host.setAttribute("data-devknobs", "panel");
8617
8744
  host.style.cssText = HOST_STYLE;
8618
8745
  const root = host.attachShadow({ mode: "open" });
8746
+ addStyle(root, HOST_RESET);
8619
8747
  const style = addStyle(root, "");
8620
8748
  const stopSystem = watchSystemMedia((media) => {
8621
8749
  style.textContent = media ? ownCss(media) : CSS;
@@ -8657,7 +8785,7 @@ function createPanel(options2 = {}) {
8657
8785
  const home = el("div", "home pane");
8658
8786
  lay(home, "rows");
8659
8787
  home.append(rows, empty, add, head, results);
8660
- const footer = createFooter(keys, grab, mac, inspect);
8788
+ const footer = createFooter(keys, grab, mac, inspect, options2.prefer?.runtime ?? null);
8661
8789
  const { foot, badge, hints, keysToggle, pin, collapse } = footer;
8662
8790
  const tip = el("div", "tip");
8663
8791
  tip.setAttribute("aria-hidden", "true");
@@ -8682,11 +8810,15 @@ function createPanel(options2 = {}) {
8682
8810
  renderKeys,
8683
8811
  handleShown: handleShows,
8684
8812
  showHandle: () => setState({ panel: { handle: true } }),
8813
+ devIconShown: () => devIconShown(getState().panel.devIcon, window.location.hostname),
8814
+ setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
8685
8815
  native: nativeSwitch()?.setting ?? null,
8686
8816
  setNative: (on) => {
8687
8817
  nativeSwitch()?.setting.change(on);
8688
8818
  setNative(on, null);
8689
8819
  },
8820
+ prefer: options2.prefer ?? null,
8821
+ setPrefer: (value) => options2.prefer?.change(value),
8690
8822
  searching: () => palette.searching(),
8691
8823
  leaveSearch: () => palette.leaveSearch()
8692
8824
  });
@@ -8780,9 +8912,11 @@ function createPanel(options2 = {}) {
8780
8912
  const handleShown = handleShows();
8781
8913
  wrap.dataset.handle = handleShown ? "shown" : "hidden";
8782
8914
  settings.drawHandle(handleShown);
8915
+ settings.drawDevIcon(devIconShown(state.panel.devIcon, window.location.hostname));
8783
8916
  const nativeNow = nativeSwitch();
8784
8917
  if (nativeNow)
8785
8918
  settings.drawNative(nativeNow.on, nativeNow.note);
8919
+ settings.drawPrefer();
8786
8920
  dockSlide.aim({
8787
8921
  docked: state.panel.docked,
8788
8922
  side: state.panel.side,
@@ -9031,16 +9165,20 @@ function createPanel(options2 = {}) {
9031
9165
  const resizes = new ResizeObserver(() => layout());
9032
9166
  resizes.observe(panel);
9033
9167
  function attach() {
9034
- if (document.body && host.parentNode !== document.body)
9035
- document.body.append(host);
9168
+ if (!document.body || host.parentNode === document.body)
9169
+ return;
9170
+ document.body.append(host);
9171
+ hold.raise();
9036
9172
  }
9037
9173
  render();
9038
9174
  (document.body ?? document.documentElement).append(host);
9175
+ const hold = holdInTopLayer(host, LAYER.panel);
9039
9176
  if (!document.body)
9040
9177
  document.addEventListener("DOMContentLoaded", attach, { once: true });
9041
- const stopKeeping = keepMounted(host);
9178
+ const stopKeeping = keepMounted(host, { restored: () => hold.raise() });
9042
9179
  layout("edge");
9043
9180
  return {
9181
+ drawPrefer: () => settings.drawPrefer(),
9044
9182
  destroy() {
9045
9183
  settings.stopRecording();
9046
9184
  unsubscribe();
@@ -9088,10 +9226,14 @@ function createPanel(options2 = {}) {
9088
9226
  dockSlide.destroy();
9089
9227
  document.removeEventListener("DOMContentLoaded", attach);
9090
9228
  stopKeeping();
9229
+ hold.release();
9091
9230
  host.remove();
9092
9231
  }
9093
9232
  };
9094
9233
  }
9234
+
9235
+ // src/version.ts
9236
+ var VERSION = "0.5.2";
9095
9237
  // src/index.ts
9096
9238
  var panel = null;
9097
9239
  var stopKeys = null;
@@ -9102,18 +9244,40 @@ var mounted = null;
9102
9244
  var hostedBy = null;
9103
9245
  var RETAKES = 3;
9104
9246
  var retaken = 0;
9247
+ var preferNow = null;
9248
+ var waiting = null;
9249
+ var deferred = null;
9250
+ var handedPrefer = null;
9251
+ var beaten = null;
9105
9252
  function mount(options2 = {}) {
9106
9253
  if (panel || stopKeys)
9107
9254
  return;
9108
9255
  const host = options2.host ? null : hostOf(window);
9109
9256
  if (host) {
9257
+ handedPrefer = null;
9110
9258
  hostedBy = host;
9111
- host.adopt(options2);
9259
+ deferred = options2;
9260
+ const take = Object.assign((handed) => takeFrom(options2, handed), {
9261
+ pending: () => deferred === options2 && !panel && !stopKeys
9262
+ });
9263
+ host.adopt(options2, take);
9112
9264
  return;
9113
9265
  }
9266
+ if (options2.host && options2.build) {
9267
+ const holder = hostOf(window);
9268
+ if (holder && !beats(options2.build, holder)) {
9269
+ standDown(options2, holder);
9270
+ return;
9271
+ }
9272
+ if (holder)
9273
+ beaten = { other: rankOf(holder) };
9274
+ }
9275
+ preferNow = options2.host ? options2.prefer?.value ?? null : null;
9276
+ if (!options2.host && !options2.prefer && handedPrefer)
9277
+ options2 = { ...options2, prefer: handedPrefer };
9114
9278
  applyOnLoad();
9115
9279
  if (options2.host)
9116
- claim(window, unmount, adopt, api);
9280
+ claim(window, unmount, adopt, api, options2.build ? { rank: rankFor(options2.build), outranked } : {});
9117
9281
  else
9118
9282
  claim(window, unmount);
9119
9283
  expose(window, api);
@@ -9140,7 +9304,57 @@ function attach(options2) {
9140
9304
  return;
9141
9305
  }
9142
9306
  choose(options2);
9143
- panel = createPanel({ keys: live, grab: grabControl, inspect, handle: options2.handle });
9307
+ panel = createPanel({
9308
+ keys: live,
9309
+ grab: grabControl,
9310
+ inspect,
9311
+ handle: options2.handle,
9312
+ prefer: panelPrefer(options2)
9313
+ });
9314
+ }
9315
+ function panelPrefer(options2) {
9316
+ const setting = options2.prefer;
9317
+ if (!setting)
9318
+ return;
9319
+ return {
9320
+ value: () => preferNow ?? setting.now?.() ?? setting.value,
9321
+ change: (value) => {
9322
+ setting.change(value);
9323
+ setPrefer(value);
9324
+ },
9325
+ runtime: [runtimeLabel(options2.host === true, VERSION), ...options2.host && beaten ? [stoodDownNote(beaten.other)] : []].join(" · ")
9326
+ };
9327
+ }
9328
+ function rankFor(build) {
9329
+ return { build, version: VERSION };
9330
+ }
9331
+ function beats(build, holder) {
9332
+ const theirs = rankOf(holder);
9333
+ if (!theirs && holder.rank !== undefined)
9334
+ return false;
9335
+ return outranks(rankFor(build), theirs);
9336
+ }
9337
+ function standDown(options2, holder) {
9338
+ options2.stoodDown?.();
9339
+ if (options2.build)
9340
+ holder.outranked?.(rankFor(options2.build));
9341
+ }
9342
+ function outranked(other) {
9343
+ beaten = { other: rankOf({ rank: other }) };
9344
+ if (!mounted || !panel)
9345
+ return;
9346
+ detach();
9347
+ attach(mounted);
9348
+ }
9349
+ function takeFrom(options2, handed) {
9350
+ if (deferred !== options2 || panel || stopKeys || hostOf(window))
9351
+ return false;
9352
+ deferred = null;
9353
+ hostedBy = null;
9354
+ const prefer = preferOf(handed);
9355
+ handedPrefer = prefer;
9356
+ mount(prefer ? { ...options2, prefer } : options2);
9357
+ return true;
9144
9358
  }
9145
9359
  function choose(options2) {
9146
9360
  if (options2.open !== undefined)
@@ -9160,9 +9374,15 @@ function detach() {
9160
9374
  keys?.destroy();
9161
9375
  keys = null;
9162
9376
  }
9163
- function adopt(options2) {
9377
+ function adopt(options2, take) {
9164
9378
  if (!mounted)
9165
9379
  return;
9380
+ if (typeof take === "function")
9381
+ waiting = take;
9382
+ if (stepsAside(preferNow, waiting)) {
9383
+ handOver();
9384
+ return;
9385
+ }
9166
9386
  const chosen = pageChoices(options2);
9167
9387
  const rebuild = ["hotkey", "grabKey", "grab"].some((key) => chosen[key] !== undefined && chosen[key] !== mounted?.[key]);
9168
9388
  mounted = { ...mounted, ...chosen };
@@ -9174,8 +9394,42 @@ function adopt(options2) {
9174
9394
  detach();
9175
9395
  attach(mounted);
9176
9396
  }
9397
+ function handOver() {
9398
+ const take = waiting;
9399
+ const options2 = mounted;
9400
+ if (!take || !options2?.host)
9401
+ return;
9402
+ const pending = Reflect.get(take, "pending");
9403
+ if (typeof pending === "function" && Reflect.apply(pending, take, []) !== true) {
9404
+ waiting = null;
9405
+ return;
9406
+ }
9407
+ const native = nativeSwitch();
9408
+ unmount();
9409
+ const prefer = options2.prefer;
9410
+ let took = false;
9411
+ try {
9412
+ took = take(prefer ? { prefer: { value: "page", change: prefer.change, now: prefer.now } } : {}) === true;
9413
+ } catch {}
9414
+ if (took)
9415
+ return;
9416
+ if (native && !native.on)
9417
+ setNative(false, native.note);
9418
+ mount(current(options2));
9419
+ }
9420
+ function current(options2) {
9421
+ return options2.prefer && preferNow ? { ...options2, prefer: { ...options2.prefer, value: preferNow } } : options2;
9422
+ }
9423
+ function setPrefer(value) {
9424
+ preferNow = value;
9425
+ panel?.drawPrefer();
9426
+ if (mounted?.host && stepsAside(value, waiting))
9427
+ handOver();
9428
+ }
9177
9429
  function unmount() {
9178
9430
  hostedBy = null;
9431
+ deferred = null;
9432
+ waiting = null;
9179
9433
  if (superseded(window, unmount))
9180
9434
  return;
9181
9435
  detach();
@@ -9189,8 +9443,25 @@ function unmount() {
9189
9443
  queueMicrotask(() => retake(was, native));
9190
9444
  }
9191
9445
  function retake(options2, native) {
9192
- if (mounted || !owned(window) || hostOf(window))
9446
+ if (mounted || !owned(window))
9447
+ return;
9448
+ const holder = hostOf(window);
9449
+ if (holder) {
9450
+ if (!options2.build)
9451
+ return;
9452
+ if (!beats(options2.build, holder)) {
9453
+ standDown(options2, holder);
9454
+ return;
9455
+ }
9456
+ if (native && !native.on)
9457
+ setNative(false, native.note);
9458
+ mount(current(options2));
9459
+ return;
9460
+ }
9461
+ if (!takesBack(preferNow)) {
9462
+ options2.prefer?.yielded?.();
9193
9463
  return;
9464
+ }
9194
9465
  if (retaken++ >= RETAKES) {
9195
9466
  if (retaken === RETAKES + 1) {
9196
9467
  console.warn("devknobs: this page runs its own copy of devknobs, which does not know hosts; it keeps the page");
@@ -9199,7 +9470,7 @@ function retake(options2, native) {
9199
9470
  }
9200
9471
  if (native && !native.on)
9201
9472
  setNative(false, native.note);
9202
- mount(options2);
9473
+ mount(current(options2));
9203
9474
  }
9204
9475
  function hosted(name) {
9205
9476
  if (!hostedBy)
@@ -9236,7 +9507,7 @@ async function grab(elements, options2) {
9236
9507
  const host = hosted("grab");
9237
9508
  if (host)
9238
9509
  return host(elements, options2);
9239
- const loaded = await import("./index-ke6v7919.js");
9510
+ const loaded = await import("./index-hv02xka3.js");
9240
9511
  return loaded.grab(elements, options2);
9241
9512
  }
9242
9513
  var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2 };