@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
@@ -5,7 +5,7 @@ import {
5
5
  cookieText,
6
6
  put,
7
7
  storedPresets
8
- } from "./index-k015tb6c.js";
8
+ } from "./index-trx7bxdk.js";
9
9
  import {
10
10
  branch,
11
11
  codeBlock,
@@ -27,17 +27,17 @@ import {
27
27
  textArea,
28
28
  textField,
29
29
  toolbar
30
- } from "./index-zvze25nf.js";
30
+ } from "./index-30fc6php.js";
31
31
  import {
32
32
  copyText
33
33
  } from "./index-ztnjefrh.js";
34
34
  import {
35
35
  icon
36
- } from "./index-33x9hxe3.js";
36
+ } from "./index-sxe5079a.js";
37
37
  import {
38
38
  stamped,
39
39
  webStorage
40
- } from "./index-5baxvd3v.js";
40
+ } from "./index-xjhwp5cj.js";
41
41
 
42
42
  // src/storage/site.ts
43
43
  function isOwn(key) {
@@ -6,7 +6,7 @@ import {
6
6
  cookieText,
7
7
  put,
8
8
  storedPresets
9
- } from "./react-eygws6cx.js";
9
+ } from "./react-sw8d8c94.js";
10
10
  import {
11
11
  branch,
12
12
  codeBlock,
@@ -28,17 +28,17 @@ import {
28
28
  textArea,
29
29
  textField,
30
30
  toolbar
31
- } from "./react-sq9pkw4k.js";
31
+ } from "./react-16spgn0h.js";
32
32
  import {
33
33
  copyText
34
34
  } from "./react-h9w04skh.js";
35
35
  import {
36
36
  icon
37
- } from "./react-qv0nykcv.js";
37
+ } from "./react-ayg1bgw3.js";
38
38
  import {
39
39
  stamped,
40
40
  webStorage
41
- } from "./react-carf84xv.js";
41
+ } from "./react-fm9y8dbn.js";
42
42
 
43
43
  // src/storage/site.ts
44
44
  function isOwn(key) {
package/dist/types.d.ts CHANGED
@@ -127,6 +127,11 @@ export interface UaValue {
127
127
  export type EdgeValue = "top" | "bottom" | "none";
128
128
  /** The edge of the window the panel lives on. */
129
129
  export type SideValue = "left" | "right";
130
+ /**
131
+ * The dev ribbon on the tab's icon: `auto` on a local host, such as
132
+ * localhost, `*.localhost` or a private network address, or always on or off.
133
+ */
134
+ export type DevIconValue = "auto" | "on" | "off";
130
135
  export interface PanelValue {
131
136
  open: boolean;
132
137
  /** The edge of the window the panel and its handle live on. */
@@ -149,6 +154,8 @@ export interface PanelValue {
149
154
  * `handle` option and the user's setting can still hide it.
150
155
  */
151
156
  handle: boolean;
157
+ /** The dev ribbon on the tab's icon, for this tab. */
158
+ devIcon: DevIconValue;
152
159
  /**
153
160
  * Ids of the rows set from the panel. Each stays in the list, back at its
154
161
  * default too, until a hold on its `×` takes it off. Reset all lists the default rows
@@ -2,13 +2,20 @@ import type { GrabControl } from "../grab/control";
2
2
  import { type LiveKeys } from "./bindings";
3
3
  import { type Keys } from "./keys";
4
4
  /**
5
- * The panel's footer: the overflow badge, the fresh mode note, the keys the
5
+ * The panel's footer: the overflow badge, the fresh mode note, which copy
6
+ * runs the panel where a host and the page each have one, the keys the
6
7
  * panel answers to, grab's and inspect's with them, each a control that does
7
8
  * what its key does, the pin that docks the panel to its side, with the two
8
9
  * controls a pinned panel has before it, and the way into the settings.
9
10
  */
10
11
  /** What the footer says while fresh mode is on, so a panel back at its defaults is no surprise. */
11
12
  export declare const FRESH_NOTE = "fresh mode: nothing is kept";
13
+ /**
14
+ * Which copy of devknobs runs the panel and its version, such as
15
+ * `extension 0.5.1` or `page 0.5.1-local.1767225600`: the footer says so where
16
+ * a host and a page can each run it.
17
+ */
18
+ export declare function runtimeLabel(host: boolean, version: string): string;
12
19
  /**
13
20
  * What the footer says about the overflow knob, such as `2 overflowing`.
14
21
  * Nothing while the knob is off, or before the count is known.
@@ -48,4 +55,4 @@ export interface Footer {
48
55
  */
49
56
  drawPin(docked: boolean): void;
50
57
  }
51
- export declare function createFooter(keys: LiveKeys, grab: GrabControl | null, mac: boolean, inspect?: GrabControl | null): Footer;
58
+ export declare function createFooter(keys: LiveKeys, grab: GrabControl | null, mac: boolean, inspect?: GrabControl | null, runtime?: string | null): Footer;
@@ -1,6 +1,7 @@
1
1
  import { type SystemMedia } from "../engine/system";
2
2
  import type { GrabControl } from "../grab/control";
3
3
  import type { InspectControl } from "../grab/inspect";
4
+ import type { PreferValue } from "../host";
4
5
  import { type LiveKeys } from "./bindings";
5
6
  export { wallInput } from "./catalog";
6
7
  export interface PanelOptions {
@@ -18,8 +19,19 @@ export interface PanelOptions {
18
19
  * user sets in the panel wins over it.
19
20
  */
20
21
  handle?: boolean;
22
+ /** Who runs the panel, the host or the page, where a host gives the choice. */
23
+ prefer?: PanelPrefer;
24
+ }
25
+ /** A host's choice of who runs the panel, as the settings and the footer show it. */
26
+ export interface PanelPrefer {
27
+ value(): PreferValue;
28
+ change(value: PreferValue): void;
29
+ /** The footer's name for the copy that runs, such as `extension 0.5.1`. */
30
+ runtime: string;
21
31
  }
22
32
  export interface Panel {
33
+ /** Show the host's choice of who runs the panel again, which changed. */
34
+ drawPrefer(): void;
23
35
  /** Take the panel off the page and drop every listener. */
24
36
  destroy(): void;
25
37
  }
@@ -28,9 +40,11 @@ export interface Panel {
28
40
  * the panel is doing, so it never takes a pointer: the stylesheet hands that
29
41
  * back to the handle and to a panel that is out, and every other pixel of the
30
42
  * box belongs to the page underneath. The side it lives on anchors it to the
31
- * left or the right edge.
43
+ * left or the right edge, and the other edges and its size stay `auto` until
44
+ * set, whatever a popover would give them. Its z-index puts it over the page and grab's boxes where
45
+ * the browser has no top layer for it.
32
46
  */
33
- export declare const HOST_STYLE = "position:fixed;top:0;z-index:2147483646;pointer-events:none";
47
+ export declare const HOST_STYLE = "position:fixed;top:0;right:auto;bottom:auto;left:auto;width:auto;height:auto;z-index:2147483647;pointer-events:none";
34
48
  /**
35
49
  * Build the panel, put it on the page and keep it in step with the engine. The
36
50
  * host carries an open shadow root, so the page cannot style the panel and the
@@ -1,4 +1,5 @@
1
1
  import type { GrabControl } from "../grab/control";
2
+ import { type PreferValue } from "../host";
2
3
  import { type LiveKeys } from "./bindings";
3
4
  import { type Binding, type Keys } from "./keys";
4
5
  import type { LivePrefs } from "./prefs";
@@ -6,7 +7,8 @@ import { type Tips } from "./tooltip";
6
7
  /**
7
8
  * The settings view, which slides in over the rows: whether the handle shows
8
9
  * while the panel is closed, the host's switch for its native driver where it
9
- * gives one, and each binding's key, recorded from the next
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
+ * key, recorded from the next
10
12
  * keys pressed. A key a binding cannot take is refused, and the chip says why.
11
13
  */
12
14
  /** What a binding's chip says while it has no key: its default went to another binding. */
@@ -38,6 +40,10 @@ export interface SettingsContext {
38
40
  handleShown(): boolean;
39
41
  /** Let the knobs show the handle, which an agent may have hidden. */
40
42
  showHandle(): void;
43
+ /** Whether the tab's icon has the dev ribbon. */
44
+ devIconShown(): boolean;
45
+ /** The user turned the dev ribbon on the tab's icon off or on. */
46
+ setDevIcon(on: boolean): void;
41
47
  /** The words of the host's switch for its native driver, null with none. */
42
48
  native: {
43
49
  label: string;
@@ -45,6 +51,12 @@ export interface SettingsContext {
45
51
  } | null;
46
52
  /** The user turned the native driver off or on. */
47
53
  setNative(on: boolean): void;
54
+ /** Whether the host or the page runs the panel, where a host gives the choice; null with none. */
55
+ prefer: {
56
+ value(): PreferValue;
57
+ } | null;
58
+ /** The user picked who runs the panel. */
59
+ setPrefer(value: PreferValue): void;
48
60
  /** Whether the search is open. */
49
61
  searching(): boolean;
50
62
  leaveSearch(): void;
@@ -58,8 +70,12 @@ export interface Settings {
58
70
  drawKeys(now: Keys): void;
59
71
  /** Show whether the handle shows while the panel is closed. */
60
72
  drawHandle(shown: boolean): void;
73
+ /** Show whether the tab's icon has the dev ribbon. */
74
+ drawDevIcon(shown: boolean): void;
61
75
  /** Show whether the native driver is on, and why it last went off or on in place of its hint. */
62
76
  drawNative(on: boolean, note: string | null): void;
77
+ /** Show who runs the panel, where a host gives the choice. */
78
+ drawPrefer(): void;
63
79
  /** Take a key for the binding that records, if one does, and say whether it did. */
64
80
  recordingKey(event: KeyboardEvent): boolean;
65
81
  stopRecording(): void;
@@ -0,0 +1,2 @@
1
+ /** The version this build was compiled with, or `source` when run from source. */
2
+ export declare const VERSION: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinena/knobs",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mert Düzgün",
@@ -38,10 +38,11 @@
38
38
  "./bezels/*": "./dist/bezels/*"
39
39
  },
40
40
  "scripts": {
41
- "build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
41
+ "build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
42
42
  "link": "bun scripts/link.ts link",
43
43
  "unlink": "bun scripts/link.ts unlink",
44
44
  "test": "bun test",
45
+ "toplayer": "node scripts/toplayer.ts",
45
46
  "typecheck": "tsc --noEmit"
46
47
  },
47
48
  "peerDependencies": {
@@ -114,7 +114,7 @@ await window.devknobs.ready();
114
114
  `window.devknobs.setState({ panel: { open: false, handle: false, docked: false } })`,
115
115
  then `await window.devknobs.ready()`. `reset()` keeps this. Patch only
116
116
  `open`, `docked` and `handle`. The other panel fields are the user's
117
- layout. `panel.handle` is your layer. The user's own "show handle" setting
117
+ layout and settings, such as `devIcon`, the DEV ribbon on the tab's icon. `panel.handle` is your layer. The user's own "show handle" setting
118
118
  can hide the handle too, and `getState()` does not show that setting.
119
119
  2. Take a screenshot, or read the DOM.
120
120
  3. A numeric width or height, a device, a numeric dpr, a vision other than
@@ -1,21 +0,0 @@
1
- /** The room at the end of the page, in px, which the page above sets. */
2
- export declare const VARIABLE = "--devknobs-end-room";
3
- /**
4
- * Edge to edge, the frame runs under Safari's bars, past the end of the
5
- * viewport the phone gives the page. There the page stops over the bars and
6
- * its background fills the rest, so the document gets that much room after
7
- * its end and its last content scrolls clear of them. A margin on the root
8
- * adds it and moves nothing: padding would shrink a border box root of a set
9
- * height and all in it, and a pseudo element or a spacer would be the page's
10
- * to style. The viewport paints the root's background there. A page that
11
- * scrolls a box of its own, or content that overflows a root of a set height,
12
- * gets none.
13
- */
14
- export declare const CSS = ":root{--devknobs-end-room:0px}html{margin-bottom:var(--devknobs-end-room)!important}";
15
- /**
16
- * Give the page in `doc` this much room after its end, from the page above
17
- * its frame, and say how much it had. Only the variable moves while there is
18
- * room, in the sheet and never on the root, which a page's own framework
19
- * checks. No room takes the sheet away, so nothing of the page is overridden.
20
- */
21
- export declare function give(doc: Document, room: number): number;