@vinena/knobs 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +7 -0
  3. package/dist/early.global.js +6 -6
  4. package/dist/{elementsview-jnkbhzkj.js → elementsview-2z4pkrdz.js} +4 -4
  5. package/dist/{elementsview-tf4qzmtw.js → elementsview-qn8qyksa.js} +4 -4
  6. package/dist/engine/browserdraw.d.ts +24 -2
  7. package/dist/engine/browserkit.d.ts +18 -1
  8. package/dist/engine/browserui.d.ts +162 -22
  9. package/dist/engine/devicon.d.ts +59 -0
  10. package/dist/engine/fit.d.ts +4 -3
  11. package/dist/engine/foldflip.d.ts +40 -0
  12. package/dist/engine/identity.d.ts +7 -4
  13. package/dist/engine/mock.d.ts +16 -0
  14. package/dist/engine/mockdata.d.ts +4 -1
  15. package/dist/engine/mockdraw.d.ts +14 -2
  16. package/dist/engine/pageshot.d.ts +5 -2
  17. package/dist/engine/safaridraw.d.ts +162 -10
  18. package/dist/engine/screen.d.ts +24 -0
  19. package/dist/engine/store.d.ts +2 -1
  20. package/dist/engine/tabicon.d.ts +43 -0
  21. package/dist/engine/toplayer.d.ts +62 -0
  22. package/dist/engine/touchpointer.d.ts +0 -21
  23. package/dist/engine/underbar.d.ts +61 -0
  24. package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
  25. package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
  26. package/dist/host.d.ts +51 -0
  27. package/dist/{index-zvze25nf.js → index-30fc6php.js} +1 -1
  28. package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
  29. package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
  30. package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
  31. package/dist/{index-ke6v7919.js → index-hv02xka3.js} +20 -8
  32. package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
  33. package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
  34. package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
  35. package/dist/{index-k015tb6c.js → index-trx7bxdk.js} +4 -4
  36. package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
  37. package/dist/index.d.ts +26 -1
  38. package/dist/index.global.js +270 -176
  39. package/dist/index.js +398 -124
  40. package/dist/instance.d.ts +23 -4
  41. package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
  42. package/dist/{react-sq9pkw4k.js → react-16spgn0h.js} +1 -1
  43. package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
  44. package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
  45. package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
  46. package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
  47. package/dist/{react-eygws6cx.js → react-sw8d8c94.js} +4 -4
  48. package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
  49. package/dist/react.js +394 -123
  50. package/dist/{storageview-vf8v8q8j.js → storageview-r595qpt9.js} +4 -4
  51. package/dist/{storageview-sb23henh.js → storageview-s7heg93p.js} +4 -4
  52. package/dist/types.d.ts +7 -0
  53. package/dist/ui/footer.d.ts +9 -2
  54. package/dist/ui/panel.d.ts +16 -2
  55. package/dist/ui/settings.d.ts +17 -1
  56. package/dist/version.d.ts +2 -0
  57. package/package.json +3 -2
  58. package/skills/devknobs/SKILL.md +1 -1
  59. package/dist/engine/endroom.d.ts +0 -21
package/dist/host.d.ts CHANGED
@@ -5,3 +5,54 @@ import type { MountOptions } from "./index";
5
5
  * Read field by field, as it comes from another copy, maybe of another version.
6
6
  */
7
7
  export declare function pageChoices(options: object): MountOptions;
8
+ /** Which copy runs the panel on a page that mounts its own: the extension's, or the page's. */
9
+ export type PreferValue = "extension" | "page";
10
+ /**
11
+ * A host's choice of who runs the panel where the page mounts its own copy,
12
+ * shown in the panel's settings. With `page`, the host steps aside for a page
13
+ * copy that can take the page from it: it takes its panel, frame and patches
14
+ * away and that copy mounts as on a page with no host.
15
+ */
16
+ export interface PreferSetting {
17
+ /** The choice as the mount begins. `setPrefer` brings a later one. */
18
+ value: PreferValue;
19
+ /** The user picked another in the settings: keep it for the next load. */
20
+ change: (value: PreferValue) => void;
21
+ /** The host let a copy of the page's have the page, and will not take it back. */
22
+ yielded?: () => void;
23
+ /** The choice as it is now, where it can change elsewhere, such as in another tab. */
24
+ now?: () => PreferValue;
25
+ }
26
+ /** What the settings say under the choice. */
27
+ export declare const PREFER_HINT = "page: a site's own knobs, say a local build, runs the panel where the site has one; real browser settings are off then";
28
+ /**
29
+ * A host's preference, as a page copy reads it from the host that handed the
30
+ * page over, field by field: it comes from another copy, maybe of another version.
31
+ */
32
+ export declare function preferOf(handed: object): PreferSetting | null;
33
+ /**
34
+ * Does a host step aside for a page copy? Only where the user prefers the
35
+ * page's and that copy left a way to take the page: older copies leave none.
36
+ */
37
+ export declare function stepsAside(prefer: PreferValue | null, take: unknown): boolean;
38
+ /** Does a host take the page back from a copy that took it? Not where the user prefers the page's. */
39
+ export declare function takesBack(prefer: PreferValue | null): boolean;
40
+ /** Which build of a host: the one a store ships, or a local one, such as an unpacked extension. */
41
+ export type HostBuild = "store" | "local";
42
+ /** A host's rank, on the host slot, so that where two hosts meet on a page, one holds it. */
43
+ export interface HostRank {
44
+ build: HostBuild;
45
+ /** Its version as its footer names it, such as `0.5.1` or `0.5.1 · local ios26-preview (9e966ae)`. */
46
+ version: string;
47
+ }
48
+ /** A host's rank as another copy reads it from the host slot, field by field. Null for an older host that leaves none. */
49
+ export declare function rankOf(host: object): HostRank | null;
50
+ /**
51
+ * Does host `a` outrank host `b`, so it holds the page where both meet? A
52
+ * local build outranks a store one, then the newer version, then the version
53
+ * as text, so the answer never depends on which came first. Any host with a
54
+ * rank outranks an older one that leaves none.
55
+ */
56
+ export declare function outranks(a: HostRank, b: HostRank | null): boolean;
57
+ /** What a host's footer says of a host that stood down for it, such as `store extension stood down`. */
58
+ export declare function stoodDownNote(other: HostRank | null): string;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  icon,
3
3
  radioMove
4
- } from "./index-33x9hxe3.js";
4
+ } from "./index-sxe5079a.js";
5
5
 
6
6
  // src/ui/dom.ts
7
7
  function el(tag, className, text) {
@@ -6,27 +6,30 @@ import {
6
6
  grabColor,
7
7
  isCLike,
8
8
  isElement
9
- } from "./index-2d6wvs8h.js";
9
+ } from "./index-dan2kpsd.js";
10
10
  import {
11
11
  quietFetch
12
- } from "./index-d0cjxjsm.js";
12
+ } from "./index-r72tz2vn.js";
13
13
  import {
14
14
  middle,
15
15
  shorthand,
16
16
  sizeText,
17
17
  tidy
18
- } from "./index-0casarhy.js";
18
+ } from "./index-agwr37gw.js";
19
19
  import"./index-78r0f8pw.js";
20
20
  import {
21
+ HOST_RESET,
22
+ LAYER,
21
23
  composedParent,
22
24
  getState,
23
25
  grabTargetAt,
26
+ holdInTopLayer,
24
27
  icon,
25
28
  isDevknobs,
26
29
  isGrabbable,
27
30
  pause,
28
31
  subscribe
29
- } from "./index-33x9hxe3.js";
32
+ } from "./index-sxe5079a.js";
30
33
  import {
31
34
  RINGS,
32
35
  addStyle,
@@ -46,7 +49,7 @@ import {
46
49
  ringQuads,
47
50
  systemMedia,
48
51
  watchSystemMedia
49
- } from "./index-5baxvd3v.js";
52
+ } from "./index-xjhwp5cj.js";
50
53
 
51
54
  // src/grab/preview.ts
52
55
  var ELEMENT_NODE = 1;
@@ -3717,7 +3720,14 @@ function createThemeReader() {
3717
3720
  }
3718
3721
 
3719
3722
  // src/grab/overlay.ts
3720
- var Z_INDEX = 2147483647;
3723
+ var Z_INDEX = 2147483646;
3724
+ var HOST_CSS = `
3725
+ :host([popover]) {
3726
+ inset: 0 !important;
3727
+ width: auto !important;
3728
+ height: auto !important;
3729
+ pointer-events: none !important;
3730
+ }`;
3721
3731
  var GAP = 6;
3722
3732
  var MARGIN = 8;
3723
3733
  var MIN_RADIUS = 2;
@@ -4037,9 +4047,9 @@ function place(node, shape, ratio) {
4037
4047
  function createOverlay(quiet = false, model = false) {
4038
4048
  const host = document.createElement("div");
4039
4049
  host.setAttribute("data-devknobs", "grab");
4040
- host.style.cssText = `position:fixed;inset:0;pointer-events:none;z-index:${Z_INDEX}`;
4050
+ host.style.cssText = `position:fixed;inset:0;width:auto;height:auto;pointer-events:none;z-index:${Z_INDEX}`;
4041
4051
  const root = host.attachShadow({ mode: "open" });
4042
- addStyle(root, CSS2);
4052
+ addStyle(root, HOST_RESET + HOST_CSS + CSS2);
4043
4053
  const layer = document.createElement("div");
4044
4054
  layer.className = "layer";
4045
4055
  const glow = document.createElement("div");
@@ -4098,6 +4108,7 @@ function createOverlay(quiet = false, model = false) {
4098
4108
  layer.append(glow, glide, tip);
4099
4109
  root.append(layer);
4100
4110
  (document.body ?? document.documentElement).append(host);
4111
+ const hold = holdInTopLayer(host, LAYER.overlay);
4101
4112
  const reduce = baseMatchMedia("(prefers-reduced-motion: reduce)");
4102
4113
  let reduced = reduce.matches;
4103
4114
  const radii = new WeakMap;
@@ -4383,6 +4394,7 @@ ${card.write(said, rows)}` : key;
4383
4394
  reduce.removeEventListener("change", still);
4384
4395
  stopSystem();
4385
4396
  stopColor();
4397
+ hold.release();
4386
4398
  host.remove();
4387
4399
  }
4388
4400
  const stopSystem = watchSystemMedia(still);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SIDES,
3
3
  pxOf
4
- } from "./index-5baxvd3v.js";
4
+ } from "./index-xjhwp5cj.js";
5
5
 
6
6
  // src/styles/varrefs.ts
7
7
  var SPACE = /\s/;
@@ -8,7 +8,7 @@ import {
8
8
  subscribe,
9
9
  typesInField,
10
10
  withShift
11
- } from "./index-33x9hxe3.js";
11
+ } from "./index-sxe5079a.js";
12
12
  import {
13
13
  __require,
14
14
  addStyle,
@@ -17,7 +17,7 @@ import {
17
17
  post,
18
18
  readMessage,
19
19
  systemMedia
20
- } from "./index-5baxvd3v.js";
20
+ } from "./index-xjhwp5cj.js";
21
21
 
22
22
  // src/grab/keys.ts
23
23
  var HOLD = 100;
@@ -159,7 +159,7 @@ function systemScheme() {
159
159
  host.remove();
160
160
  return dark ? "dark" : "light";
161
161
  }
162
- function createGrab(options = {}, loadMode = () => import("./index-dvr4x91q.js")) {
162
+ function createGrab(options = {}, loadMode = () => import("./index-9re7sv56.js")) {
163
163
  const keyNow = options.key ?? defaultGrabKey;
164
164
  const { purpose } = options;
165
165
  const channel = purpose?.channel ?? "grab";
@@ -368,7 +368,7 @@ function held(view) {
368
368
  return null;
369
369
  }
370
370
  }
371
- function createInspect(options = {}, load = () => import("./index-dvr4x91q.js"), frameOf = frameWindow) {
371
+ function createInspect(options = {}, load = () => import("./index-9re7sv56.js"), frameOf = frameWindow) {
372
372
  const inFrame = isDevknobsFrame();
373
373
  const listeners = new Set;
374
374
  let outliner = null;
@@ -7,27 +7,30 @@ import {
7
7
  grabColor,
8
8
  isCLike,
9
9
  isElement
10
- } from "./react-71a9ypex.js";
10
+ } from "./react-zy1mmhgz.js";
11
11
  import {
12
12
  quietFetch
13
- } from "./react-65tgdbs8.js";
13
+ } from "./react-4pvp6amm.js";
14
14
  import {
15
15
  middle,
16
16
  shorthand,
17
17
  sizeText,
18
18
  tidy
19
- } from "./react-pdvseef0.js";
19
+ } from "./react-05jh9jv5.js";
20
20
  import"./react-adky72h9.js";
21
21
  import {
22
+ HOST_RESET,
23
+ LAYER,
22
24
  composedParent,
23
25
  getState,
24
26
  grabTargetAt,
27
+ holdInTopLayer,
25
28
  icon,
26
29
  isDevknobs,
27
30
  isGrabbable,
28
31
  pause,
29
32
  subscribe
30
- } from "./react-qv0nykcv.js";
33
+ } from "./react-ayg1bgw3.js";
31
34
  import {
32
35
  RINGS,
33
36
  addStyle,
@@ -47,7 +50,7 @@ import {
47
50
  ringQuads,
48
51
  systemMedia,
49
52
  watchSystemMedia
50
- } from "./react-carf84xv.js";
53
+ } from "./react-fm9y8dbn.js";
51
54
 
52
55
  // src/grab/preview.ts
53
56
  var ELEMENT_NODE = 1;
@@ -3718,7 +3721,14 @@ function createThemeReader() {
3718
3721
  }
3719
3722
 
3720
3723
  // src/grab/overlay.ts
3721
- var Z_INDEX = 2147483647;
3724
+ var Z_INDEX = 2147483646;
3725
+ var HOST_CSS = `
3726
+ :host([popover]) {
3727
+ inset: 0 !important;
3728
+ width: auto !important;
3729
+ height: auto !important;
3730
+ pointer-events: none !important;
3731
+ }`;
3722
3732
  var GAP = 6;
3723
3733
  var MARGIN = 8;
3724
3734
  var MIN_RADIUS = 2;
@@ -4038,9 +4048,9 @@ function place(node, shape, ratio) {
4038
4048
  function createOverlay(quiet = false, model = false) {
4039
4049
  const host = document.createElement("div");
4040
4050
  host.setAttribute("data-devknobs", "grab");
4041
- host.style.cssText = `position:fixed;inset:0;pointer-events:none;z-index:${Z_INDEX}`;
4051
+ host.style.cssText = `position:fixed;inset:0;width:auto;height:auto;pointer-events:none;z-index:${Z_INDEX}`;
4042
4052
  const root = host.attachShadow({ mode: "open" });
4043
- addStyle(root, CSS2);
4053
+ addStyle(root, HOST_RESET + HOST_CSS + CSS2);
4044
4054
  const layer = document.createElement("div");
4045
4055
  layer.className = "layer";
4046
4056
  const glow = document.createElement("div");
@@ -4099,6 +4109,7 @@ function createOverlay(quiet = false, model = false) {
4099
4109
  layer.append(glow, glide, tip);
4100
4110
  root.append(layer);
4101
4111
  (document.body ?? document.documentElement).append(host);
4112
+ const hold = holdInTopLayer(host, LAYER.overlay);
4102
4113
  const reduce = baseMatchMedia("(prefers-reduced-motion: reduce)");
4103
4114
  let reduced = reduce.matches;
4104
4115
  const radii = new WeakMap;
@@ -4384,6 +4395,7 @@ ${card.write(said, rows)}` : key;
4384
4395
  reduce.removeEventListener("change", still);
4385
4396
  stopSystem();
4386
4397
  stopColor();
4398
+ hold.release();
4387
4399
  host.remove();
4388
4400
  }
4389
4401
  const stopSystem = watchSystemMedia(still);
@@ -2,7 +2,7 @@ import {
2
2
  deviceOf,
3
3
  formOf,
4
4
  needsFrame
5
- } from "./index-5baxvd3v.js";
5
+ } from "./index-xjhwp5cj.js";
6
6
 
7
7
  // src/engine/morph.ts
8
8
  var MORPH_TIME = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  QUIET,
3
3
  shared
4
- } from "./index-5baxvd3v.js";
4
+ } from "./index-xjhwp5cj.js";
5
5
 
6
6
  // src/requests/quiet.ts
7
7
  function quietFetch(url, init) {