@vinena/knobs 0.5.3 → 0.6.0

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 +27 -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-fyc06wjt.js +3702 -0
  16. package/dist/elementsview-k6zvvcne.js +3701 -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 +410 -152
  46. package/dist/index.js +504 -482
  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 +500 -482
  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 +19 -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 +2 -0
  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
package/dist/react.js CHANGED
@@ -1,15 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  FADE_CURVE,
4
- PAGE_MIN,
5
- dockRoom,
6
- dockWidth,
7
4
  ease,
8
5
  keepMounted,
9
- lerp,
10
- setDockWidth,
11
- watchColumn
12
- } from "./react-qfpg79hs.js";
6
+ lerp
7
+ } from "./react-me102s1a.js";
13
8
  import {
14
9
  GRAB_COLORS as GRAB_COLORS2,
15
10
  GRAB_COLOR_NAMES,
@@ -18,15 +13,51 @@ import {
18
13
  createGrab,
19
14
  createInspect,
20
15
  oneAtATime
21
- } from "./react-806qmkyz.js";
16
+ } from "./react-v8497a41.js";
22
17
  import {
23
18
  hushOnce
24
- } from "./react-gefkdkdz.js";
19
+ } from "./react-1gqwa2yw.js";
20
+ import {
21
+ DRAG_SLOP,
22
+ FLING_SPAN,
23
+ FLING_TRAVEL,
24
+ GLIDE,
25
+ between,
26
+ clearForced,
27
+ cornerAt,
28
+ createPrefs,
29
+ createSizer,
30
+ dockedHandle,
31
+ dragDocked,
32
+ dragTarget,
33
+ dragTo,
34
+ forceState,
35
+ glideTime,
36
+ landSide,
37
+ otherSide,
38
+ settle,
39
+ translateOf,
40
+ velocity
41
+ } from "./react-88es9b5q.js";
42
+ import {
43
+ dockRoom,
44
+ dockWidth,
45
+ setDockWidth,
46
+ watchColumn
47
+ } from "./react-97b5b8j4.js";
48
+ import {
49
+ edits,
50
+ forgetReplay,
51
+ framedPage,
52
+ pageSettled,
53
+ pathNow,
54
+ startKeep,
55
+ stopKeep
56
+ } from "./react-6bz05qk1.js";
25
57
  import {
26
58
  label
27
- } from "./react-adky72h9.js";
59
+ } from "./react-ethftdxp.js";
28
60
  import {
29
- PANE_WIDTH,
30
61
  appliedOnLoad,
31
62
  applyOnLoad,
32
63
  closePane,
@@ -39,7 +70,7 @@ import {
39
70
  showPane,
40
71
  stopOnLoad,
41
72
  viewHead
42
- } from "./react-7vjfsh40.js";
73
+ } from "./react-6t4dbdzn.js";
43
74
  import {
44
75
  actButton,
45
76
  button,
@@ -68,59 +99,40 @@ import {
68
99
  tabBar,
69
100
  textField,
70
101
  toolbar
71
- } from "./react-mmq2zya3.js";
102
+ } from "./react-bxzn8vq5.js";
72
103
  import {
73
- BINDING_ICONS,
74
104
  BODY_CAP,
75
105
  HOST_RESET,
76
- KEYS_FIELD,
77
106
  LAYER,
78
107
  LOCALE_PRESETS,
79
108
  READ_MS,
80
- ROW_ICONS,
81
109
  SPEED_MAX,
82
110
  SPEED_MIN,
83
111
  TIME_ZONE_PRESETS,
84
112
  canonicalTag,
85
113
  canonicalZone,
86
- comboLabel,
87
- comboSpoken,
88
- comboText,
89
- defaultKeys,
90
114
  devIconFor,
91
115
  devIconShown,
92
- escapeStep,
93
116
  exports_engine,
94
117
  foldRest,
95
- forwardKeys,
96
118
  frameWindow,
97
119
  getState,
98
- glyph,
99
- highlightAt,
100
120
  holdInTopLayer,
101
121
  holdingHinge,
102
122
  hostSendsUa,
103
- icon,
104
- isFunctionKey,
105
- isSearchKey,
106
123
  keepPlace,
107
- keyAction,
108
124
  landSplash,
109
125
  letGo,
110
- lowerKey,
111
126
  moveHinge,
112
127
  nativeSwitch,
113
128
  onCount,
114
129
  overflowCount,
115
- paletteMove,
116
130
  panelSized,
117
- parseCombo,
118
131
  ready,
119
132
  replay,
120
133
  requestLog,
121
134
  reset,
122
135
  resolveTimeZone,
123
- rowIcon,
124
136
  sends,
125
137
  setNative,
126
138
  setState,
@@ -128,13 +140,49 @@ import {
128
140
  stop,
129
141
  subscribe,
130
142
  takeHinge,
131
- typeAhead,
132
143
  watchFold,
133
144
  watchHinge,
134
145
  watchPanel,
135
- zoomAction,
136
146
  zoomKey
137
- } from "./react-3rhdj2k1.js";
147
+ } from "./react-cs62p9qh.js";
148
+ import {
149
+ MAT_COLORS,
150
+ MAT_COLOR_NAMES,
151
+ UA_PRESETS,
152
+ isMac,
153
+ isMatName,
154
+ layoutOf,
155
+ layoutOptions,
156
+ matGradient,
157
+ mockOf,
158
+ platformOf,
159
+ runsUnderBars,
160
+ uaPreset,
161
+ userAgentOf
162
+ } from "./react-ttj8f9qp.js";
163
+ import {
164
+ BINDING_ICONS,
165
+ KEYS_FIELD,
166
+ ROW_ICONS,
167
+ comboLabel,
168
+ comboSpoken,
169
+ comboText,
170
+ defaultKeys,
171
+ escapeStep,
172
+ forwardKeys,
173
+ glyph,
174
+ highlightAt,
175
+ icon,
176
+ isFunctionKey,
177
+ isSearchKey,
178
+ keyAction,
179
+ lowerKey,
180
+ paletteMove,
181
+ parseCombo,
182
+ rowIcon,
183
+ typeAhead,
184
+ zoomAction
185
+ } from "./react-6q2cw2ya.js";
138
186
  import {
139
187
  BARS,
140
188
  BROWSERS,
@@ -155,8 +203,6 @@ import {
155
203
  GEO_ERRORS,
156
204
  GEO_PRESETS,
157
205
  GRAB_COLORS,
158
- MAT_COLORS,
159
- MAT_COLOR_NAMES,
160
206
  MOTIONS,
161
207
  NativeDate,
162
208
  ONLINES,
@@ -170,12 +216,10 @@ import {
170
216
  TEXT_MAX,
171
217
  TEXT_MIN,
172
218
  TRANSPARENCIES,
173
- UA_PRESETS,
174
219
  VISIONS,
175
220
  ZOOM_MAX,
176
221
  ZOOM_MIN,
177
222
  ZOOM_PRESETS,
178
- __require,
179
223
  addStyle,
180
224
  deviceOf,
181
225
  formId,
@@ -185,34 +229,28 @@ import {
185
229
  hasTouch,
186
230
  isCustomColor,
187
231
  isDevknobsFrame,
188
- isMac,
189
- isMatName,
190
232
  knobFrame,
191
- layoutOf,
192
- layoutOptions,
193
- matGradient,
194
- mockOf,
195
233
  needsFrame,
196
234
  newer,
197
235
  now,
198
236
  openOf,
199
237
  parseColor,
200
238
  percent,
201
- platformOf,
202
239
  readColor,
203
240
  readMessage,
204
241
  realNow,
205
242
  resolveGeo,
206
243
  rewriteMediaText,
207
- runsUnderBars,
208
244
  stamped,
209
245
  still,
210
246
  toHex,
211
- uaPreset,
212
- userAgentOf,
213
247
  watchSystemMedia,
214
248
  webStorage
215
- } from "./react-6tss0r9f.js";
249
+ } from "./react-wqn4sx0n.js";
250
+ import"./react-fp73vhyd.js";
251
+ import {
252
+ __require
253
+ } from "./react-t2qnewz2.js";
216
254
 
217
255
  // src/react.tsx
218
256
  import { useEffect, useRef } from "react";
@@ -1707,6 +1745,8 @@ var BINDINGS = [
1707
1745
  "replay",
1708
1746
  "requests",
1709
1747
  "storage",
1748
+ "elements",
1749
+ "settings",
1710
1750
  "reset"
1711
1751
  ];
1712
1752
  var BINDING_WORDS = {
@@ -1716,7 +1756,9 @@ var BINDING_WORDS = {
1716
1756
  replay: "replay animations",
1717
1757
  requests: "requests",
1718
1758
  storage: "storage",
1719
- reset: "reset"
1759
+ reset: "reset",
1760
+ elements: "elements",
1761
+ settings: "settings"
1720
1762
  };
1721
1763
  var RESERVED_LETTERS = new Set([..."cvxzawrtqlnfpshm"]);
1722
1764
  var ZOOM_KEYS = new Set(["=", "-", "_", "0"]);
@@ -1746,8 +1788,6 @@ function clashText(combo) {
1746
1788
  function comboProblem(combo, binding, others = {}) {
1747
1789
  if (!keepable(combo.key))
1748
1790
  return "use a letter, digit, symbol or F1 to F12";
1749
- if (bare(combo) && !isFunctionKey(combo.key))
1750
- return "add a modifier, alone it types";
1751
1791
  if (isReserved(combo))
1752
1792
  return "the browser uses it";
1753
1793
  if (combo.key === "/" && !combo.meta && !combo.ctrl && !combo.alt)
@@ -1811,6 +1851,9 @@ function readKeys(json) {
1811
1851
  } catch {
1812
1852
  return {};
1813
1853
  }
1854
+ return keysOf(value);
1855
+ }
1856
+ function keysOf(value) {
1814
1857
  if (newer(value, KEYS_VERSION))
1815
1858
  return {};
1816
1859
  const stored = record(value);
@@ -1872,10 +1915,41 @@ function keepKeys(keys) {
1872
1915
  webStorage("local")?.setItem(KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
1873
1916
  } catch {}
1874
1917
  }
1918
+ function keysListed(keys, listed) {
1919
+ const here = { ...keys };
1920
+ for (const binding of BINDINGS) {
1921
+ if (binding !== "panel" && !listed.includes(binding))
1922
+ here[binding] = null;
1923
+ }
1924
+ return here;
1925
+ }
1875
1926
  function createKeys(options2 = {}) {
1876
1927
  const base = defaultKeys(options2);
1877
1928
  const grab = options2.grab !== false;
1878
- let stored = loadKeys();
1929
+ const store = options2.store ?? null;
1930
+ function load() {
1931
+ if (!store)
1932
+ return loadKeys();
1933
+ if (fresh())
1934
+ return {};
1935
+ try {
1936
+ return keysOf(store.load());
1937
+ } catch {
1938
+ return {};
1939
+ }
1940
+ }
1941
+ function keep(keys2) {
1942
+ if (!store) {
1943
+ keepKeys(keys2);
1944
+ return;
1945
+ }
1946
+ if (fresh())
1947
+ return;
1948
+ try {
1949
+ store.save(stamped(keys2, KEYS_VERSION));
1950
+ } catch {}
1951
+ }
1952
+ let stored = load();
1879
1953
  let keys = resolveKeys(base, stored, grab);
1880
1954
  const listeners = new Set;
1881
1955
  function changed() {
@@ -1886,12 +1960,16 @@ function createKeys(options2 = {}) {
1886
1960
  function onStorage(event) {
1887
1961
  if (event.key !== KEYS_KEY && event.key !== null)
1888
1962
  return;
1963
+ heard();
1964
+ }
1965
+ function heard() {
1889
1966
  if (fresh())
1890
1967
  return;
1891
- stored = loadKeys();
1968
+ stored = load();
1892
1969
  changed();
1893
1970
  }
1894
- if (typeof window !== "undefined")
1971
+ const stopStore = store?.subscribe(heard) ?? null;
1972
+ if (!store && typeof window !== "undefined")
1895
1973
  window.addEventListener("storage", onStorage);
1896
1974
  return {
1897
1975
  get: () => keys,
@@ -1906,7 +1984,7 @@ function createKeys(options2 = {}) {
1906
1984
  else
1907
1985
  next[binding] = comboText(combo);
1908
1986
  stored = next;
1909
- keepKeys(stored);
1987
+ keep(stored);
1910
1988
  changed();
1911
1989
  },
1912
1990
  subscribe(listener) {
@@ -1918,6 +1996,7 @@ function createKeys(options2 = {}) {
1918
1996
  recording: false,
1919
1997
  destroy() {
1920
1998
  listeners.clear();
1999
+ stopStore?.();
1921
2000
  if (typeof window !== "undefined")
1922
2001
  window.removeEventListener("storage", onStorage);
1923
2002
  }
@@ -2280,122 +2359,6 @@ function createDockSlide(context) {
2280
2359
  };
2281
2360
  }
2282
2361
 
2283
- // src/ui/place.ts
2284
- var DRAG_SLOP = 4;
2285
- var FLING_SPAN = 150;
2286
- var FLING_STRETCH = 40;
2287
- var FLING_LEAST = 8;
2288
- var FLING = 0.5;
2289
- var FLING_LEAN = 1.5;
2290
- var FLING_TRAVEL = 16;
2291
- var GLIDE = 220;
2292
- var GLIDE_MAX = 440;
2293
- var GLIDE_SPEED = 6;
2294
- var PANEL_GAP = 8;
2295
- var SNAP = 24;
2296
- function dragTarget(shift, open) {
2297
- return open && !shift ? "panel" : "handle";
2298
- }
2299
- function otherSide(side) {
2300
- return side === "right" ? "left" : "right";
2301
- }
2302
- function between(value, min, max) {
2303
- return Math.min(Math.max(value, min), Math.max(min, max));
2304
- }
2305
- function snap(value, min, max) {
2306
- const end = Math.max(min, max);
2307
- const at = between(value, min, end);
2308
- if (at - min <= SNAP && at - min <= end - at)
2309
- return min;
2310
- return end - at <= SNAP ? end : at;
2311
- }
2312
- function edgeOf(value, min, max, had) {
2313
- const top = Math.abs(value - min) < 0.5;
2314
- const bottom = Math.abs(value - max) < 0.5;
2315
- if (top && bottom)
2316
- return had === "none" ? "top" : had;
2317
- return top ? "top" : bottom ? "bottom" : "none";
2318
- }
2319
- function settle(place, room, anchor = "edge") {
2320
- const last = room.view - PANEL_GAP - room.panel;
2321
- const pull = anchor === "top" ? between : snap;
2322
- const top = pull(anchor === "top" || place.edge === "none" ? place.top : place.edge === "top" ? PANEL_GAP : last, PANEL_GAP, last);
2323
- const low = top + room.panel - room.handle;
2324
- const y = pull(place.tab === "top" ? top : place.tab === "bottom" ? low : place.y, top, low);
2325
- return {
2326
- y,
2327
- top,
2328
- edge: edgeOf(top, PANEL_GAP, last, place.edge),
2329
- tab: edgeOf(y, top, low, place.tab)
2330
- };
2331
- }
2332
- function cornerAt(y, top, room) {
2333
- return edgeOf(y, top, top + room.panel - room.handle, "none");
2334
- }
2335
- function dragTo(target, open, to, from, room) {
2336
- const offset = from.y - from.top;
2337
- if (target === "panel") {
2338
- const top = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.panel);
2339
- return settle({ y: top + offset, top, edge: "none", tab: "none" }, room);
2340
- }
2341
- if (open)
2342
- return settle({ ...from, y: to, tab: "none" }, room);
2343
- const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
2344
- return settle({ y, top: y - offset, edge: "none", tab: "none" }, room);
2345
- }
2346
- function dragDocked(to, from, room) {
2347
- const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
2348
- return { y, top: y - (from.y - from.top), edge: "none", tab: from.tab };
2349
- }
2350
- function dockedHandle(y, room) {
2351
- return between(y, PANEL_GAP, room.view - PANEL_GAP - room.handle);
2352
- }
2353
- function speedOf(from, to) {
2354
- const time = to.t - from.t;
2355
- return { x: (to.x - from.x) / time, y: (to.y - from.y) / time };
2356
- }
2357
- function velocity(samples, at) {
2358
- const recent = samples.filter((sample) => sample.t >= at - FLING_SPAN && sample.t <= at);
2359
- let fastest = { x: 0, y: 0 };
2360
- let read = false;
2361
- for (const [index, end] of recent.entries()) {
2362
- let start2;
2363
- for (const sample of recent.slice(0, index)) {
2364
- if (end.t - sample.t >= FLING_STRETCH)
2365
- start2 = sample;
2366
- }
2367
- if (!start2)
2368
- continue;
2369
- const speed = speedOf(start2, end);
2370
- if (!read || Math.hypot(speed.x, speed.y) > Math.hypot(fastest.x, fastest.y))
2371
- fastest = speed;
2372
- read = true;
2373
- }
2374
- const first = recent[0];
2375
- const last = recent[recent.length - 1];
2376
- if (!read && first && last && last.t - first.t >= FLING_LEAST)
2377
- return speedOf(first, last);
2378
- return fastest;
2379
- }
2380
- function glideTime(distance) {
2381
- return between(distance / GLIDE_SPEED, GLIDE, GLIDE_MAX);
2382
- }
2383
- function landSide(side, x, width, vx, vy) {
2384
- const other = otherSide(side);
2385
- const toward = side === "right" ? -vx : vx;
2386
- const across = Math.abs(vx) >= FLING && Math.abs(vx) > FLING_LEAN * Math.abs(vy);
2387
- const past = side === "right" ? x < width / 2 : x > width / 2;
2388
- if (across && toward > 0)
2389
- return other;
2390
- if (across && toward < 0)
2391
- return side;
2392
- return past ? other : side;
2393
- }
2394
- function translateOf(value) {
2395
- const [x = 0, y = 0] = value === "none" ? [] : value.split(" ").map((part) => parseFloat(part));
2396
- return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
2397
- }
2398
-
2399
2362
  // src/ui/drag.ts
2400
2363
  function createDrag(context) {
2401
2364
  const { host, wrap, handle, panel } = context;
@@ -2674,7 +2637,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
2674
2637
  function here(element) {
2675
2638
  return element.isConnected && element.ownerDocument.defaultView !== null;
2676
2639
  }
2677
- function createInspector(context, load = () => import("./elementsview-1wsxcdtj.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2640
+ function createInspector(context, load = () => import("./elementsview-fyc06wjt.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2678
2641
  const { inspect, tips, prefs } = context;
2679
2642
  const listeners = new Set;
2680
2643
  let view = null;
@@ -2692,6 +2655,14 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
2692
2655
  function current() {
2693
2656
  return held && here(held) ? held : null;
2694
2657
  }
2658
+ function pageBody() {
2659
+ try {
2660
+ const page = framed ? frameWindow()?.document : typeof document === "undefined" ? undefined : document;
2661
+ return page?.body ?? null;
2662
+ } catch {
2663
+ return null;
2664
+ }
2665
+ }
2695
2666
  function point(element) {
2696
2667
  if (element && inspect.isOn())
2697
2668
  return;
@@ -2727,7 +2698,9 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
2727
2698
  },
2728
2699
  ...prefs && {
2729
2700
  mode: { get: () => prefs.get().stylesMode, set: prefs.setStylesMode },
2730
- box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox }
2701
+ box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox },
2702
+ diff: { get: () => prefs.get().changesDiff, set: prefs.setChangesDiff },
2703
+ htmlSize: { get: () => ({ height: prefs.get().htmlHeight, full: prefs.get().htmlFull }), set: prefs.setHtmlSize }
2731
2704
  }
2732
2705
  });
2733
2706
  view = made;
@@ -2811,6 +2784,18 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
2811
2784
  else
2812
2785
  inspect.set(true);
2813
2786
  },
2787
+ elements() {
2788
+ if (inspect.isOn())
2789
+ inspect.set(false);
2790
+ if (!current()) {
2791
+ const body = pageBody();
2792
+ if (view)
2793
+ view.show(body);
2794
+ else
2795
+ hold(body);
2796
+ }
2797
+ reveal2();
2798
+ },
2814
2799
  picked() {
2815
2800
  const element = current();
2816
2801
  return element ? label(element) : null;
@@ -4079,296 +4064,6 @@ function createPalette(context) {
4079
4064
  };
4080
4065
  }
4081
4066
 
4082
- // src/ui/size.ts
4083
- var LIST_WIDTH = 240;
4084
- var VIEW_WIDTH = PANE_WIDTH;
4085
- var LIST_MIN = 240;
4086
- var VIEW_MIN = 280;
4087
- var WIDTH_MAX = 720;
4088
- var PAGE_ROOM = 96;
4089
- function pageRoom(docked) {
4090
- return docked ? PAGE_MIN : PAGE_ROOM;
4091
- }
4092
- var WIDTH_STEP = 16;
4093
- var HANDLE_REACH = 21;
4094
- function widthLimits(showing, view, page = PAGE_ROOM) {
4095
- const min = showing === "view" ? VIEW_MIN : LIST_MIN;
4096
- return { min, max: Math.max(min, Math.min(WIDTH_MAX, view - page)) };
4097
- }
4098
- function widthIn(showing, wanted, view, page = PAGE_ROOM) {
4099
- const { min, max } = widthLimits(showing, view, page);
4100
- const room = view - HANDLE_REACH - PANEL_GAP;
4101
- return Math.max(LIST_MIN, Math.min(Math.round(between(wanted, min, max)), room));
4102
- }
4103
- function dragWidth(from, travel, side) {
4104
- return from + (side === "right" ? -travel : travel);
4105
- }
4106
- function keyWidth(key, width, limits, side) {
4107
- if (key === "Home")
4108
- return limits.min;
4109
- if (key === "End")
4110
- return limits.max;
4111
- if (key !== "ArrowLeft" && key !== "ArrowRight")
4112
- return null;
4113
- const wider = key === "ArrowLeft" === (side === "right");
4114
- return between(width + (wider ? WIDTH_STEP : -WIDTH_STEP), limits.min, limits.max);
4115
- }
4116
- function widthGlides(cue) {
4117
- return !cue.first && !cue.dragging && !cue.resizing;
4118
- }
4119
- function createSizer(context) {
4120
- const { host, wrap, panel, prefs } = context;
4121
- const strip = document.createElement("div");
4122
- strip.className = "sizer";
4123
- strip.tabIndex = 0;
4124
- strip.setAttribute("role", "separator");
4125
- strip.setAttribute("aria-orientation", "vertical");
4126
- strip.setAttribute("aria-label", "panel width");
4127
- let shown2 = null;
4128
- let held = null;
4129
- function viewWidth() {
4130
- return document.documentElement.clientWidth || window.innerWidth;
4131
- }
4132
- function put(width) {
4133
- wrap.style.setProperty("--panel-width", `${width}px`);
4134
- }
4135
- function apply(draw, resizing) {
4136
- const showing = context.showing();
4137
- const view = viewWidth();
4138
- const kept = showing === "view" ? prefs.get().viewWidth : prefs.get().listWidth;
4139
- const page = pageRoom(context.place().docked);
4140
- const next = widthIn(showing, held?.showing === showing ? held.width : kept, view, page);
4141
- const from = shown2;
4142
- const limits = widthLimits(showing, view, page);
4143
- strip.setAttribute("aria-valuemin", String(limits.min));
4144
- strip.setAttribute("aria-valuemax", String(limits.max));
4145
- if (next === from || from !== null && !context.place().open) {
4146
- draw?.();
4147
- return;
4148
- }
4149
- strip.setAttribute("aria-valuenow", String(next));
4150
- const glide = widthGlides({ first: from === null, dragging: held !== null, resizing });
4151
- shown2 = next;
4152
- context.wide(next);
4153
- host.style.width = `${HANDLE_REACH + next}px`;
4154
- panel.style.transitionProperty = "none";
4155
- put(next);
4156
- draw?.();
4157
- if (glide && from !== null)
4158
- put(from);
4159
- panel.getBoundingClientRect();
4160
- panel.style.transitionProperty = "";
4161
- put(next);
4162
- if (from !== null)
4163
- context.sized(glide);
4164
- }
4165
- function end(keep) {
4166
- if (!held)
4167
- return;
4168
- const { showing, pointer, width, moved } = held;
4169
- held = null;
4170
- delete wrap.dataset.sizing;
4171
- if (strip.hasPointerCapture(pointer))
4172
- strip.releasePointerCapture(pointer);
4173
- if (keep && moved)
4174
- prefs.setWidth(showing, width);
4175
- else
4176
- apply(undefined, false);
4177
- }
4178
- strip.addEventListener("pointerdown", (event) => {
4179
- if (event.button !== 0 || held || shown2 === null)
4180
- return;
4181
- held = {
4182
- showing: context.showing(),
4183
- pointer: event.pointerId,
4184
- from: shown2,
4185
- x: event.clientX,
4186
- width: shown2,
4187
- moved: false
4188
- };
4189
- wrap.dataset.sizing = "true";
4190
- strip.setPointerCapture(event.pointerId);
4191
- });
4192
- strip.addEventListener("pointermove", (event) => {
4193
- if (!held || event.pointerId !== held.pointer)
4194
- return;
4195
- const { side, docked } = context.place();
4196
- const wanted = dragWidth(held.from, event.clientX - held.x, side);
4197
- const width = widthIn(held.showing, wanted, viewWidth(), pageRoom(docked));
4198
- if (width === held.width)
4199
- return;
4200
- held.width = width;
4201
- held.moved = true;
4202
- apply(undefined, false);
4203
- });
4204
- strip.addEventListener("pointerup", (event) => {
4205
- if (event.pointerId === held?.pointer)
4206
- end(true);
4207
- });
4208
- strip.addEventListener("pointercancel", (event) => {
4209
- if (event.pointerId === held?.pointer)
4210
- end(false);
4211
- });
4212
- strip.addEventListener("lostpointercapture", (event) => {
4213
- if (event.pointerId === held?.pointer)
4214
- end(false);
4215
- });
4216
- strip.addEventListener("dblclick", () => {
4217
- const showing = context.showing();
4218
- prefs.setWidth(showing, showing === "view" ? VIEW_WIDTH : LIST_WIDTH);
4219
- });
4220
- strip.addEventListener("keydown", (event) => {
4221
- if (shown2 === null || event.altKey || event.ctrlKey || event.metaKey)
4222
- return;
4223
- const showing = context.showing();
4224
- const { side, docked } = context.place();
4225
- const limits = widthLimits(showing, viewWidth(), pageRoom(docked));
4226
- const next = keyWidth(event.key, shown2, limits, side);
4227
- if (next === null)
4228
- return;
4229
- event.preventDefault();
4230
- prefs.setWidth(showing, next);
4231
- });
4232
- return {
4233
- strip,
4234
- size: (draw) => apply(draw, false),
4235
- fit: () => apply(undefined, true),
4236
- cancel: () => end(false)
4237
- };
4238
- }
4239
-
4240
- // src/ui/prefs.ts
4241
- var PREFS_KEY = "devknobs:prefs";
4242
- var PREFS_VERSION = 4;
4243
- var STYLES_MODE = "simple";
4244
- var STYLES_BOX = true;
4245
- var WIDTH_OF = { list: "listWidth", view: "viewWidth" };
4246
- function readPrefs(json) {
4247
- let value = null;
4248
- try {
4249
- value = json ? JSON.parse(json) : null;
4250
- } catch {
4251
- return {};
4252
- }
4253
- if (typeof value !== "object" || value === null || Array.isArray(value))
4254
- return {};
4255
- if (newer(value, PREFS_VERSION))
4256
- return {};
4257
- const prefs = {};
4258
- const handle = Reflect.get(value, "handle");
4259
- if (typeof handle === "boolean")
4260
- prefs.handle = handle;
4261
- for (const key of [WIDTH_OF.list, WIDTH_OF.view]) {
4262
- const width = Reflect.get(value, key);
4263
- if (typeof width === "number" && Number.isFinite(width) && width > 0)
4264
- prefs[key] = width;
4265
- }
4266
- const mode = Reflect.get(value, "stylesMode");
4267
- if (mode === "simple" || mode === "advanced")
4268
- prefs.stylesMode = mode;
4269
- const box = Reflect.get(value, "stylesBox");
4270
- if (typeof box === "boolean")
4271
- prefs.stylesBox = box;
4272
- return prefs;
4273
- }
4274
- function resolvePrefs(base, stored) {
4275
- return { ...base, ...stored };
4276
- }
4277
- function loadPrefs() {
4278
- try {
4279
- return readPrefs(webStorage("local")?.getItem(PREFS_KEY));
4280
- } catch {
4281
- return {};
4282
- }
4283
- }
4284
- function keepPrefs(prefs) {
4285
- try {
4286
- if (Object.keys(prefs).length === 0)
4287
- webStorage("local")?.removeItem(PREFS_KEY);
4288
- else
4289
- webStorage("local")?.setItem(PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
4290
- } catch {}
4291
- }
4292
- function createPrefs(options2 = {}) {
4293
- const base = {
4294
- handle: options2.handle !== false,
4295
- listWidth: LIST_WIDTH,
4296
- viewWidth: VIEW_WIDTH,
4297
- stylesMode: STYLES_MODE,
4298
- stylesBox: STYLES_BOX
4299
- };
4300
- let stored = loadPrefs();
4301
- let prefs = resolvePrefs(base, stored);
4302
- const listeners = new Set;
4303
- function changed() {
4304
- prefs = resolvePrefs(base, stored);
4305
- for (const listener of Array.from(listeners))
4306
- listener();
4307
- }
4308
- function keep(next) {
4309
- stored = next;
4310
- keepPrefs(stored);
4311
- changed();
4312
- }
4313
- function onStorage(event) {
4314
- if (event.key !== PREFS_KEY && event.key !== null)
4315
- return;
4316
- if (fresh())
4317
- return;
4318
- stored = loadPrefs();
4319
- changed();
4320
- }
4321
- if (typeof window !== "undefined")
4322
- window.addEventListener("storage", onStorage);
4323
- return {
4324
- get: () => prefs,
4325
- setHandle(on) {
4326
- const next = { ...stored };
4327
- if (on === base.handle)
4328
- delete next.handle;
4329
- else
4330
- next.handle = on;
4331
- keep(next);
4332
- },
4333
- setWidth(showing, px) {
4334
- const key = WIDTH_OF[showing];
4335
- const next = { ...stored };
4336
- if (px === base[key])
4337
- delete next[key];
4338
- else
4339
- next[key] = px;
4340
- keep(next);
4341
- },
4342
- setStylesMode(mode) {
4343
- const next = { ...stored };
4344
- if (mode === base.stylesMode)
4345
- delete next.stylesMode;
4346
- else
4347
- next.stylesMode = mode;
4348
- keep(next);
4349
- },
4350
- setStylesBox(open) {
4351
- const next = { ...stored };
4352
- if (open === base.stylesBox)
4353
- delete next.stylesBox;
4354
- else
4355
- next.stylesBox = open;
4356
- keep(next);
4357
- },
4358
- subscribe(listener) {
4359
- listeners.add(listener);
4360
- return () => {
4361
- listeners.delete(listener);
4362
- };
4363
- },
4364
- destroy() {
4365
- listeners.clear();
4366
- if (typeof window !== "undefined")
4367
- window.removeEventListener("storage", onStorage);
4368
- }
4369
- };
4370
- }
4371
-
4372
4067
  // src/ui/requestformat.ts
4373
4068
  var LIGHT_WHY = "the browser gives a page only timing and size for this";
4374
4069
  var HIDDEN = "<hidden>";
@@ -6888,6 +6583,7 @@ function createSettings(context) {
6888
6583
  return true;
6889
6584
  },
6890
6585
  stopRecording,
6586
+ openKeys,
6891
6587
  leaveKeys,
6892
6588
  destroy: stopRefusing
6893
6589
  };
@@ -6937,7 +6633,7 @@ var CSS = `
6937
6633
  --edge: 0px;
6938
6634
  --edge-line: transparent;
6939
6635
  --glide: 220ms;
6940
- --panel-width: 240px;
6636
+ --panel-width: 320px;
6941
6637
  /* The columns: what a row keeps clear inside its edges, an icon's width,
6942
6638
  the room between an icon and its word, and how far in a line of words
6943
6639
  starts and ends. */
@@ -7044,6 +6740,7 @@ button {
7044
6740
  }
7045
6741
  :focus { outline: none; }
7046
6742
  button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
6743
+ input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-offset: 1px; }
7047
6744
 
7048
6745
  .handle {
7049
6746
  flex: none;
@@ -7131,7 +6828,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
7131
6828
  would stay on the window's edge as a line the panel's height. It hides
7132
6829
  once the slide is over. The edge side's border and the padding that pays
7133
6830
  for it go once its color has eased out. The width glides to a new one, as
7134
- a view comes or goes, and the panel turns that off under the strip. */
6831
+ the strip's keys set it, and the panel turns that off under the strip. */
7135
6832
  visibility: hidden;
7136
6833
  transition: visibility 0s linear 150ms, border-top-right-radius var(--glide) ease-out,
7137
6834
  border-bottom-right-radius var(--glide) ease-out, border-right-color var(--glide) ease-out,
@@ -8295,6 +7992,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8295
7992
  user-select: text;
8296
7993
  -webkit-user-select: text;
8297
7994
  }
7995
+ .dom-row { position: relative; }
8298
7996
  .dom-row:hover { background: var(--card); }
8299
7997
  .dom-row.on { background: var(--card); }
8300
7998
  .dom-tree:focus-within .dom-row.on { background: var(--pick); }
@@ -8302,6 +8000,110 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8302
8000
  .dom-code { flex: 0 1 auto; min-width: 30ch; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
8303
8001
  .dom-ref { white-space: pre; color: var(--faint); }
8304
8002
  .dom-code > .act { margin-left: var(--col-pad); height: 1.6em; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.6em; vertical-align: top; }
8003
+ /* A line whose element the panel hid, faint as its box on the page is gone. */
8004
+ .dom-hid > .dom-code { opacity: 0.5; }
8005
+ /* The html editor: line numbers on the card's fill beside the text, which is
8006
+ colored by the pre under a clear text box, the two set alike to the
8007
+ pixel, a scrollbar's room kept in both, so a long line wraps at the same
8008
+ place in each and its number stays at its first row. The grip under it
8009
+ drags its height, the button makes it the panel's. */
8010
+ .dom-code:has(> .html-ed), .dom-code:has(> .dom-edit) { flex: 1 1 auto; }
8011
+ .dom-code > .html-ed { display: block; width: 100%; min-width: 30ch; margin: 2px 0; }
8012
+ .html-ed-body {
8013
+ overflow: hidden;
8014
+ background: var(--bg);
8015
+ border-radius: 4px;
8016
+ box-shadow: inset 0 0 0 1px var(--faint);
8017
+ }
8018
+ .html-ed-code {
8019
+ position: relative;
8020
+ height: 100%;
8021
+ overflow: hidden;
8022
+ background: linear-gradient(var(--card), var(--card)) no-repeat;
8023
+ }
8024
+ .html-ed-hl, .html-ed .dom-html {
8025
+ position: absolute;
8026
+ inset: 0;
8027
+ margin: 0;
8028
+ padding: 4px var(--col-pad);
8029
+ font: 11px/1.6 var(--mono);
8030
+ letter-spacing: normal;
8031
+ white-space: pre-wrap;
8032
+ tab-size: 2;
8033
+ overflow-wrap: anywhere;
8034
+ word-break: normal;
8035
+ scrollbar-gutter: stable;
8036
+ scrollbar-width: thin;
8037
+ }
8038
+ .html-ed-hl { padding-left: 0; overflow: hidden; color: var(--fg); pointer-events: none; }
8039
+ .html-ed-hl > .html-ed-inner { display: grid; }
8040
+ .html-ed-num {
8041
+ padding: 0 var(--col-pad);
8042
+ color: var(--faint);
8043
+ text-align: right;
8044
+ user-select: none;
8045
+ -webkit-user-select: none;
8046
+ }
8047
+ .html-ed-text { min-height: 1.6em; padding-left: var(--col-pad); }
8048
+ .html-ed .dom-html {
8049
+ width: 100%;
8050
+ height: 100%;
8051
+ max-height: none;
8052
+ overflow: auto;
8053
+ resize: none;
8054
+ color: transparent;
8055
+ caret-color: var(--fg);
8056
+ background: transparent;
8057
+ border-radius: 0;
8058
+ box-shadow: none;
8059
+ scrollbar-width: thin;
8060
+ }
8061
+ .html-ed .dom-html::selection { background: color-mix(in srgb, var(--faint) 35%, transparent); }
8062
+ .html-ed .dom-html.bad { caret-color: var(--hot); }
8063
+ .html-ed:has(.bad) > .html-ed-body { box-shadow: inset 0 0 0 1px var(--hot); }
8064
+ .html-ed-foot { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
8065
+ .html-ed-grip { flex: 1 1 auto; display: grid; place-items: center; height: 12px; cursor: ns-resize; touch-action: none; }
8066
+ .html-ed-grip::after { content: ""; width: 32px; height: 3px; background: var(--line); border-radius: 2px; transition: background 120ms ease-out; }
8067
+ .html-ed-grip:hover::after { background: var(--faint); }
8068
+ .dom-code > .dom-apply { margin: 4px 0 2px; }
8069
+ /* The selected line's actions, kept in sight at the foot of the tree as it scrolls either way. */
8070
+ .dom-acts {
8071
+ position: sticky;
8072
+ left: 0;
8073
+ bottom: 0;
8074
+ display: flex;
8075
+ flex-wrap: wrap;
8076
+ gap: 4px;
8077
+ padding: 4px var(--view-end) 4px var(--view-start);
8078
+ background: var(--bg);
8079
+ border-top: 1px solid var(--line);
8080
+ }
8081
+ /* The handle that drags an element's line, at the start of its step in: on
8082
+ hover and on the selected line, and always under a finger. The line being
8083
+ dragged is faint; where it would go is a line over or under another, or
8084
+ a ring around the element it would go into. */
8085
+ .dom-grip {
8086
+ position: absolute;
8087
+ top: 0;
8088
+ width: 1.2em;
8089
+ line-height: 1.6;
8090
+ text-align: center;
8091
+ color: var(--faint);
8092
+ cursor: grab;
8093
+ opacity: 0;
8094
+ touch-action: none;
8095
+ user-select: none;
8096
+ -webkit-user-select: none;
8097
+ transition: opacity 120ms ease-out;
8098
+ }
8099
+ .dom-row:hover > .dom-grip, .dom-row.on > .dom-grip { opacity: 1; }
8100
+ @media (hover: none) { .dom-grip { opacity: 0.6; } }
8101
+ .dom-grip:hover { color: var(--fg); }
8102
+ .dom-drag, .dom-drag * { cursor: grabbing; }
8103
+ .dom-dragging > .dom-code { opacity: 0.45; }
8104
+ .dom-drop-before { box-shadow: inset 0 2px 0 var(--fg); }
8105
+ .dom-drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
8106
+ .dom-drop-into { box-shadow: inset 0 0 0 1px var(--fg); }
8305
8107
  .dom-flash { animation: dom-flash 900ms ease-out; }
8306
8108
  @keyframes dom-flash {
8307
8109
  from { background: var(--pick); }
@@ -8366,8 +8168,9 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
8366
8168
  text-overflow: ellipsis;
8367
8169
  white-space: nowrap;
8368
8170
  }
8369
- /* A declaration that wraps goes on further in than it starts. */
8370
- .css-decl { display: block; padding-left: 24px; text-indent: -12px; text-decoration: none; }
8171
+ /* A declaration that wraps goes on further in than it starts. Every line
8172
+ keeps the gutter an editable line's box stands in, so no text moves. */
8173
+ .css-decl { display: block; padding-left: 30px; text-indent: -12px; text-decoration: none; }
8371
8174
  /* A name has the color of a key, its value the text's, and the marks between
8372
8175
  them are quiet. A declaration that is struck through is quiet all over. */
8373
8176
  .css-name { color: var(--key); }
@@ -8415,10 +8218,143 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
8415
8218
  padding-right: var(--view-end);
8416
8219
  padding-left: var(--view-start);
8417
8220
  }
8418
- .css-applied .css-decl { padding-left: 12px; }
8419
8221
  .css-label { font-size: 10.5px; color: var(--faint); }
8420
8222
  .css-comes { color: var(--faint); }
8421
8223
  .css-hidden { padding: 2px var(--view-end) 2px var(--view-start); font-size: 10.5px; color: var(--faint); overflow-wrap: anywhere; }
8224
+ /* Editing, as in the browsers' tools: a checkbox in a line's gutter turns
8225
+ it off and on, shown on hover, on focus and on a line that is off. Its
8226
+ ring and its check are cut out of a fill by a mask, so they follow the
8227
+ theme with no line drawn. A value is a
8228
+ field on a click, as wide as what it holds, on the track's fill, its text
8229
+ red where the page did not take it. Adding a property is a quiet line
8230
+ under a block, in from its edge as a declaration's first line is. */
8231
+ .css-decl.can-edit { position: relative; }
8232
+ .css-toggle {
8233
+ position: absolute;
8234
+ top: 2.5px;
8235
+ left: 2px;
8236
+ width: 12px;
8237
+ height: 12px;
8238
+ opacity: 0;
8239
+ background: var(--faint);
8240
+ border-radius: 3px;
8241
+ cursor: pointer;
8242
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zm0 1.25C2 1.25 1.25 2 1.25 3v6c0 1 .75 1.75 1.75 1.75h6c1 0 1.75-.75 1.75-1.75V3c0-1-.75-1.75-1.75-1.75z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
8243
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zm0 1.25C2 1.25 1.25 2 1.25 3v6c0 1 .75 1.75 1.75 1.75h6c1 0 1.75-.75 1.75-1.75V3c0-1-.75-1.75-1.75-1.75z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
8244
+ transition: opacity 120ms ease-out;
8245
+ }
8246
+ .css-toggle:checked {
8247
+ background: var(--fg);
8248
+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zM2.6 6.1 3.7 5l1.6 1.6 3.4-3.4 1.1 1.1-4.5 4.5z'/%3E%3C/svg%3E");
8249
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zM2.6 6.1 3.7 5l1.6 1.6 3.4-3.4 1.1 1.1-4.5 4.5z'/%3E%3C/svg%3E");
8250
+ }
8251
+ .css-decl.can-edit:hover > .css-toggle, .css-toggle:focus-visible, .css-decl.off > .css-toggle { opacity: 1; }
8252
+ .css-editable { border-radius: 2px; cursor: text; }
8253
+ .css-editable:hover, .css-editable:focus-visible { background: var(--track); }
8254
+ /* A field wraps where its value is wider than its line, and grows down, as
8255
+ tall as what it holds up to a height it scrolls in: nothing scrolls sideways. */
8256
+ .css-edit {
8257
+ max-width: 100%;
8258
+ max-height: 18em;
8259
+ padding: 0;
8260
+ font: inherit;
8261
+ text-indent: 0;
8262
+ vertical-align: top;
8263
+ white-space: pre-wrap;
8264
+ overflow-wrap: anywhere;
8265
+ overflow: hidden auto;
8266
+ resize: none;
8267
+ scrollbar-width: thin;
8268
+ color: var(--fg);
8269
+ background: var(--track);
8270
+ border-radius: 2px;
8271
+ }
8272
+ .css-edit.bad { color: var(--hot); }
8273
+ /* The field's ring, as a chip's field has it while focused, in place of the browser's border. */
8274
+ .inline-field { border: 0; box-shadow: inset 0 0 0 1px var(--faint); }
8275
+ .css-add, .css-adding { padding-left: 18px; }
8276
+ .css-add, .css-new-rule {
8277
+ display: block;
8278
+ font: 11px/1.5 var(--mono);
8279
+ color: var(--faint);
8280
+ border-radius: 2px;
8281
+ transition: color 120ms ease-out;
8282
+ }
8283
+ .css-add:hover, .css-new-rule:hover { color: var(--fg); }
8284
+ .css-adding { text-indent: 0; }
8285
+ /* The suggestions under a field of the styles view: a raised list placed
8286
+ under the field, the one marked in the selected line's tint. */
8287
+ .ac-list {
8288
+ position: absolute;
8289
+ z-index: 3;
8290
+ display: grid;
8291
+ min-width: 16ch;
8292
+ max-width: 100%;
8293
+ max-height: 12.8em;
8294
+ overflow-y: auto;
8295
+ padding: 2px 0;
8296
+ font: 11px/1.6 var(--mono);
8297
+ text-indent: 0;
8298
+ white-space: nowrap;
8299
+ color: var(--fg);
8300
+ background: var(--raised);
8301
+ border-radius: 4px;
8302
+ box-shadow: var(--lift), 0 0 0 1px var(--line);
8303
+ scrollbar-width: thin;
8304
+ }
8305
+ .ac-item { padding: 0 var(--col-pad); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
8306
+ .ac-item:hover { background: var(--card); }
8307
+ .ac-item[aria-selected="true"] { background: var(--pick); }
8308
+ /* The line that adds a rule stands under the blocks, as the start of one. */
8309
+ .css-new-rule { justify-self: start; padding: 2px var(--view-end) 2px var(--view-start); }
8310
+ .css-rule-adding { padding: 2px var(--view-end) 2px var(--view-start); }
8311
+ /* The states a chip forces, in the editors' chips, the selector's font. */
8312
+ .force-states { padding: 0 var(--view-end) 4px var(--view-start); }
8313
+ .force-states .chip { font: 11px/22px var(--mono); }
8314
+
8315
+ /* The changes at the foot of the Elements view, which stay in sight while
8316
+ the styles scroll: a quiet head, each edit as diff lines tinted for what
8317
+ went and what came, then the buttons, the prompt the filled one. */
8318
+ .changes {
8319
+ position: sticky;
8320
+ bottom: 0;
8321
+ /* Over the styles' bar where the two meet, with a long list. */
8322
+ z-index: 2;
8323
+ display: grid;
8324
+ grid-template-columns: minmax(0, 1fr);
8325
+ gap: 6px;
8326
+ padding: 8px var(--view-end) 8px var(--view-start);
8327
+ background: var(--bg);
8328
+ border-top: 1px solid var(--line);
8329
+ }
8330
+ .changes-head, .changes-note { font-size: 10.5px; color: var(--faint); }
8331
+ /* The count is the button that folds the diff out, its chevron turned while it shows. */
8332
+ .changes-toggle { color: inherit; border-radius: 2px; transition: color 120ms ease-out; }
8333
+ .changes-toggle:hover { color: var(--fg); }
8334
+ .changes-toggle::before { content: "›"; display: inline-block; width: 2ch; text-align: left; transform-origin: 0.5ch 50%; transition: transform 120ms ease-out; }
8335
+ .changes-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
8336
+ /* What was made again as the page loaded, and the edits that were not. */
8337
+ .changes-kept { display: grid; gap: 2px; font-size: 11px; }
8338
+ .changes-kept-line { color: var(--fg); }
8339
+ .changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
8340
+ .changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
8341
+ /* The switch that keeps the edits after a reload, over the tree. */
8342
+ .keep-line { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
8343
+ .keep-line .knob-label { color: var(--fg); }
8344
+ .changes-list {
8345
+ max-height: 30vh;
8346
+ overflow: auto;
8347
+ font: 11px/1.5 var(--mono);
8348
+ overflow-wrap: anywhere;
8349
+ scrollbar-width: thin;
8350
+ }
8351
+ .diff-place { padding: 4px var(--col-pad) 0; color: var(--faint); }
8352
+ .diff-place:first-child { padding-top: 0; }
8353
+ .diff-del, .diff-add { padding: 0 var(--col-pad); border-radius: 2px; }
8354
+ .diff-del { background: color-mix(in srgb, var(--hot) 14%, transparent); }
8355
+ .diff-add { background: color-mix(in srgb, var(--ok) 14%, transparent); }
8356
+ .changes-acts { display: flex; flex-wrap: wrap; gap: 4px; }
8357
+ .chip.changes-go, .chip.changes-go:hover { color: var(--bg); background: var(--fg); }
8422
8358
 
8423
8359
  /* The element's box, in a fold of the kit's: a picture of the element, so
8424
8360
  its areas are filled, each in the hue the page's own tint of it has, mixed
@@ -8736,6 +8672,11 @@ function ownCss(media) {
8736
8672
  };
8737
8673
  return CSS.replace(/@media ([^{]+)\{/g, settle2).replaceAll("color-scheme: light dark", `color-scheme: ${media.scheme}`);
8738
8674
  }
8675
+ function resetPage(log = edits, reset2 = reset) {
8676
+ log.undoAll();
8677
+ clearForced();
8678
+ reset2();
8679
+ }
8739
8680
  function createPanel(options2 = {}) {
8740
8681
  const keys = options2.keys ?? createKeys();
8741
8682
  const prefs = createPrefs({ handle: options2.handle });
@@ -8761,7 +8702,7 @@ function createPanel(options2 = {}) {
8761
8702
  const flip = () => drag.flip();
8762
8703
  stage.flip = flip;
8763
8704
  const actionsHere = availableActions();
8764
- const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" || inspect !== null));
8705
+ const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
8765
8706
  const host = document.createElement("div");
8766
8707
  host.setAttribute("data-devknobs", "panel");
8767
8708
  host.style.cssText = HOST_STYLE;
@@ -8870,7 +8811,6 @@ function createPanel(options2 = {}) {
8870
8811
  wrap,
8871
8812
  panel,
8872
8813
  prefs,
8873
- showing: () => viewing() ? "view" : "list",
8874
8814
  place: () => getState().panel,
8875
8815
  wide: setDockWidth,
8876
8816
  sized: panelSized
@@ -8960,7 +8900,7 @@ function createPanel(options2 = {}) {
8960
8900
  rows.hidden = !anyShown;
8961
8901
  const resetHint = hints.get("reset");
8962
8902
  if (resetHint)
8963
- resetHint.disabled = isReset(state);
8903
+ resetHint.disabled = isReset(state) && edits.list().length === 0;
8964
8904
  badge.textContent = overflowBadge(state.overflow, live.overflow);
8965
8905
  badge.hidden = badge.textContent === "";
8966
8906
  badge.classList.toggle("hot", hot);
@@ -9024,7 +8964,7 @@ function createPanel(options2 = {}) {
9024
8964
  searchInput.value = "";
9025
8965
  for (const action of actionsHere)
9026
8966
  stopAction(action);
9027
- reset();
8967
+ resetPage();
9028
8968
  }
9029
8969
  function onInspect(on) {
9030
8970
  const at = root.activeElement;
@@ -9071,9 +9011,17 @@ function createPanel(options2 = {}) {
9071
9011
  actionOf("storage")?.run();
9072
9012
  return;
9073
9013
  }
9014
+ if (action === "requests" || action === "elements") {
9015
+ showView(action);
9016
+ return;
9017
+ }
9018
+ if (action === "settings") {
9019
+ showSettings();
9020
+ return;
9021
+ }
9074
9022
  if (!getState().panel.open)
9075
9023
  return;
9076
- if (action === "replay" || action === "requests")
9024
+ if (action === "replay")
9077
9025
  actionOf(action)?.run();
9078
9026
  else if (action === "reset")
9079
9027
  runCommand("reset");
@@ -9082,6 +9030,31 @@ function createPanel(options2 = {}) {
9082
9030
  else
9083
9031
  toggle(false);
9084
9032
  }
9033
+ function opensPanel(action) {
9034
+ return action === "toggle" || action === "storage" || action === "requests" || action === "settings" || action === "elements";
9035
+ }
9036
+ function showView(action) {
9037
+ const id = side.view();
9038
+ const mine = action === "requests" ? requests.shows() : id === STYLES_VIEW;
9039
+ if (mine && getState().panel.open && viewing()) {
9040
+ side.close();
9041
+ return;
9042
+ }
9043
+ if (mine && id !== null)
9044
+ side.show(id);
9045
+ else if (action === "requests")
9046
+ requestsHere.toggle();
9047
+ else
9048
+ inspector?.elements();
9049
+ }
9050
+ function showSettings() {
9051
+ if (getState().panel.open && settings.editing()) {
9052
+ settings.leaveKeys();
9053
+ return;
9054
+ }
9055
+ toggle(true);
9056
+ settings.openKeys();
9057
+ }
9085
9058
  function escape() {
9086
9059
  if (drag.dragging() || !getState().panel.open)
9087
9060
  return;
@@ -9131,8 +9104,8 @@ function createPanel(options2 = {}) {
9131
9104
  event.stopPropagation();
9132
9105
  return;
9133
9106
  }
9134
- const action = keyAction(event, keys.get());
9135
- const acts = action !== null && action !== "close" && !drag.dragging() && (action === "toggle" || action === "storage" || getState().panel.open);
9107
+ const action = keyAction(event, keysListed(keys.get(), bindingsHere));
9108
+ const acts = action !== null && action !== "close" && !drag.dragging() && (opensPanel(action) || getState().panel.open);
9136
9109
  const inSearch = event.composedPath()[0] === searchInput;
9137
9110
  if (acts || action && action !== "close" && inSearch)
9138
9111
  event.preventDefault();
@@ -9181,6 +9154,7 @@ function createPanel(options2 = {}) {
9181
9154
  stage.inspector = inspector;
9182
9155
  const stopModes = actionsHere.flatMap((action) => action.watch?.(render) ?? []);
9183
9156
  const stopCount = onCount(render);
9157
+ const stopEdits = edits.subscribe(render);
9184
9158
  window.addEventListener("keydown", onKeydown, true);
9185
9159
  window.addEventListener("pointerdown", onPointerDown, true);
9186
9160
  window.addEventListener("pointerup", onPointerUp, true);
@@ -9232,6 +9206,7 @@ function createPanel(options2 = {}) {
9232
9206
  if (stage.inspector === inspector)
9233
9207
  stage.inspector = null;
9234
9208
  stopCount();
9209
+ stopEdits();
9235
9210
  clearInterval(ticker);
9236
9211
  tips.destroy();
9237
9212
  settings.destroy();
@@ -9259,7 +9234,7 @@ function createPanel(options2 = {}) {
9259
9234
  }
9260
9235
 
9261
9236
  // src/version.ts
9262
- var VERSION = "0.5.3";
9237
+ var VERSION = "0.6.0";
9263
9238
  // src/index.ts
9264
9239
  var panel = null;
9265
9240
  var stopKeys = null;
@@ -9310,12 +9285,20 @@ function mount(options2 = {}) {
9310
9285
  start(options2);
9311
9286
  mounted = options2;
9312
9287
  attach(options2);
9288
+ if (!isDevknobsFrame() && !fresh())
9289
+ keepEdits(options2.editsStore);
9290
+ }
9291
+ function keepEdits(store) {
9292
+ const path = pathNow();
9293
+ const frame = () => framedPage(window, frameWindow(), path, needsFrame(getState()));
9294
+ startKeep(store, { frame, settled: () => pageSettled(window, () => needsFrame(getState()), frame) });
9313
9295
  }
9314
9296
  function attach(options2) {
9315
9297
  const live = createKeys({
9316
9298
  hotkey: options2.hotkey,
9317
9299
  grabKey: options2.grabKey,
9318
- grab: options2.grab !== false
9300
+ grab: options2.grab !== false,
9301
+ store: options2.keysStore
9319
9302
  });
9320
9303
  keys = live;
9321
9304
  if (options2.grab !== false) {
@@ -9420,6 +9403,7 @@ function adopt(options2, take) {
9420
9403
  detach();
9421
9404
  attach(mounted);
9422
9405
  }
9406
+ var handing = false;
9423
9407
  function handOver() {
9424
9408
  const take = waiting;
9425
9409
  const options2 = mounted;
@@ -9431,7 +9415,12 @@ function handOver() {
9431
9415
  return;
9432
9416
  }
9433
9417
  const native = nativeSwitch();
9434
- unmount();
9418
+ handing = true;
9419
+ try {
9420
+ unmount();
9421
+ } finally {
9422
+ handing = false;
9423
+ }
9435
9424
  const prefer = options2.prefer;
9436
9425
  let took = false;
9437
9426
  try {
@@ -9459,6 +9448,12 @@ function unmount() {
9459
9448
  if (superseded(window, unmount))
9460
9449
  return;
9461
9450
  detach();
9451
+ stopKeep();
9452
+ if (!handing) {
9453
+ edits.undoAll();
9454
+ forgetReplay();
9455
+ clearForced();
9456
+ }
9462
9457
  const native = mounted?.host ? nativeSwitch() : null;
9463
9458
  stop();
9464
9459
  withdraw(window, api);
@@ -9533,10 +9528,33 @@ async function grab(elements, options2) {
9533
9528
  const host = hosted("grab");
9534
9529
  if (host)
9535
9530
  return host(elements, options2);
9536
- const loaded = await import("./index-sn2y6j09.js");
9531
+ const loaded = await import("./index-kfdzsyyw.js");
9537
9532
  return loaded.grab(elements, options2);
9538
9533
  }
9539
- var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2 };
9534
+ function edits2() {
9535
+ return (hosted("edits") ?? edits.list)();
9536
+ }
9537
+ async function setEdits(list) {
9538
+ const host = hosted("setEdits");
9539
+ if (host)
9540
+ return host(list);
9541
+ if (!Array.isArray(list))
9542
+ throw new TypeError("devknobs.setEdits takes a list of edits, as edits() gives them");
9543
+ const { replayEdits } = await import("./replay-j18rw92k.js");
9544
+ const { applied, skipped } = replayEdits(edits, list);
9545
+ return { applied, skipped };
9546
+ }
9547
+ function undoEdit() {
9548
+ return (hosted("undoEdit") ?? edits.undo)();
9549
+ }
9550
+ function forceState2(target, states = []) {
9551
+ const host = hosted("forceState");
9552
+ if (host)
9553
+ return host(target, states);
9554
+ const element = typeof target === "string" ? document.querySelector(target) : target;
9555
+ return forceState(element, states);
9556
+ }
9557
+ var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2, edits: edits2, setEdits, undoEdit, forceState: forceState2 };
9540
9558
 
9541
9559
  // src/react.tsx
9542
9560
  function DevKnobs(props) {