@vinena/knobs 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  createGrab,
13
13
  createInspect,
14
14
  oneAtATime
15
- } from "./index-f60yax1j.js";
15
+ } from "./index-1by1n6p4.js";
16
16
  import {
17
17
  hushOnce
18
18
  } from "./index-aymfvd8s.js";
@@ -48,6 +48,7 @@ import {
48
48
  edits,
49
49
  forgetReplay,
50
50
  framedPage,
51
+ keeper,
51
52
  pageSettled,
52
53
  pathNow,
53
54
  startKeep,
@@ -69,7 +70,7 @@ import {
69
70
  showPane,
70
71
  stopOnLoad,
71
72
  viewHead
72
- } from "./index-aynkv7qk.js";
73
+ } from "./index-v67kqq9p.js";
73
74
  import {
74
75
  actButton,
75
76
  button,
@@ -143,7 +144,7 @@ import {
143
144
  watchHinge,
144
145
  watchPanel,
145
146
  zoomKey
146
- } from "./index-x59vz1xx.js";
147
+ } from "./index-ggf32ddy.js";
147
148
  import {
148
149
  MAT_COLORS,
149
150
  MAT_COLOR_NAMES,
@@ -2634,7 +2635,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
2634
2635
  function here(element) {
2635
2636
  return element.isConnected && element.ownerDocument.defaultView !== null;
2636
2637
  }
2637
- function createInspector(context, load = () => import("./elementsview-k6zvvcne.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2638
+ function createInspector(context, load = () => import("./elementsview-nhm5k473.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2638
2639
  const { inspect, tips, prefs } = context;
2639
2640
  const listeners = new Set;
2640
2641
  let view = null;
@@ -6330,6 +6331,51 @@ function handleHint(keys, mac) {
6330
6331
  return `press ${comboLabel(keys.panel, mac)} to open knobs`;
6331
6332
  }
6332
6333
  var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
6334
+ var KEEP_LABEL = "keep edits after reload";
6335
+ var KEEP_HINT = "keeps your Elements edits on this page after a reload.";
6336
+ function keepRow(resolve) {
6337
+ const control = button("switch row-control", "");
6338
+ control.setAttribute("role", "switch");
6339
+ control.setAttribute("aria-label", KEEP_LABEL);
6340
+ const hint = el("div", "row-hint", KEEP_HINT);
6341
+ hint.id = "devknobs-keep-hint";
6342
+ control.setAttribute("aria-describedby", hint.id);
6343
+ const node = rowBox({
6344
+ main: el("div", "main"),
6345
+ glyph: icon("rotate-ccw"),
6346
+ title: KEEP_LABEL,
6347
+ ends: [control]
6348
+ }).box;
6349
+ node.append(hint);
6350
+ let keep = null;
6351
+ let stop2 = null;
6352
+ const draw = () => {
6353
+ if (!keep)
6354
+ return;
6355
+ mark(control, keep.on(), "aria-checked");
6356
+ control.disabled = !keep.known();
6357
+ };
6358
+ control.addEventListener("click", () => keep?.set(!keep.on()));
6359
+ function sync() {
6360
+ const now2 = resolve();
6361
+ if (now2 !== keep) {
6362
+ stop2?.();
6363
+ keep = now2;
6364
+ stop2 = keep ? keep.subscribe(draw) : null;
6365
+ }
6366
+ node.hidden = !keep;
6367
+ draw();
6368
+ }
6369
+ sync();
6370
+ return {
6371
+ node,
6372
+ sync,
6373
+ destroy() {
6374
+ stop2?.();
6375
+ stop2 = null;
6376
+ }
6377
+ };
6378
+ }
6333
6379
  function createSettings(context) {
6334
6380
  const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
6335
6381
  const keysView = el("div", "keys pane");
@@ -6416,12 +6462,20 @@ function createSettings(context) {
6416
6462
  const devIconSwitch = button("switch row-control", "");
6417
6463
  devIconSwitch.setAttribute("role", "switch");
6418
6464
  devIconSwitch.setAttribute("aria-label", "dev tab icon");
6419
- keysView.append(rowBox({
6465
+ const devIconRow = rowBox({
6420
6466
  main: el("div", "main"),
6421
6467
  glyph: icon("image"),
6422
6468
  title: "dev tab icon",
6423
6469
  ends: [devIconSwitch]
6424
- }).box);
6470
+ }).box;
6471
+ keysView.append(devIconRow);
6472
+ const keepEdits = keepRow(context.keep);
6473
+ const placeKeep = () => {
6474
+ keepEdits.sync();
6475
+ if (!keepEdits.node.hidden && !keysView.contains(keepEdits.node))
6476
+ keysView.insertBefore(keepEdits.node, devIconRow);
6477
+ };
6478
+ placeKeep();
6425
6479
  devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
6426
6480
  keysView.append(rowsLabel("shortcuts"));
6427
6481
  const keyViews = new Map;
@@ -6501,6 +6555,7 @@ function createSettings(context) {
6501
6555
  if (context.searching())
6502
6556
  context.leaveSearch();
6503
6557
  editingKeys = true;
6558
+ placeKeep();
6504
6559
  render();
6505
6560
  focusView("keys");
6506
6561
  }
@@ -6582,7 +6637,10 @@ function createSettings(context) {
6582
6637
  stopRecording,
6583
6638
  openKeys,
6584
6639
  leaveKeys,
6585
- destroy: stopRefusing
6640
+ destroy() {
6641
+ stopRefusing();
6642
+ keepEdits.destroy();
6643
+ }
6586
6644
  };
6587
6645
  }
6588
6646
 
@@ -7974,12 +8032,41 @@ input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-
7974
8032
  min-height: 96px;
7975
8033
  max-height: 85vh;
7976
8034
  overflow: auto;
7977
- resize: vertical;
7978
8035
  overscroll-behavior: contain;
7979
8036
  scrollbar-width: thin;
7980
8037
  scrollbar-color: var(--line) transparent;
7981
8038
  }
7982
8039
  .dom[style*="height"] { flex-grow: 0; }
8040
+ /* The line between the tree and the styles, which drags for the tree's
8041
+ height as the browser's own does: 7 tall to the pointer, -4 in the flow
8042
+ so with the two 4px gaps 4 stay between the tree and the styles, a
8043
+ hairline at 2 of them that darkens under the pointer, the keys' focus or a
8044
+ drag. */
8045
+ .dom-split {
8046
+ position: relative;
8047
+ flex: none;
8048
+ height: 7px;
8049
+ margin: -5px 0 -6px;
8050
+ cursor: row-resize;
8051
+ touch-action: none;
8052
+ user-select: none;
8053
+ -webkit-user-select: none;
8054
+ outline: none;
8055
+ z-index: 1;
8056
+ }
8057
+ .dom-split::after {
8058
+ content: "";
8059
+ position: absolute;
8060
+ left: 0;
8061
+ right: 0;
8062
+ top: 3px;
8063
+ height: 1px;
8064
+ background: var(--line);
8065
+ transition: background-color 120ms ease-out;
8066
+ }
8067
+ .dom-split:hover::after,
8068
+ .dom-split:focus-visible::after,
8069
+ .dom-split[data-drag]::after { background: var(--faint); }
7983
8070
  .dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
7984
8071
  .dom-row {
7985
8072
  display: flex;
@@ -8336,8 +8423,6 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
8336
8423
  .changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
8337
8424
  .changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
8338
8425
  /* The switch that keeps the edits after a reload, over the tree. */
8339
- .keep-line { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
8340
- .keep-line .knob-label { color: var(--fg); }
8341
8426
  .changes-list {
8342
8427
  max-height: 30vh;
8343
8428
  overflow: auto;
@@ -8775,6 +8860,7 @@ function createPanel(options2 = {}) {
8775
8860
  setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
8776
8861
  realPhone: hostSendsUa(),
8777
8862
  setRealPhone: (on) => setState({ panel: { realPhone: on } }),
8863
+ keep: keeper,
8778
8864
  native: nativeSwitch()?.setting ?? null,
8779
8865
  setNative: (on) => {
8780
8866
  nativeSwitch()?.setting.change(on);
@@ -9231,7 +9317,7 @@ function createPanel(options2 = {}) {
9231
9317
  }
9232
9318
 
9233
9319
  // src/version.ts
9234
- var VERSION = "0.6.0";
9320
+ var VERSION = "0.6.2";
9235
9321
 
9236
9322
  // src/index.ts
9237
9323
  var PRESETS = {
@@ -9534,7 +9620,7 @@ async function grab(elements, options2) {
9534
9620
  const host = hosted("grab");
9535
9621
  if (host)
9536
9622
  return host(elements, options2);
9537
- const loaded = await import("./index-f67wctn3.js");
9623
+ const loaded = await import("./index-44a62hfx.js");
9538
9624
  return loaded.grab(elements, options2);
9539
9625
  }
9540
9626
  function edits2() {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  frameWindow,
7
7
  subscribe
8
- } from "./react-cs62p9qh.js";
8
+ } from "./react-myz2rvvn.js";
9
9
  import {
10
10
  inField,
11
11
  isFunctionKey,
@@ -165,7 +165,7 @@ function systemScheme() {
165
165
  host.remove();
166
166
  return dark ? "dark" : "light";
167
167
  }
168
- function createGrab(options = {}, loadMode = () => import("./index-kfdzsyyw.js")) {
168
+ function createGrab(options = {}, loadMode = () => import("./index-xeg2j4r8.js")) {
169
169
  const keyNow = options.key ?? defaultGrabKey;
170
170
  const { purpose } = options;
171
171
  const channel = purpose?.channel ?? "grab";
@@ -374,7 +374,7 @@ function held(view) {
374
374
  return null;
375
375
  }
376
376
  }
377
- function createInspect(options = {}, load = () => import("./index-kfdzsyyw.js"), frameOf = frameWindow) {
377
+ function createInspect(options = {}, load = () => import("./index-xeg2j4r8.js"), frameOf = frameWindow) {
378
378
  const inFrame = isDevknobsFrame();
379
379
  const listeners = new Set;
380
380
  let outliner = null;
@@ -1776,7 +1776,7 @@ function pause(on) {
1776
1776
 
1777
1777
  // src/engine/frames.ts
1778
1778
  var kit = null;
1779
- var load2 = () => import("./framekit-622h6w1f.js");
1779
+ var load2 = () => import("./framekit-h0jrc5gs.js");
1780
1780
  var loading = null;
1781
1781
  var down = false;
1782
1782
  var waiting = [];
@@ -8,7 +8,7 @@ import {
8
8
  } from "./react-bxzn8vq5.js";
9
9
  import {
10
10
  getState
11
- } from "./react-cs62p9qh.js";
11
+ } from "./react-myz2rvvn.js";
12
12
  import {
13
13
  icon
14
14
  } from "./react-6q2cw2ya.js";
@@ -210,7 +210,7 @@ function createPane(context) {
210
210
  // src/ui/storageaction.ts
211
211
  var STORAGE_VIEW = "storage";
212
212
  function load() {
213
- return import("./storageview-6xj7zb63.js").then((loaded) => loaded.storageView({
213
+ return import("./storageview-rs5drb7m.js").then((loaded) => loaded.storageView({
214
214
  visible: () => getState().panel.open && !document.hidden
215
215
  }));
216
216
  }
package/dist/react.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  createGrab,
14
14
  createInspect,
15
15
  oneAtATime
16
- } from "./react-v8497a41.js";
16
+ } from "./react-c98apxzz.js";
17
17
  import {
18
18
  hushOnce
19
19
  } from "./react-1gqwa2yw.js";
@@ -49,6 +49,7 @@ import {
49
49
  edits,
50
50
  forgetReplay,
51
51
  framedPage,
52
+ keeper,
52
53
  pageSettled,
53
54
  pathNow,
54
55
  startKeep,
@@ -70,7 +71,7 @@ import {
70
71
  showPane,
71
72
  stopOnLoad,
72
73
  viewHead
73
- } from "./react-6t4dbdzn.js";
74
+ } from "./react-vtcq394z.js";
74
75
  import {
75
76
  actButton,
76
77
  button,
@@ -144,7 +145,7 @@ import {
144
145
  watchHinge,
145
146
  watchPanel,
146
147
  zoomKey
147
- } from "./react-cs62p9qh.js";
148
+ } from "./react-myz2rvvn.js";
148
149
  import {
149
150
  MAT_COLORS,
150
151
  MAT_COLOR_NAMES,
@@ -2637,7 +2638,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
2637
2638
  function here(element) {
2638
2639
  return element.isConnected && element.ownerDocument.defaultView !== null;
2639
2640
  }
2640
- function createInspector(context, load = () => import("./elementsview-fyc06wjt.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2641
+ function createInspector(context, load = () => import("./elementsview-ffh56hbj.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
2641
2642
  const { inspect, tips, prefs } = context;
2642
2643
  const listeners = new Set;
2643
2644
  let view = null;
@@ -6333,6 +6334,51 @@ function handleHint(keys, mac) {
6333
6334
  return `press ${comboLabel(keys.panel, mac)} to open knobs`;
6334
6335
  }
6335
6336
  var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
6337
+ var KEEP_LABEL = "keep edits after reload";
6338
+ var KEEP_HINT = "keeps your Elements edits on this page after a reload.";
6339
+ function keepRow(resolve) {
6340
+ const control = button("switch row-control", "");
6341
+ control.setAttribute("role", "switch");
6342
+ control.setAttribute("aria-label", KEEP_LABEL);
6343
+ const hint = el("div", "row-hint", KEEP_HINT);
6344
+ hint.id = "devknobs-keep-hint";
6345
+ control.setAttribute("aria-describedby", hint.id);
6346
+ const node = rowBox({
6347
+ main: el("div", "main"),
6348
+ glyph: icon("rotate-ccw"),
6349
+ title: KEEP_LABEL,
6350
+ ends: [control]
6351
+ }).box;
6352
+ node.append(hint);
6353
+ let keep = null;
6354
+ let stop2 = null;
6355
+ const draw = () => {
6356
+ if (!keep)
6357
+ return;
6358
+ mark(control, keep.on(), "aria-checked");
6359
+ control.disabled = !keep.known();
6360
+ };
6361
+ control.addEventListener("click", () => keep?.set(!keep.on()));
6362
+ function sync() {
6363
+ const now2 = resolve();
6364
+ if (now2 !== keep) {
6365
+ stop2?.();
6366
+ keep = now2;
6367
+ stop2 = keep ? keep.subscribe(draw) : null;
6368
+ }
6369
+ node.hidden = !keep;
6370
+ draw();
6371
+ }
6372
+ sync();
6373
+ return {
6374
+ node,
6375
+ sync,
6376
+ destroy() {
6377
+ stop2?.();
6378
+ stop2 = null;
6379
+ }
6380
+ };
6381
+ }
6336
6382
  function createSettings(context) {
6337
6383
  const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
6338
6384
  const keysView = el("div", "keys pane");
@@ -6419,12 +6465,20 @@ function createSettings(context) {
6419
6465
  const devIconSwitch = button("switch row-control", "");
6420
6466
  devIconSwitch.setAttribute("role", "switch");
6421
6467
  devIconSwitch.setAttribute("aria-label", "dev tab icon");
6422
- keysView.append(rowBox({
6468
+ const devIconRow = rowBox({
6423
6469
  main: el("div", "main"),
6424
6470
  glyph: icon("image"),
6425
6471
  title: "dev tab icon",
6426
6472
  ends: [devIconSwitch]
6427
- }).box);
6473
+ }).box;
6474
+ keysView.append(devIconRow);
6475
+ const keepEdits = keepRow(context.keep);
6476
+ const placeKeep = () => {
6477
+ keepEdits.sync();
6478
+ if (!keepEdits.node.hidden && !keysView.contains(keepEdits.node))
6479
+ keysView.insertBefore(keepEdits.node, devIconRow);
6480
+ };
6481
+ placeKeep();
6428
6482
  devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
6429
6483
  keysView.append(rowsLabel("shortcuts"));
6430
6484
  const keyViews = new Map;
@@ -6504,6 +6558,7 @@ function createSettings(context) {
6504
6558
  if (context.searching())
6505
6559
  context.leaveSearch();
6506
6560
  editingKeys = true;
6561
+ placeKeep();
6507
6562
  render();
6508
6563
  focusView("keys");
6509
6564
  }
@@ -6585,7 +6640,10 @@ function createSettings(context) {
6585
6640
  stopRecording,
6586
6641
  openKeys,
6587
6642
  leaveKeys,
6588
- destroy: stopRefusing
6643
+ destroy() {
6644
+ stopRefusing();
6645
+ keepEdits.destroy();
6646
+ }
6589
6647
  };
6590
6648
  }
6591
6649
 
@@ -7977,12 +8035,41 @@ input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-
7977
8035
  min-height: 96px;
7978
8036
  max-height: 85vh;
7979
8037
  overflow: auto;
7980
- resize: vertical;
7981
8038
  overscroll-behavior: contain;
7982
8039
  scrollbar-width: thin;
7983
8040
  scrollbar-color: var(--line) transparent;
7984
8041
  }
7985
8042
  .dom[style*="height"] { flex-grow: 0; }
8043
+ /* The line between the tree and the styles, which drags for the tree's
8044
+ height as the browser's own does: 7 tall to the pointer, -4 in the flow
8045
+ so with the two 4px gaps 4 stay between the tree and the styles, a
8046
+ hairline at 2 of them that darkens under the pointer, the keys' focus or a
8047
+ drag. */
8048
+ .dom-split {
8049
+ position: relative;
8050
+ flex: none;
8051
+ height: 7px;
8052
+ margin: -5px 0 -6px;
8053
+ cursor: row-resize;
8054
+ touch-action: none;
8055
+ user-select: none;
8056
+ -webkit-user-select: none;
8057
+ outline: none;
8058
+ z-index: 1;
8059
+ }
8060
+ .dom-split::after {
8061
+ content: "";
8062
+ position: absolute;
8063
+ left: 0;
8064
+ right: 0;
8065
+ top: 3px;
8066
+ height: 1px;
8067
+ background: var(--line);
8068
+ transition: background-color 120ms ease-out;
8069
+ }
8070
+ .dom-split:hover::after,
8071
+ .dom-split:focus-visible::after,
8072
+ .dom-split[data-drag]::after { background: var(--faint); }
7986
8073
  .dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
7987
8074
  .dom-row {
7988
8075
  display: flex;
@@ -8339,8 +8426,6 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
8339
8426
  .changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
8340
8427
  .changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
8341
8428
  /* 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
8429
  .changes-list {
8345
8430
  max-height: 30vh;
8346
8431
  overflow: auto;
@@ -8778,6 +8863,7 @@ function createPanel(options2 = {}) {
8778
8863
  setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
8779
8864
  realPhone: hostSendsUa(),
8780
8865
  setRealPhone: (on) => setState({ panel: { realPhone: on } }),
8866
+ keep: keeper,
8781
8867
  native: nativeSwitch()?.setting ?? null,
8782
8868
  setNative: (on) => {
8783
8869
  nativeSwitch()?.setting.change(on);
@@ -9234,7 +9320,7 @@ function createPanel(options2 = {}) {
9234
9320
  }
9235
9321
 
9236
9322
  // src/version.ts
9237
- var VERSION = "0.6.0";
9323
+ var VERSION = "0.6.2";
9238
9324
  // src/index.ts
9239
9325
  var panel = null;
9240
9326
  var stopKeys = null;
@@ -9528,7 +9614,7 @@ async function grab(elements, options2) {
9528
9614
  const host = hosted("grab");
9529
9615
  if (host)
9530
9616
  return host(elements, options2);
9531
- const loaded = await import("./index-kfdzsyyw.js");
9617
+ const loaded = await import("./index-xeg2j4r8.js");
9532
9618
  return loaded.grab(elements, options2);
9533
9619
  }
9534
9620
  function edits2() {
@@ -5,7 +5,7 @@ import {
5
5
  cookieText,
6
6
  put,
7
7
  storedPresets
8
- } from "./index-aynkv7qk.js";
8
+ } from "./index-v67kqq9p.js";
9
9
  import {
10
10
  copyText
11
11
  } from "./index-ztnjefrh.js";
@@ -31,7 +31,7 @@ import {
31
31
  textField,
32
32
  toolbar
33
33
  } from "./index-4a4x1bt2.js";
34
- import"./index-x59vz1xx.js";
34
+ import"./index-ggf32ddy.js";
35
35
  import"./index-7cb4x1vj.js";
36
36
  import {
37
37
  icon
@@ -6,7 +6,7 @@ import {
6
6
  cookieText,
7
7
  put,
8
8
  storedPresets
9
- } from "./react-6t4dbdzn.js";
9
+ } from "./react-vtcq394z.js";
10
10
  import {
11
11
  copyText
12
12
  } from "./react-h9w04skh.js";
@@ -32,7 +32,7 @@ import {
32
32
  textField,
33
33
  toolbar
34
34
  } from "./react-bxzn8vq5.js";
35
- import"./react-cs62p9qh.js";
35
+ import"./react-myz2rvvn.js";
36
36
  import"./react-ttj8f9qp.js";
37
37
  import {
38
38
  icon
@@ -9,8 +9,8 @@
9
9
  * and the edits are listed at the foot, with Z to undo and ⇧Z to redo while
10
10
  * the focus is in the view and not in a field. Where an undo takes away the
11
11
  * node selected, as one of an element written anew as html, the node put
12
- * back in its place is selected. A switch at the top keeps the edits after a
13
- * reload, as `edit/keep.ts` says. To use it, as the styles view:
12
+ * back in its place is selected. A switch in the settings keeps the edits
13
+ * after a reload, as `edit/keep.ts` says. To use it, as the styles view:
14
14
  *
15
15
  * const view = createElementsView(context);
16
16
  * body.append(view.node); view.show(element); view.destroy();
@@ -30,11 +30,9 @@ export interface ElementsParts {
30
30
  copy?: Copy;
31
31
  /** The log the edits go to. Defaults to the page's one. */
32
32
  edits?: EditLog;
33
- /** What keeps the edits after a reload. Defaults to the page's one; without one the view has no switch. */
33
+ /** What keeps the edits after a reload. Defaults to the page's one. */
34
34
  keep?: Keeper | null;
35
35
  }
36
- /** What the switch at the top of the view says. */
37
- export declare const KEEP_LABEL = "keep edits after reload";
38
36
  /** Whether a keydown is the view's undo, z, or its redo, shift z: no other modifier, and not in a field. */
39
37
  export declare function undoKey(event: KeyboardEvent): "undo" | "redo" | null;
40
38
  /**
@@ -1,3 +1,4 @@
1
+ import type { Keeper } from "../edit/keep";
1
2
  import type { GrabControl } from "../grab/control";
2
3
  import { type PreferValue } from "../host";
3
4
  import { type LiveKeys } from "./bindings";
@@ -7,7 +8,7 @@ import { type Tips } from "./tooltip";
7
8
  /**
8
9
  * The settings view, which slides in over the rows: whether the handle shows
9
10
  * while the panel is closed, the host's switch for its native driver where it
10
- * gives one, which copy runs the panel where a host gives the choice, whether the tab's icon has the dev ribbon, and each binding's
11
+ * gives one, which copy runs the panel where a host gives the choice, whether the page keeps its Elements edits after a reload, whether the tab's icon has the dev ribbon, and each binding's
11
12
  * key, recorded from the next
12
13
  * keys pressed. A key a binding cannot take is refused, and the chip says why.
13
14
  */
@@ -48,6 +49,8 @@ export interface SettingsContext {
48
49
  realPhone: boolean;
49
50
  /** The user turned real phone mode off or on. */
50
51
  setRealPhone(on: boolean): void;
52
+ /** What keeps the page's edits after a reload, null with none. It starts after the panel, so it is asked again as the settings open. */
53
+ keep(): Keeper | null;
51
54
  /** The words of the host's switch for its native driver, null with none. */
52
55
  native: {
53
56
  label: string;
@@ -92,4 +95,20 @@ export interface Settings {
92
95
  }
93
96
  /** What real phone mode costs, under its switch. */
94
97
  export declare const REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
98
+ /** The title of the switch that keeps the page's edits after a reload. */
99
+ export declare const KEEP_LABEL = "keep edits after reload";
100
+ /** What the keep switch does, under it. */
101
+ export declare const KEEP_HINT = "keeps your Elements edits on this page after a reload.";
102
+ export interface KeepRow {
103
+ /** The row, hidden while there is no keeper. */
104
+ node: HTMLElement;
105
+ /** Ask for the keeper again, and show it. */
106
+ sync(): void;
107
+ destroy(): void;
108
+ }
109
+ /**
110
+ * The switch that keeps the page's edits after a reload, as the keeper has
111
+ * it, and off to a click until the keeper knows what the page keeps.
112
+ */
113
+ export declare function keepRow(resolve: () => Keeper | null): KeepRow;
95
114
  export declare function createSettings(context: SettingsContext): Settings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinena/knobs",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mert Düzgün",
@@ -215,7 +215,7 @@ component renders. Make each one
215
215
  in the component or template that renders the element, never by patching the
216
216
  DOM from a script: they were made on the live DOM, and the framework's next
217
217
  render may undo them. The edits live on the page: a reload drops them, unless
218
- the user turned on `keep edits after reload` at the top of the Elements view,
218
+ the user turned on `keep edits after reload` in the panel's settings,
219
219
  which makes them again as the page loads where it still has their targets.
220
220
 
221
221
  To try the edits again on a fresh load, before or after they are in the code,