@vinena/knobs 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/dist/cli.js +2 -2
  4. package/dist/{context-eawqn680.js → context-2r76ext7.js} +3 -3
  5. package/dist/{context-vd2xep5t.js → context-h1bdt8w3.js} +3 -3
  6. package/dist/early.global.js +7 -8
  7. package/dist/edit/html.d.ts +7 -3
  8. package/dist/edit/keep.d.ts +1 -1
  9. package/dist/{elementsview-m33ejs4r.js → elementsview-mcg6d5zp.js} +21 -19
  10. package/dist/{elementsview-jg4edt86.js → elementsview-mwr1s17z.js} +21 -19
  11. package/dist/engine/bezels.d.ts +2 -2
  12. package/dist/engine/check.d.ts +2 -2
  13. package/dist/engine/describe.d.ts +2 -2
  14. package/dist/engine/devices.d.ts +3 -3
  15. package/dist/engine/fit.d.ts +4 -4
  16. package/dist/engine/foldhand.d.ts +2 -2
  17. package/dist/engine/frame.d.ts +6 -6
  18. package/dist/engine/frames.d.ts +4 -4
  19. package/dist/engine/fresh.d.ts +12 -5
  20. package/dist/engine/header.d.ts +3 -1
  21. package/dist/engine/identity.d.ts +4 -4
  22. package/dist/engine/index.d.ts +7 -7
  23. package/dist/engine/locale.d.ts +2 -2
  24. package/dist/engine/morph.d.ts +2 -2
  25. package/dist/engine/native.d.ts +8 -8
  26. package/dist/engine/placeholder.d.ts +3 -3
  27. package/dist/engine/reload.d.ts +2 -2
  28. package/dist/engine/screen.d.ts +2 -2
  29. package/dist/engine/scrollkeep.d.ts +1 -1
  30. package/dist/engine/store.d.ts +11 -11
  31. package/dist/engine/storekeys.d.ts +34 -0
  32. package/dist/engine/style.d.ts +1 -1
  33. package/dist/engine/tabicon.d.ts +2 -2
  34. package/dist/engine/underneath.d.ts +1 -0
  35. package/dist/engine/width.d.ts +3 -3
  36. package/dist/{framekit-40pzennw.js → framekit-4v7nc3ea.js} +23 -18
  37. package/dist/{framekit-r16k97n7.js → framekit-wyppj1se.js} +23 -18
  38. package/dist/grab/clipboard.d.ts +2 -0
  39. package/dist/{index-jfv7vavj.js → index-311fys81.js} +93 -29
  40. package/dist/index-3dcgysws.js +77 -0
  41. package/dist/{index-s6fya8pm.js → index-3s4v7gw5.js} +11 -10
  42. package/dist/{index-ztnjefrh.js → index-585hs9tp.js} +5 -1
  43. package/dist/{index-za4ppxay.js → index-6t0w5s7p.js} +1 -1
  44. package/dist/{index-0qkj2mgb.js → index-82y8x8vv.js} +14 -11
  45. package/dist/{index-tqq2ygpj.js → index-9targr2f.js} +26 -16
  46. package/dist/{index-8d1yk9d2.js → index-a23nv5j4.js} +59 -39
  47. package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
  48. package/dist/{index-s6yzsvs4.js → index-bgzyc7rz.js} +22 -15
  49. package/dist/{index-xxbb8y41.js → index-c1t6knbf.js} +20 -14
  50. package/dist/{index-3nwycv3p.js → index-cqymjce4.js} +20 -14
  51. package/dist/{index-v2v4rmpe.js → index-dvtbh3c8.js} +24 -18
  52. package/dist/{index-cb91vcka.js → index-k4w5v53q.js} +1 -1
  53. package/dist/{index-q53j8wg5.js → index-n31pn4ax.js} +19 -15
  54. package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
  55. package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
  56. package/dist/{index-2jc9dnta.js → index-vhda420r.js} +11 -5
  57. package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
  58. package/dist/{index-fjrrgd9h.js → index-vmz7htwn.js} +1 -1
  59. package/dist/index.d.ts +14 -8
  60. package/dist/index.global.js +159 -159
  61. package/dist/index.js +57 -32
  62. package/dist/instance.d.ts +7 -1
  63. package/dist/mark.d.ts +50 -0
  64. package/dist/{react-0gxs9aef.js → react-4ezjf7mq.js} +24 -18
  65. package/dist/react-4qn9vsjw.js +78 -0
  66. package/dist/{react-73reavv4.js → react-4tcwpama.js} +1 -1
  67. package/dist/{react-6ngtb6p9.js → react-7eyps0cg.js} +1 -1
  68. package/dist/{react-vvc4x9kq.js → react-7tzwahsm.js} +14 -11
  69. package/dist/{react-yx3g9k55.js → react-amvrbng8.js} +5 -2
  70. package/dist/{react-5rq7bnsy.js → react-atw9y8ny.js} +5 -1
  71. package/dist/{react-4phtr2nd.js → react-dg4bjv3j.js} +1 -1
  72. package/dist/{react-meve34wp.js → react-hdneb4v3.js} +11 -5
  73. package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
  74. package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
  75. package/dist/{react-zp7fdw8e.js → react-ppyj3fg2.js} +59 -39
  76. package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
  77. package/dist/{react-actmnkwp.js → react-rxw73n04.js} +1 -1
  78. package/dist/{react-5h7pxnax.js → react-tet7swk2.js} +22 -15
  79. package/dist/{react-8nmtt0ge.js → react-w94cfn87.js} +19 -15
  80. package/dist/{react-fq4551ks.js → react-wzd3cfg8.js} +11 -10
  81. package/dist/{react-3ev6rwqz.js → react-x209et38.js} +26 -16
  82. package/dist/react.d.ts +3 -1
  83. package/dist/react.js +60 -33
  84. package/dist/{replay-pmesjfa3.js → replay-3xqgt3xg.js} +8 -8
  85. package/dist/{replay-m5g8km9y.js → replay-48gn27bj.js} +8 -8
  86. package/dist/storage/onload.d.ts +1 -1
  87. package/dist/{storageview-9a6zm47z.js → storageview-2rvwk0v7.js} +16 -13
  88. package/dist/{storageview-x62v1c3j.js → storageview-6vq7nz02.js} +16 -13
  89. package/dist/styles/force.d.ts +3 -1
  90. package/dist/types.d.ts +4 -4
  91. package/dist/ui/actions.d.ts +3 -3
  92. package/dist/ui/bindings.d.ts +1 -1
  93. package/dist/ui/catalog.d.ts +14 -14
  94. package/dist/ui/changes.d.ts +1 -1
  95. package/dist/ui/colors.d.ts +1 -1
  96. package/dist/ui/deviceknobs.d.ts +2 -2
  97. package/dist/ui/editors.d.ts +3 -3
  98. package/dist/ui/foldslider.d.ts +2 -2
  99. package/dist/ui/keys.d.ts +1 -1
  100. package/dist/ui/list.d.ts +10 -10
  101. package/dist/ui/palette.d.ts +2 -2
  102. package/dist/ui/pin.d.ts +2 -2
  103. package/dist/ui/prefs.d.ts +1 -1
  104. package/dist/ui/rows.d.ts +3 -3
  105. package/dist/ui/storageview.d.ts +2 -2
  106. package/dist/ui/stylesview.d.ts +3 -3
  107. package/dist/ui/swatches.d.ts +2 -2
  108. package/package.json +1 -1
  109. package/skills/knobs/SKILL.md +36 -35
  110. package/dist/index-5tv6sr74.js +0 -23
  111. package/dist/react-t2qnewz2.js +0 -24
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The names of the items knobs keeps in web storage. Each is `knobs` or
3
+ * `knobs:<name>`, and was `devknobs` or `devknobs:<name>` before the rename.
4
+ * An old copy (an npm copy before 0.8, or the 0.7 extension) and a new copy
5
+ * can share one origin. The old copy reads and writes the old name only, and
6
+ * a new copy writes both names with one value, so where the two differ, the
7
+ * old copy wrote last. While both are written, the old name is the truth: a
8
+ * read takes the old item, a write puts the old item first and then the new
9
+ * one, a remove drops both, and an item is listed only where its old name is.
10
+ *
11
+ * Writing the old items goes away two minor releases after 0.8. That release
12
+ * must copy each old item to its new name once, then read the new name only,
13
+ * and drop the old item on every write, so a stale old item never comes back.
14
+ */
15
+ /** A key as a copy before the rename wrote it: `knobs:x` was `devknobs:x`. */
16
+ export declare function oldKey(key: string): string;
17
+ /** The new name of an item knobs keeps, old or new, or null for one of the page's. */
18
+ export declare function ownName(key: string): string | null;
19
+ /** Is `key` an item knobs keeps for itself, under either name, and not one of the page's? */
20
+ export declare function isOwnKey(key: string): boolean;
21
+ /** Does a storage event's key name the item `key`, under either name? */
22
+ export declare function sameItem(eventKey: string | null, key: string): boolean;
23
+ /**
24
+ * The item `key`, read under its old name where it has one. A new item with
25
+ * no old one beside it is not read: an old copy removes the old name only, so
26
+ * that new item is one the old copy removed.
27
+ */
28
+ export declare function readItem(storage: Storage | null | undefined, key: string): string | null;
29
+ /** Write the item `key` under both names, the old one first, so a refused second write leaves the truth current. */
30
+ export declare function writeItem(storage: Storage | null | undefined, key: string, value: string): void;
31
+ /** Drop the item `key` under both names. */
32
+ export declare function removeItem(storage: Storage | null | undefined, key: string): void;
33
+ /** The new names of the items that start with `prefix`, a new name, listed where their old name is, as `readItem` reads them. */
34
+ export declare function itemKeys(storage: Storage, prefix: string): string[];
@@ -36,7 +36,7 @@ export interface SwitchedSheet {
36
36
  export declare function switchedSheet(root: Root, name: string): SwitchedSheet | null;
37
37
  /** The sheet devknobs keeps on the page under `name`, if it has one. */
38
38
  export declare function findStyle(name: string, doc?: Document): OwnStyle | null;
39
- /** Every node devknobs adds to the page carries `data-devknobs`. */
39
+ /** Every node devknobs adds to the page carries `data-knobs` and `data-devknobs`. */
40
40
  export declare function ensureStyle(name: string, doc?: Document): OwnStyle;
41
41
  export declare function removeStyle(name: string, doc?: Document): void;
42
42
  export {};
@@ -9,9 +9,9 @@ import { type IconSource } from "./devicon";
9
9
  * links on a navigation gets its new ones drawn too.
10
10
  */
11
11
  /** Where a link keeps the address it had before the ribbon. */
12
- export declare const ORIGINAL_HREF = "data-devknobs-href";
12
+ export declare const ORIGINAL_HREF: "data-devknobs-href";
13
13
  /** Marks the icon link devknobs added, on a page with none, for its `/favicon.ico`. */
14
- export declare const ADDED_ICON = "data-devknobs-icon";
14
+ export declare const ADDED_ICON: "data-devknobs-icon";
15
15
  /** Whether a host is this machine or the local network, where a page is a dev one. */
16
16
  export declare function localHost(hostname: string): boolean;
17
17
  /** Whether the ribbon shows on a host: `auto` on a local one only. */
@@ -1,3 +1,4 @@
1
+ /** `showModal` as the page had it, while the page underneath gets plain dialogs. */
1
2
  /**
2
3
  * Hide the page under the frame, what it adds to the body later too, and give
3
4
  * it plain dialogs, until `uncover`.
@@ -1,10 +1,10 @@
1
- import type { DevknobsState, ZoomValue } from "../types";
1
+ import type { KnobsState, ZoomValue } from "../types";
2
2
  import { type Docked } from "./dock";
3
3
  import { type FrameKnobs, type ZoomAction } from "./frame";
4
4
  import { type FrameRefusal } from "./native";
5
5
  export { type Fit, fit, label, origin, STRIP } from "./fit";
6
6
  /** What the frame takes from the knobs. */
7
- export type ViewportValue = FrameKnobs & Pick<DevknobsState, "scheme" | "device" | "orientation" | "posture" | "mock" | "browser" | "bars" | "edgeToEdge" | "zoom" | "mat"> & {
7
+ export type ViewportValue = FrameKnobs & Pick<KnobsState, "scheme" | "device" | "orientation" | "posture" | "mock" | "browser" | "bars" | "edgeToEdge" | "zoom" | "mat"> & {
8
8
  panel: Docked;
9
9
  };
10
10
  /**
@@ -24,7 +24,7 @@ export declare const COVER_CAP: number;
24
24
  /** The window inside the frame, while there is one. */
25
25
  export declare function frameWindow(): Window | null;
26
26
  /** Keep the knobs and hand them to the frame, which applies them to its own page. */
27
- export declare function sync(state: DevknobsState): void;
27
+ export declare function sync(state: KnobsState): void;
28
28
  export declare function onExit(handler: (() => void) | null): void;
29
29
  export declare function onRefused(handler: ((url: string) => Promise<FrameRefusal | null>) | null): void;
30
30
  export declare function onFramed(handler: ((open: boolean) => void | Promise<void>) | null): void;
@@ -24,7 +24,7 @@ import {
24
24
  turnOf,
25
25
  turnedPose,
26
26
  windowRect
27
- } from "./index-cb91vcka.js";
27
+ } from "./index-k4w5v53q.js";
28
28
  import {
29
29
  hush,
30
30
  hushOnce,
@@ -38,7 +38,7 @@ import {
38
38
  } from "./index-58jdczmj.js";
39
39
  import {
40
40
  copyText
41
- } from "./index-ztnjefrh.js";
41
+ } from "./index-585hs9tp.js";
42
42
  import {
43
43
  BARS_START,
44
44
  DOT_LOOK,
@@ -82,7 +82,7 @@ import {
82
82
  uaPreset,
83
83
  userAgentOf,
84
84
  viewportOf
85
- } from "./index-s6yzsvs4.js";
85
+ } from "./index-bgzyc7rz.js";
86
86
  import {
87
87
  FRAME_ATTRIBUTE,
88
88
  FRAME_NAME,
@@ -124,11 +124,16 @@ import {
124
124
  turn,
125
125
  walkRules,
126
126
  wheelZoom
127
- } from "./index-jfv7vavj.js";
127
+ } from "./index-311fys81.js";
128
128
  import"./index-a974q3aa.js";
129
129
  import {
130
- __export
131
- } from "./index-5tv6sr74.js";
130
+ __export,
131
+ findOwn,
132
+ isMarked,
133
+ markOwn,
134
+ ownSelector,
135
+ setMark
136
+ } from "./index-3dcgysws.js";
132
137
 
133
138
  // src/engine/width.ts
134
139
  var exports_width = {};
@@ -4829,7 +4834,7 @@ function shootPage(frame2, glass, size, color, layout = "") {
4829
4834
  const draw = (node, alpha, lifted) => {
4830
4835
  if (seen++ > MOST || seen % 50 === 0 && performance.now() > deadline)
4831
4836
  return;
4832
- if (node.hasAttribute("data-devknobs"))
4837
+ if (isMarked(node))
4833
4838
  return;
4834
4839
  const style = view.getComputedStyle(node);
4835
4840
  if (style.display === "none")
@@ -5035,12 +5040,12 @@ ${own.join(`
5035
5040
  if (!node || !copy)
5036
5041
  continue;
5037
5042
  if (leave?.(node))
5038
- copy.setAttribute("data-devknobs", "");
5043
+ markOwn(copy);
5039
5044
  pin(node, copy);
5040
5045
  }
5041
5046
  }
5042
5047
  blankPictures(doc.documentElement, root);
5043
- for (const node of root.querySelectorAll("script, link, style, noscript, [data-devknobs]"))
5048
+ for (const node of root.querySelectorAll(`script, link, style, noscript, ${ownSelector()}`))
5044
5049
  node.remove();
5045
5050
  const style = inert.createElement("style");
5046
5051
  style.textContent = frozen.rules.join(`
@@ -5088,7 +5093,7 @@ async function paintPage(frame2, glass, size, color, copy) {
5088
5093
  const at = { x: (box2.left - screen.left) * css, y: (box2.top - screen.top) * css };
5089
5094
  let over2 = null;
5090
5095
  for (const node of doc.querySelectorAll(MEDIA)) {
5091
- const media = node.closest("[data-devknobs]") ? null : mediaOf(node);
5096
+ const media = node.closest(ownSelector()) ? null : mediaOf(node);
5092
5097
  const rect = node.getBoundingClientRect();
5093
5098
  if (!media || rect.bottom <= 0 || rect.top >= height || rect.width <= 0)
5094
5099
  continue;
@@ -8493,7 +8498,7 @@ var bodyObserver = null;
8493
8498
  function hide(node) {
8494
8499
  if (!(node instanceof HTMLElement || node instanceof SVGElement))
8495
8500
  return;
8496
- if (node.hasAttribute("data-devknobs") || hidden.has(node))
8501
+ if (isMarked(node) || hidden.has(node))
8497
8502
  return;
8498
8503
  const style = node.style;
8499
8504
  hidden.set(node, {
@@ -8524,7 +8529,7 @@ function holdModals() {
8524
8529
  const native = HTMLDialogElement.prototype.showModal;
8525
8530
  showModal = native;
8526
8531
  HTMLDialogElement.prototype.showModal = function() {
8527
- if (this.closest("[data-devknobs]"))
8532
+ if (this.closest(ownSelector()))
8528
8533
  native.call(this);
8529
8534
  else
8530
8535
  this.show();
@@ -8534,7 +8539,7 @@ function holdModals() {
8534
8539
  modals = Array.from(document.querySelectorAll("dialog:modal"));
8535
8540
  } catch {}
8536
8541
  for (const dialog of modals) {
8537
- if (dialog.closest("[data-devknobs]"))
8542
+ if (dialog.closest(ownSelector()))
8538
8543
  continue;
8539
8544
  dialog.close();
8540
8545
  dialog.show();
@@ -9091,7 +9096,7 @@ function showZoom(place2) {
9091
9096
  picker.value = String(zoom);
9092
9097
  }
9093
9098
  function panelWidth() {
9094
- return document.querySelector('[data-devknobs="panel"]')?.offsetWidth ?? 0;
9099
+ return findOwn(document, "panel")?.offsetWidth ?? 0;
9095
9100
  }
9096
9101
  function asideOf(panel) {
9097
9102
  return panel.open && !panel.docked ? panelWidth() : 0;
@@ -9524,7 +9529,7 @@ function hidePage() {
9524
9529
  covered = true;
9525
9530
  cover2(body);
9526
9531
  const style = ensureStyle(NAME);
9527
- style.textContent = "html{overflow:hidden!important}:popover-open:not([data-devknobs]){display:none!important}";
9532
+ style.textContent = `html{overflow:hidden!important}:popover-open:not(${ownSelector()}){display:none!important}`;
9528
9533
  const node = styleNode(style);
9529
9534
  if (node)
9530
9535
  stopKeepingStyle = keepMounted(node, { home: () => document.head ?? document.documentElement });
@@ -9649,7 +9654,7 @@ function open(veiled, first) {
9649
9654
  if (host || !needsFrame(current) || !body)
9650
9655
  return;
9651
9656
  host = document.createElement("div");
9652
- host.setAttribute("data-devknobs", "viewport");
9657
+ markOwn(host, "viewport");
9653
9658
  host.style.cssText = `position:fixed;inset:0;z-index:${Z_INDEX}`;
9654
9659
  const root = host.attachShadow({ mode: "open" });
9655
9660
  addStyle(root, VIEWPORT_CSS);
@@ -9676,9 +9681,9 @@ function open(veiled, first) {
9676
9681
  glass = document.createElement("div");
9677
9682
  glass.className = "glass";
9678
9683
  frame3 = document.createElement("iframe");
9679
- frame3.setAttribute(FRAME_ATTRIBUTE, "");
9684
+ setMark(frame3, FRAME_ATTRIBUTE);
9680
9685
  if (fresh())
9681
- frame3.setAttribute(FRESH_ATTRIBUTE, "");
9686
+ setMark(frame3, FRESH_ATTRIBUTE);
9682
9687
  frame3.name = FRAME_NAME;
9683
9688
  frame3.title = "knobs viewport";
9684
9689
  frame3.setAttribute("sandbox", SANDBOX);
@@ -25,7 +25,7 @@ import {
25
25
  turnOf,
26
26
  turnedPose,
27
27
  windowRect
28
- } from "./react-6ngtb6p9.js";
28
+ } from "./react-7eyps0cg.js";
29
29
  import {
30
30
  hush,
31
31
  hushOnce,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./react-97b5b8j4.js";
40
40
  import {
41
41
  copyText
42
- } from "./react-h9w04skh.js";
42
+ } from "./react-j87bdhhe.js";
43
43
  import {
44
44
  BARS_START,
45
45
  DOT_LOOK,
@@ -83,7 +83,7 @@ import {
83
83
  uaPreset,
84
84
  userAgentOf,
85
85
  viewportOf
86
- } from "./react-5h7pxnax.js";
86
+ } from "./react-tet7swk2.js";
87
87
  import {
88
88
  FRAME_ATTRIBUTE,
89
89
  FRAME_NAME,
@@ -125,11 +125,16 @@ import {
125
125
  turn,
126
126
  walkRules,
127
127
  wheelZoom
128
- } from "./react-0r5418av.js";
128
+ } from "./react-rbmk30xk.js";
129
129
  import"./react-fp73vhyd.js";
130
130
  import {
131
- __export
132
- } from "./react-t2qnewz2.js";
131
+ __export,
132
+ findOwn,
133
+ isMarked,
134
+ markOwn,
135
+ ownSelector,
136
+ setMark
137
+ } from "./react-4qn9vsjw.js";
133
138
 
134
139
  // src/engine/width.ts
135
140
  var exports_width = {};
@@ -4830,7 +4835,7 @@ function shootPage(frame2, glass, size, color, layout = "") {
4830
4835
  const draw = (node, alpha, lifted) => {
4831
4836
  if (seen++ > MOST || seen % 50 === 0 && performance.now() > deadline)
4832
4837
  return;
4833
- if (node.hasAttribute("data-devknobs"))
4838
+ if (isMarked(node))
4834
4839
  return;
4835
4840
  const style = view.getComputedStyle(node);
4836
4841
  if (style.display === "none")
@@ -5036,12 +5041,12 @@ ${own.join(`
5036
5041
  if (!node || !copy)
5037
5042
  continue;
5038
5043
  if (leave?.(node))
5039
- copy.setAttribute("data-devknobs", "");
5044
+ markOwn(copy);
5040
5045
  pin(node, copy);
5041
5046
  }
5042
5047
  }
5043
5048
  blankPictures(doc.documentElement, root);
5044
- for (const node of root.querySelectorAll("script, link, style, noscript, [data-devknobs]"))
5049
+ for (const node of root.querySelectorAll(`script, link, style, noscript, ${ownSelector()}`))
5045
5050
  node.remove();
5046
5051
  const style = inert.createElement("style");
5047
5052
  style.textContent = frozen.rules.join(`
@@ -5089,7 +5094,7 @@ async function paintPage(frame2, glass, size, color, copy) {
5089
5094
  const at = { x: (box2.left - screen.left) * css, y: (box2.top - screen.top) * css };
5090
5095
  let over2 = null;
5091
5096
  for (const node of doc.querySelectorAll(MEDIA)) {
5092
- const media = node.closest("[data-devknobs]") ? null : mediaOf(node);
5097
+ const media = node.closest(ownSelector()) ? null : mediaOf(node);
5093
5098
  const rect = node.getBoundingClientRect();
5094
5099
  if (!media || rect.bottom <= 0 || rect.top >= height || rect.width <= 0)
5095
5100
  continue;
@@ -8494,7 +8499,7 @@ var bodyObserver = null;
8494
8499
  function hide(node) {
8495
8500
  if (!(node instanceof HTMLElement || node instanceof SVGElement))
8496
8501
  return;
8497
- if (node.hasAttribute("data-devknobs") || hidden.has(node))
8502
+ if (isMarked(node) || hidden.has(node))
8498
8503
  return;
8499
8504
  const style = node.style;
8500
8505
  hidden.set(node, {
@@ -8525,7 +8530,7 @@ function holdModals() {
8525
8530
  const native = HTMLDialogElement.prototype.showModal;
8526
8531
  showModal = native;
8527
8532
  HTMLDialogElement.prototype.showModal = function() {
8528
- if (this.closest("[data-devknobs]"))
8533
+ if (this.closest(ownSelector()))
8529
8534
  native.call(this);
8530
8535
  else
8531
8536
  this.show();
@@ -8535,7 +8540,7 @@ function holdModals() {
8535
8540
  modals = Array.from(document.querySelectorAll("dialog:modal"));
8536
8541
  } catch {}
8537
8542
  for (const dialog of modals) {
8538
- if (dialog.closest("[data-devknobs]"))
8543
+ if (dialog.closest(ownSelector()))
8539
8544
  continue;
8540
8545
  dialog.close();
8541
8546
  dialog.show();
@@ -9092,7 +9097,7 @@ function showZoom(place2) {
9092
9097
  picker.value = String(zoom);
9093
9098
  }
9094
9099
  function panelWidth() {
9095
- return document.querySelector('[data-devknobs="panel"]')?.offsetWidth ?? 0;
9100
+ return findOwn(document, "panel")?.offsetWidth ?? 0;
9096
9101
  }
9097
9102
  function asideOf(panel) {
9098
9103
  return panel.open && !panel.docked ? panelWidth() : 0;
@@ -9525,7 +9530,7 @@ function hidePage() {
9525
9530
  covered = true;
9526
9531
  cover2(body);
9527
9532
  const style = ensureStyle(NAME);
9528
- style.textContent = "html{overflow:hidden!important}:popover-open:not([data-devknobs]){display:none!important}";
9533
+ style.textContent = `html{overflow:hidden!important}:popover-open:not(${ownSelector()}){display:none!important}`;
9529
9534
  const node = styleNode(style);
9530
9535
  if (node)
9531
9536
  stopKeepingStyle = keepMounted(node, { home: () => document.head ?? document.documentElement });
@@ -9650,7 +9655,7 @@ function open(veiled, first) {
9650
9655
  if (host || !needsFrame(current) || !body)
9651
9656
  return;
9652
9657
  host = document.createElement("div");
9653
- host.setAttribute("data-devknobs", "viewport");
9658
+ markOwn(host, "viewport");
9654
9659
  host.style.cssText = `position:fixed;inset:0;z-index:${Z_INDEX}`;
9655
9660
  const root = host.attachShadow({ mode: "open" });
9656
9661
  addStyle(root, VIEWPORT_CSS);
@@ -9677,9 +9682,9 @@ function open(veiled, first) {
9677
9682
  glass = document.createElement("div");
9678
9683
  glass.className = "glass";
9679
9684
  frame3 = document.createElement("iframe");
9680
- frame3.setAttribute(FRAME_ATTRIBUTE, "");
9685
+ setMark(frame3, FRAME_ATTRIBUTE);
9681
9686
  if (fresh())
9682
- frame3.setAttribute(FRESH_ATTRIBUTE, "");
9687
+ setMark(frame3, FRESH_ATTRIBUTE);
9683
9688
  frame3.name = FRAME_NAME;
9684
9689
  frame3.title = "knobs viewport";
9685
9690
  frame3.setAttribute("sandbox", SANDBOX);
@@ -1,4 +1,6 @@
1
1
  import type { GrabPayload } from "./types";
2
+ export declare const KNOBS_TYPE = "application/x-knobs-grab";
3
+ /** The type's old name, written beside it with the same payload until 1.0. */
2
4
  export declare const DEVKNOBS_TYPE = "application/x-devknobs-grab";
3
5
  /** react-grab's own type, which agents that paste from it already read. */
4
6
  export declare const REACT_GRAB_TYPE = "application/x-react-grab";
@@ -1,3 +1,11 @@
1
+ import {
2
+ ATTRIBUTES,
3
+ findOwn,
4
+ hasMark,
5
+ isMarked,
6
+ markOwn
7
+ } from "./index-3dcgysws.js";
8
+
1
9
  // src/engine/devices.ts
2
10
  var POSTURES = ["closed", "open"];
3
11
  function openOf(posture) {
@@ -1076,6 +1084,60 @@ function stamped(value, v) {
1076
1084
  return { v, ...value };
1077
1085
  }
1078
1086
 
1087
+ // src/engine/storekeys.ts
1088
+ var NAME = "knobs";
1089
+ var OLD_NAME = "devknobs";
1090
+ function oldKey(key) {
1091
+ if (key === NAME)
1092
+ return OLD_NAME;
1093
+ return key.startsWith(`${NAME}:`) ? `${OLD_NAME}${key.slice(NAME.length)}` : key;
1094
+ }
1095
+ function ownName(key) {
1096
+ if (key === NAME || key.startsWith(`${NAME}:`))
1097
+ return key;
1098
+ if (key === OLD_NAME)
1099
+ return NAME;
1100
+ return key.startsWith(`${OLD_NAME}:`) ? `${NAME}${key.slice(OLD_NAME.length)}` : null;
1101
+ }
1102
+ function isOwnKey(key) {
1103
+ return ownName(key) !== null;
1104
+ }
1105
+ function sameItem(eventKey, key) {
1106
+ return eventKey === key || eventKey === oldKey(key);
1107
+ }
1108
+ function readItem(storage, key) {
1109
+ if (!storage)
1110
+ return null;
1111
+ return storage.getItem(oldKey(key));
1112
+ }
1113
+ function writeItem(storage, key, value) {
1114
+ if (!storage)
1115
+ return;
1116
+ const old = oldKey(key);
1117
+ storage.setItem(old, value);
1118
+ if (old !== key)
1119
+ storage.setItem(key, value);
1120
+ }
1121
+ function removeItem(storage, key) {
1122
+ if (!storage)
1123
+ return;
1124
+ storage.removeItem(key);
1125
+ storage.removeItem(oldKey(key));
1126
+ }
1127
+ function itemKeys(storage, prefix) {
1128
+ const old = oldKey(prefix);
1129
+ const keys = [];
1130
+ for (let index = 0;index < storage.length; index++) {
1131
+ const key = storage.key(index);
1132
+ if (key === null || !key.startsWith(old))
1133
+ continue;
1134
+ const name = ownName(key) ?? key;
1135
+ if (name.startsWith(prefix))
1136
+ keys.push(name);
1137
+ }
1138
+ return keys;
1139
+ }
1140
+
1079
1141
  // src/engine/zoom.ts
1080
1142
  var ZOOM_PRESETS = [0.5, 0.75, 1, 1.25, 1.5];
1081
1143
  var ZOOM_MIN = 0.25;
@@ -1124,9 +1186,9 @@ function anchorScroll(pointer, scroll, before, after) {
1124
1186
  }
1125
1187
 
1126
1188
  // src/engine/store.ts
1127
- var STORAGE_KEY = "devknobs";
1189
+ var STORAGE_KEY = "knobs";
1128
1190
  var STATE_VERSION = 2;
1129
- var PLACE_KEY = "devknobs:place";
1191
+ var PLACE_KEY = "knobs:place";
1130
1192
  var PLACE_VERSION = 2;
1131
1193
  var DEFAULT_PINNED = ["device", "scheme", "text", "locale"];
1132
1194
  var PANEL_START = 128;
@@ -1385,7 +1447,7 @@ function merge(state, patch) {
1385
1447
  }
1386
1448
  function item(kind, key) {
1387
1449
  try {
1388
- return webStorage(kind)?.getItem(key) ?? null;
1450
+ return readItem(webStorage(kind), key);
1389
1451
  } catch {
1390
1452
  return null;
1391
1453
  }
@@ -1397,17 +1459,17 @@ function load() {
1397
1459
  function save(state) {
1398
1460
  try {
1399
1461
  const { realPhone: _, ...panel } = state.panel;
1400
- webStorage("session")?.setItem(STORAGE_KEY, JSON.stringify(stamped({ ...state, panel }, STATE_VERSION)));
1462
+ writeItem(webStorage("session"), STORAGE_KEY, JSON.stringify(stamped({ ...state, panel }, STATE_VERSION)));
1401
1463
  } catch {}
1402
1464
  }
1403
1465
  function keepPlace(state) {
1404
1466
  try {
1405
- webStorage("local")?.setItem(PLACE_KEY, placeText(state));
1467
+ writeItem(webStorage("local"), PLACE_KEY, placeText(state));
1406
1468
  } catch {}
1407
1469
  }
1408
1470
 
1409
1471
  // src/engine/frame.ts
1410
- var FRAME_ATTRIBUTE = "data-devknobs-frame";
1472
+ var FRAME_ATTRIBUTE = ATTRIBUTES.frame;
1411
1473
  var FRAME_NAME = "devknobs-frame";
1412
1474
  var SIZE_MIN = 120;
1413
1475
  var SIZE_MAX = 8192;
@@ -1429,7 +1491,8 @@ var KEY_ACTIONS = [
1429
1491
  ];
1430
1492
  function isDevknobsFrame() {
1431
1493
  try {
1432
- if (window.frameElement?.hasAttribute(FRAME_ATTRIBUTE))
1494
+ const owner = window.frameElement;
1495
+ if (owner && hasMark(owner, FRAME_ATTRIBUTE))
1433
1496
  return true;
1434
1497
  } catch {}
1435
1498
  return window.name === FRAME_NAME;
@@ -1565,23 +1628,24 @@ function post(target, message) {
1565
1628
  // src/engine/fresh.ts
1566
1629
  var FRESH_PARAM = "devknobs";
1567
1630
  var FRESH_VALUE = "fresh";
1568
- var FRESH_ATTRIBUTE = "data-devknobs-fresh";
1569
- var FRESH_RELOAD_KEY = "devknobs:fresh-reload";
1631
+ var KNOBS_FRESH_PARAM = "knobs";
1632
+ var FRESH_ATTRIBUTE = ATTRIBUTES.fresh;
1633
+ var FRESH_RELOAD_KEY = "knobs:fresh-reload";
1570
1634
  var FRESH_RELOAD_VERSION = 1;
1571
1635
  var FRESH_RELOAD_WINDOW = 1e4;
1572
- var KEPT = "devknobs:locale-";
1636
+ var KEPT = "knobs:locale-";
1573
1637
  var MODE = Symbol.for("devknobs.fresh");
1574
1638
  function freshIn(search) {
1575
1639
  try {
1576
- return new URLSearchParams(search).getAll(FRESH_PARAM).includes(FRESH_VALUE);
1640
+ const query = new URLSearchParams(search);
1641
+ return [KNOBS_FRESH_PARAM, FRESH_PARAM].some((name) => query.getAll(name).includes(FRESH_VALUE));
1577
1642
  } catch {
1578
1643
  return false;
1579
1644
  }
1580
1645
  }
1581
1646
  function wiped(key) {
1582
- if (key === FRESH_PARAM)
1583
- return true;
1584
- return key.startsWith(`${FRESH_PARAM}:`) && !key.startsWith(KEPT);
1647
+ const name = ownName(key);
1648
+ return name !== null && !name.startsWith(KEPT);
1585
1649
  }
1586
1650
  function reloadAt(text2) {
1587
1651
  if (!text2)
@@ -1599,8 +1663,8 @@ function reloadAt(text2) {
1599
1663
  function begin() {
1600
1664
  try {
1601
1665
  const session = window.sessionStorage;
1602
- const age = realNow() - reloadAt(session.getItem(FRESH_RELOAD_KEY));
1603
- session.removeItem(FRESH_RELOAD_KEY);
1666
+ const age = realNow() - reloadAt(readItem(session, FRESH_RELOAD_KEY));
1667
+ removeItem(session, FRESH_RELOAD_KEY);
1604
1668
  if (age >= 0 && age < FRESH_RELOAD_WINDOW)
1605
1669
  return;
1606
1670
  const keys = [];
@@ -1615,14 +1679,14 @@ function begin() {
1615
1679
  }
1616
1680
  function settle2() {
1617
1681
  try {
1618
- window.sessionStorage.removeItem(FRESH_RELOAD_KEY);
1682
+ removeItem(window.sessionStorage, FRESH_RELOAD_KEY);
1619
1683
  } catch {}
1620
1684
  }
1621
1685
  function framedFresh() {
1622
1686
  try {
1623
1687
  const owner = window.frameElement;
1624
1688
  if (owner)
1625
- return owner.hasAttribute(FRESH_ATTRIBUTE);
1689
+ return hasMark(owner, FRESH_ATTRIBUTE);
1626
1690
  } catch {}
1627
1691
  return window.name === FRAME_NAME && freshIn(window.location?.search ?? "");
1628
1692
  }
@@ -1688,7 +1752,7 @@ function ownReload() {
1688
1752
  return;
1689
1753
  try {
1690
1754
  const record2 = stamped({ at: realNow() }, FRESH_RELOAD_VERSION);
1691
- window.sessionStorage.setItem(FRESH_RELOAD_KEY, JSON.stringify(record2));
1755
+ writeItem(window.sessionStorage, FRESH_RELOAD_KEY, JSON.stringify(record2));
1692
1756
  } catch {}
1693
1757
  }
1694
1758
 
@@ -2119,13 +2183,13 @@ function watchSheets() {
2119
2183
  observer = new MutationObserver((records) => {
2120
2184
  for (const record2 of records) {
2121
2185
  const target = record2.target;
2122
- if (target.nodeName === "STYLE" && !target.hasAttribute("data-devknobs"))
2186
+ if (target.nodeName === "STYLE" && !isMarked(target))
2123
2187
  schedule();
2124
2188
  for (const node of Array.from(record2.addedNodes)) {
2125
2189
  const name = node.nodeName;
2126
2190
  if (name !== "STYLE" && name !== "LINK")
2127
2191
  continue;
2128
- if (node.hasAttribute?.("data-devknobs"))
2192
+ if (isMarked(node))
2129
2193
  continue;
2130
2194
  if (name === "LINK")
2131
2195
  node.addEventListener("load", schedule, { once: true });
@@ -2350,7 +2414,7 @@ function ensureObserver() {
2350
2414
  const name = node.nodeName;
2351
2415
  if (name !== "STYLE" && name !== "LINK")
2352
2416
  continue;
2353
- if (node.hasAttribute?.("data-devknobs"))
2417
+ if (isMarked(node))
2354
2418
  continue;
2355
2419
  if (name === "LINK")
2356
2420
  node.addEventListener("load", schedule2, { once: true });
@@ -2578,7 +2642,7 @@ function destroy() {
2578
2642
 
2579
2643
  // src/engine/style.ts
2580
2644
  var OWN2 = Symbol.for("devknobs.own");
2581
- var NAME = Symbol.for("devknobs.name");
2645
+ var NAME2 = Symbol.for("devknobs.name");
2582
2646
  var TEXT = Symbol.for("devknobs.text");
2583
2647
  var wrapped = new WeakMap;
2584
2648
  function isDocument(root) {
@@ -2625,7 +2689,7 @@ function adopt(root, Sheet, name) {
2625
2689
  const sheet = new Sheet;
2626
2690
  Reflect.set(sheet, OWN2, true);
2627
2691
  if (name !== undefined)
2628
- Reflect.set(sheet, NAME, name);
2692
+ Reflect.set(sheet, NAME2, name);
2629
2693
  root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
2630
2694
  return wrap(root, sheet);
2631
2695
  }
@@ -2667,7 +2731,7 @@ function switchedSheet(root, name) {
2667
2731
  };
2668
2732
  }
2669
2733
  const style = documentOf(root).createElement("style");
2670
- style.setAttribute("data-devknobs", name);
2734
+ markOwn(style, name);
2671
2735
  if (isDocument(root))
2672
2736
  (root.head ?? root.documentElement).appendChild(style);
2673
2737
  else
@@ -2690,8 +2754,8 @@ function switchedSheet(root, name) {
2690
2754
  };
2691
2755
  }
2692
2756
  function findStyle(name, doc = document) {
2693
- const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME) === name) : undefined;
2694
- return sheet ? wrap(doc, sheet) : doc.querySelector(`style[data-devknobs="${name}"]`);
2757
+ const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME2) === name) : undefined;
2758
+ return sheet ? wrap(doc, sheet) : findOwn(doc, name, "style");
2695
2759
  }
2696
2760
  function ensureStyle(name, doc = document) {
2697
2761
  const existing = findStyle(name, doc);
@@ -2701,7 +2765,7 @@ function ensureStyle(name, doc = document) {
2701
2765
  if (Sheet)
2702
2766
  return adopt(doc, Sheet, name);
2703
2767
  const style = doc.createElement("style");
2704
- style.setAttribute("data-devknobs", name);
2768
+ markOwn(style, name);
2705
2769
  (doc.head ?? doc.documentElement).appendChild(style);
2706
2770
  return style;
2707
2771
  }
@@ -2709,4 +2773,4 @@ function removeStyle(name, doc = document) {
2709
2773
  findStyle(name, doc)?.remove();
2710
2774
  }
2711
2775
 
2712
- export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, setSystemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, mentionsFeature, authoredQuery, walkRules, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };
2776
+ export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, isOwnKey, sameItem, readItem, writeItem, removeItem, itemKeys, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, setSystemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, mentionsFeature, authoredQuery, walkRules, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };