@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
@@ -20,7 +20,7 @@ export declare const NOT_COPIED = "could not copy";
20
20
  /** Copies a text, and says whether it went, at once or once the clipboard answers. */
21
21
  export type Copy = (text: string) => boolean | Promise<boolean>;
22
22
  /** What the line under the buttons says, for agents that run code in the page. */
23
- export declare const AGENT_NOTE = "agents read and apply edits: devknobs.edits() / setEdits()";
23
+ export declare const AGENT_NOTE = "agents read and apply edits: knobs.edits() / setEdits()";
24
24
  /** What the line about edits made again as the page loaded says. */
25
25
  export declare function keptLine(kept: number, missed: number): string;
26
26
  /** What the line over the kept edits that wait says: how many html and attribute edits, and the edits after them. */
@@ -4,7 +4,7 @@ import type { CustomColor } from "../types";
4
4
  * them across reloads and in new tabs of the origin. Reset all leaves them,
5
5
  * and fresh mode starts with none and keeps none.
6
6
  */
7
- export declare const COLORS_KEY = "devknobs:colors";
7
+ export declare const COLORS_KEY = "knobs:colors";
8
8
  /** The version of the colors `COLORS_KEY` keeps. Bump it with a new shape, see stored.ts. */
9
9
  export declare const COLORS_VERSION = 1;
10
10
  /** The most colors of the user's own a knob lists. One more takes the oldest off. */
@@ -1,8 +1,8 @@
1
- import type { DevknobsState } from "../types";
1
+ import type { KnobsState } from "../types";
2
2
  import type { Knob } from "./catalog";
3
3
  export declare const DEVICE: Knob;
4
4
  /** Does the device in use have a mock to draw? */
5
- export declare function hasMock(state: DevknobsState): boolean;
5
+ export declare function hasMock(state: KnobsState): boolean;
6
6
  export declare const MOCK: Knob;
7
7
  export declare const TOUCH_POINTER: Knob;
8
8
  export declare const BROWSER: Knob;
@@ -1,4 +1,4 @@
1
- import type { DevknobsState, DevknobsStatePatch } from "../types";
1
+ import type { KnobsState, KnobsStatePatch } from "../types";
2
2
  import { type Knob, type Option, type Row, type RowId } from "./catalog";
3
3
  import { type Tips } from "./tooltip";
4
4
  /**
@@ -7,9 +7,9 @@ import { type Tips } from "./tooltip";
7
7
  * Each control comes with an update that keeps it in step with the knobs.
8
8
  */
9
9
  /** What an editor control keeps in step with the knobs. */
10
- export type Update = (state: DevknobsState) => void;
10
+ export type Update = (state: KnobsState) => void;
11
11
  /** Set knobs from the panel. Their row stays listed from here on. */
12
- export declare function commit(row: RowId, patch: DevknobsStatePatch): void;
12
+ export declare function commit(row: RowId, patch: KnobsStatePatch): void;
13
13
  export declare function set(knob: Knob, value: string): void;
14
14
  /** What the editors need from the panel. */
15
15
  export interface EditorsContext {
@@ -1,4 +1,4 @@
1
- import type { DevknobsState, PostureValue } from "../types";
1
+ import type { KnobsState, PostureValue } from "../types";
2
2
  /**
3
3
  * A slider that folds a foldable open and shut by hand, as the one on Apple's
4
4
  * iPhone Duo page does. Experimental: it may go again. The thumb follows the
@@ -40,7 +40,7 @@ export declare function foldChip(posture: PostureValue): {
40
40
  };
41
41
  export interface FoldSlider {
42
42
  node: HTMLElement;
43
- update(state: DevknobsState): void;
43
+ update(state: KnobsState): void;
44
44
  /** Stop listening to the fold and the hinge. */
45
45
  destroy(): void;
46
46
  }
package/dist/ui/keys.d.ts CHANGED
@@ -59,7 +59,7 @@ export declare function defaultKeys(options?: {
59
59
  * Marks the panel's own field where the shift letters are the panel's keys
60
60
  * and not text. Its search is one: it finds in lower case anyway.
61
61
  */
62
- export declare const KEYS_FIELD = "data-devknobs-keys";
62
+ export declare const KEYS_FIELD: "data-devknobs-keys";
63
63
  /** Whether a key goes into any field, one of the panel's too, its search included. */
64
64
  export declare function inField(event: Pick<KeyLike, "target" | "composedPath">): boolean;
65
65
  /**
package/dist/ui/list.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DevknobsState, DevknobsStatePatch } from "../types";
1
+ import type { KnobsState, KnobsStatePatch } from "../types";
2
2
  import { type Knob, type Live, type Row, type RowId } from "./catalog";
3
3
  /**
4
4
  * Which rows the panel lists, and what they say. A row is listed while a knob
@@ -16,9 +16,9 @@ import { type Knob, type Live, type Row, type RowId } from "./catalog";
16
16
  * or dragged to, then the rest in the catalog's, so a row listed for being off
17
17
  * its default stands at the end.
18
18
  */
19
- export declare function rowOrder(state: DevknobsState): RowId[];
19
+ export declare function rowOrder(state: KnobsState): RowId[];
20
20
  /** The rows listed, in the order they stand. */
21
- export declare function listedOrder(state: DevknobsState): RowId[];
21
+ export declare function listedOrder(state: KnobsState): RowId[];
22
22
  /** A list with the item at `from` taken out and put back at `to`, both held inside it. */
23
23
  export declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
24
24
  /**
@@ -34,27 +34,27 @@ export declare function arrange<T>(items: readonly T[], wanted: readonly T[], ke
34
34
  * as it then stands, so a row listed only for being off its default is
35
35
  * pinned where it was put.
36
36
  */
37
- export declare function movePatch(state: DevknobsState, from: number, to: number): DevknobsStatePatch;
37
+ export declare function movePatch(state: KnobsState, from: number, to: number): KnobsStatePatch;
38
38
  /** The patch that sets knobs from the panel and pins their row. */
39
- export declare function pinPatch(state: DevknobsState, id: RowId, patch: DevknobsStatePatch): DevknobsStatePatch;
39
+ export declare function pinPatch(state: KnobsState, id: RowId, patch: KnobsStatePatch): KnobsStatePatch;
40
40
  /**
41
41
  * The patch a click on a row's `×` sends: its knobs back to their defaults,
42
42
  * and the row pinned, so it stays listed. A value another knob brought stays,
43
43
  * so the viewport's `×` leaves a device its size.
44
44
  */
45
- export declare function resetRowPatch(state: DevknobsState, row: Row): DevknobsStatePatch;
45
+ export declare function resetRowPatch(state: KnobsState, row: Row): KnobsStatePatch;
46
46
  /**
47
47
  * The patch a hold on a row's `×` sends: its knobs back as a click puts them,
48
48
  * and the row off the list.
49
49
  */
50
- export declare function removePatch(state: DevknobsState, row: Row): DevknobsStatePatch;
50
+ export declare function removePatch(state: KnobsState, row: Row): KnobsStatePatch;
51
51
  /**
52
52
  * Would reset all change nothing: every knob at its default, and the default
53
53
  * rows listed alone, in their order? An id no row has here, such as one an
54
54
  * older or a newer version kept, is not listed and counts for nothing.
55
55
  */
56
- export declare function isReset(state: DevknobsState): boolean;
57
- export declare function isListed(row: Row, state: DevknobsState): boolean;
56
+ export declare function isReset(state: KnobsState): boolean;
57
+ export declare function isListed(row: Row, state: KnobsState): boolean;
58
58
  /**
59
59
  * Whether a knob shows its label over its control. A knob named as its row is
60
60
  * already named by the row's title, so the label would only say it again.
@@ -65,4 +65,4 @@ export declare function showsLabel(row: Row, knob: Knob): boolean;
65
65
  * back at. An action's says what it emulates, else whether its mode is on,
66
66
  * and nothing with no mode.
67
67
  */
68
- export declare function rowText(row: Row, state: DevknobsState, live: Live): string;
68
+ export declare function rowText(row: Row, state: KnobsState, live: Live): string;
@@ -1,4 +1,4 @@
1
- import type { DevknobsState } from "../types";
1
+ import type { KnobsState } from "../types";
2
2
  import { type Action } from "./catalog";
3
3
  import type { Rows } from "./rows";
4
4
  import type { Slide } from "./slide";
@@ -49,7 +49,7 @@ export interface Palette {
49
49
  searching(): boolean;
50
50
  /** Stop browsing and drop the query, without drawing anything. */
51
51
  clear(): void;
52
- renderBody(state: DevknobsState): void;
52
+ renderBody(state: KnobsState): void;
53
53
  leaveSearch(): void;
54
54
  startBrowsing(text?: string): void;
55
55
  onGrab(on: boolean): void;
package/dist/ui/pin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DevknobsStatePatch, PanelValue } from "../types";
1
+ import type { KnobsStatePatch, PanelValue } from "../types";
2
2
  import type { Action } from "./catalog";
3
3
  /**
4
4
  * Pinning the panel to its side, as devtools dock: the control in the footer
@@ -6,7 +6,7 @@ import type { Action } from "./catalog";
6
6
  * controls a pinned panel shows beside it.
7
7
  */
8
8
  /** The patch that pins a floating panel and lets a pinned one float. Nothing else of it changes. */
9
- export declare function pinPatch(panel: Pick<PanelValue, "docked">): DevknobsStatePatch;
9
+ export declare function pinPatch(panel: Pick<PanelValue, "docked">): KnobsStatePatch;
10
10
  /**
11
11
  * Pin the panel, or let it float again, and keep that for new tabs, as it is
12
12
  * a move the user made.
@@ -2,7 +2,7 @@
2
2
  * Where the panel's preferences the user set are kept, in `localStorage`, so
3
3
  * they hold across reloads and in new tabs of the origin. Reset all leaves them.
4
4
  */
5
- export declare const PREFS_KEY = "devknobs:prefs";
5
+ export declare const PREFS_KEY = "knobs:prefs";
6
6
  /** The version of the preferences `PREFS_KEY` keeps. Bump it with a new shape, see stored.ts. */
7
7
  export declare const PREFS_VERSION = 6;
8
8
  /** How the styles view shows an element: what applies to it, or every rule in cascade order. */
package/dist/ui/rows.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DevknobsState } from "../types";
1
+ import type { KnobsState } from "../types";
2
2
  import { type Knob, type Live, type Row, type RowId } from "./catalog";
3
3
  import { type Update } from "./editors";
4
4
  import type { Keys } from "./keys";
@@ -59,9 +59,9 @@ export interface Rows {
59
59
  focusCustom(knob: Knob): void;
60
60
  showRow(id: RowId, knob: Knob): void;
61
61
  /** Draw the rows for a state, and say whether any shows. */
62
- renderRows(state: DevknobsState, live: Live): boolean;
62
+ renderRows(state: KnobsState, live: Live): boolean;
63
63
  /** Draw the readouts that run with the clock. */
64
- tick(state: DevknobsState, live: Live): void;
64
+ tick(state: KnobsState, live: Live): void;
65
65
  /** Show the keys in force on the actions' rows. */
66
66
  drawKeys(now: Keys): void;
67
67
  /** Whether a row is being dragged by its grip. */
@@ -35,8 +35,8 @@ export declare const POLL_MS = 1000;
35
35
  export declare const FOLD_MS = 200;
36
36
  /** What a node says where its store cannot be read. Why is in its tooltip. */
37
37
  export declare const NOT_READ = "cannot read";
38
- /** What the presets' node stands under in the tree: they are devknobs' own, and not the page's. */
39
- export declare const OWN_GROUP = "devknobs";
38
+ /** What the presets' node stands under in the tree: they are knobs' own, and not the page's. */
39
+ export declare const OWN_GROUP = "knobs";
40
40
  /** The keys nodes under a store are remembered by. */
41
41
  export declare function databaseKey(name: string): string;
42
42
  export declare function storeKey(database: string, store: string): string;
@@ -35,7 +35,7 @@ import type { Locate } from "../edit/source";
35
35
  import { inspect, invalidate } from "../styles";
36
36
  import { type Forcing } from "../styles/force";
37
37
  import type { BoxRing } from "../grab/boxmodel";
38
- import type { DevknobsState } from "../types";
38
+ import type { KnobsState } from "../types";
39
39
  import { type BoxReading } from "./boxdiagram";
40
40
  import type { HtmlSize, StylesMode } from "./prefs";
41
41
  import type { Tips } from "./tooltip";
@@ -111,8 +111,8 @@ export interface StylesContext {
111
111
  export interface StylesPage {
112
112
  inspect: typeof inspect;
113
113
  invalidate: typeof invalidate;
114
- getState(): DevknobsState;
115
- subscribe(listener: (state: DevknobsState) => void): () => void;
114
+ getState(): KnobsState;
115
+ subscribe(listener: (state: KnobsState) => void): () => void;
116
116
  /** The browser's word on whether a text is a color. */
117
117
  isColor(text: string): boolean;
118
118
  /** The element's box, or null where it has none to read. */
@@ -1,4 +1,4 @@
1
- import type { DevknobsState } from "../types";
1
+ import type { KnobsState } from "../types";
2
2
  import type { Knob } from "./catalog";
3
3
  import { type LiveColors } from "./colors";
4
4
  /**
@@ -23,4 +23,4 @@ export interface SwatchesContext {
23
23
  /** Say no to what a control was given, and why. */
24
24
  refuse(node: HTMLElement, reason: string): void;
25
25
  }
26
- export declare function swatchList(knob: Knob, context: SwatchesContext): [HTMLElement, (state: DevknobsState) => void];
26
+ export declare function swatchList(knob: Knob, context: SwatchesContext): [HTMLElement, (state: KnobsState) => void];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinena/knobs",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mert Düzgün",
@@ -17,13 +17,13 @@ knobs README (`node_modules/@vinena/knobs/README.md`).
17
17
  Check that knobs is mounted:
18
18
 
19
19
  ```js
20
- await window.devknobs.ready();
20
+ await window.knobs.ready();
21
21
  ```
22
22
 
23
- Every way of mounting knobs puts the api on `window.devknobs`: the script
24
- tag, `mount()` and `<DevKnobs />`. Inside the width knob's frame the frame's own
25
- copy has it too. If `window.devknobs` is undefined, knobs is not on this
26
- page. The script tag build keeps the api after `unmount()`, so the api alone
23
+ Every way of mounting knobs puts the api on `window.knobs`: the script
24
+ tag, `mount()` and `<Knobs />`. Inside the width knob's frame the frame's own
25
+ copy has it too. If neither `window.knobs` nor `window.devknobs` is set, knobs is not on this
26
+ page. Where `window.knobs` is not knobs' api (the page has a `knobs` of its own, or knobs is older than 0.7.1, such as an extension not yet on 0.7.1), use `window.devknobs`, which every copy sets. The script tag build keeps the api after `unmount()`, so the api alone
27
27
  does not prove a mount. `ready()` does: it rejects at once with
28
28
  `knobs: not mounted` when nothing is mounted.
29
29
 
@@ -31,21 +31,22 @@ Then note the panel as the user left it. Keep the result in your notes, as a
31
31
  later evaluate or a reload loses page variables:
32
32
 
33
33
  ```js
34
- JSON.stringify(window.devknobs.getState().panel);
34
+ JSON.stringify(window.knobs.getState().panel);
35
35
  ```
36
36
 
37
37
  This note comes from the tab's `sessionStorage`, so it is the user's layout
38
38
  only in a fresh tab. In a tab an earlier agent may have used, also read
39
39
  `localStorage.getItem("devknobs:place")`. It holds the place the user last
40
40
  gave the panel (`side`, `y`, `top`, `edge`, `tab`, `docked`). Use those fields
41
- over the ones in the note.
41
+ over the ones in the note. knobs 0.7.1 writes `knobs:place` too, with the same value. A later
42
+ release reads `knobs:place` instead.
42
43
 
43
44
  ## Learn the knobs
44
45
 
45
46
  Call `describe()` first. Never guess a key or a value.
46
47
 
47
48
  ```js
48
- window.devknobs.describe();
49
+ window.knobs.describe();
49
50
  ```
50
51
 
51
52
  It returns one entry per knob:
@@ -74,12 +75,12 @@ as `grabColor` and the panel's place. Do not compare the two key for key.
74
75
  without a numeric width and height, and `posture` without a device that
75
76
  folds. Compare `getState()` with what you set.
76
77
  2. Wait for it to apply:
77
- - `reload` is `none` or `frame`: `await window.devknobs.ready()`.
78
+ - `reload` is `none` or `frame`: `await window.knobs.ready()`.
78
79
  - `reload` is `page`: the page may reload, or it may not. knobs skips a
79
80
  reload that comes less than 5 seconds after the last one. Call
80
- `await window.devknobs.ready()` either way. If the page navigates
81
+ `await window.knobs.ready()` either way. If the page navigates
81
82
  instead, wait for the load in your browser tool and call
82
- `await window.devknobs.ready()` on the new page. A `ready()` from the old
83
+ `await window.knobs.ready()` on the new page. A `ready()` from the old
83
84
  page never settles. In Playwright or a DevTools tool, the reload ends the
84
85
  evaluate with an error such as `Execution context was destroyed` or
85
86
  `Inspected target navigated or closed`. That error is the expected sign
@@ -96,23 +97,23 @@ To leave a device, call `reset()` or set
96
97
  stays up.
97
98
 
98
99
  ```js
99
- window.devknobs.setState({ scheme: "dark", motion: "reduce" });
100
- await window.devknobs.ready();
100
+ window.knobs.setState({ scheme: "dark", motion: "reduce" });
101
+ await window.knobs.ready();
101
102
  ```
102
103
 
103
104
  ```js
104
- window.devknobs.setState({ device: "iphone-17", locale: { lang: "ar", dir: "rtl" } });
105
- await window.devknobs.ready();
105
+ window.knobs.setState({ device: "iphone-17", locale: { lang: "ar", dir: "rtl" } });
106
+ await window.knobs.ready();
106
107
  // If the page navigates, the evaluate ends with it. Wait for the load, then on the new page:
107
- await window.devknobs.ready();
108
+ await window.knobs.ready();
108
109
  ```
109
110
 
110
111
  ## Check the page
111
112
 
112
113
  1. Close the panel, hide its handle and unpin it, so it stays out of
113
114
  screenshots and out of the page's width, then wait for it to slide away:
114
- `window.devknobs.setState({ panel: { open: false, handle: false, docked: false } })`,
115
- then `await window.devknobs.ready()`. `reset()` keeps this. Patch only
115
+ `window.knobs.setState({ panel: { open: false, handle: false, docked: false } })`,
116
+ then `await window.knobs.ready()`. `reset()` keeps this. Patch only
116
117
  `open`, `docked` and `handle`. The other panel fields are the user's
117
118
  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
119
  can hide the handle too, and `getState()` does not show that setting.
@@ -126,14 +127,14 @@ await window.devknobs.ready();
126
127
 
127
128
  ```js
128
129
  const frame = document
129
- .querySelector('[data-devknobs="viewport"]')
130
- ?.shadowRoot?.querySelector("iframe[data-devknobs-frame]");
130
+ .querySelector('[data-knobs="viewport"]')
131
+ ?.shadowRoot?.querySelector("iframe[data-knobs-frame]");
131
132
  await frame?.contentWindow?.devknobs?.ready();
132
133
  frame?.contentDocument;
133
134
  ```
134
135
 
135
136
  Read the DOM there. The page in the frame runs its own knobs, so call
136
- `grab` on `frame.contentWindow.devknobs` for elements in the frame. The top
137
+ `grab` on `frame.contentWindow.knobs` for elements in the frame. The top
137
138
  page's `grab` on such an element gives component names with no file or line.
138
139
  After `ready()` the frame's knobs is there if the app mounts knobs on
139
140
  that page.
@@ -143,7 +144,7 @@ await window.devknobs.ready();
143
144
  For an element that looks wrong, call `grab`:
144
145
 
145
146
  ```js
146
- const payload = await window.devknobs.grab(document.querySelector("h1"));
147
+ const payload = await window.knobs.grab(document.querySelector("h1"));
147
148
  payload?.content;
148
149
  ```
149
150
 
@@ -166,7 +167,7 @@ such as a `querySelector` that found nothing, and returns `null` when nothing
166
167
  is left or the elements give nothing.
167
168
 
168
169
  After a fix, reload the page. The knobs stay set across reloads. Call
169
- `await window.devknobs.ready()` and check again.
170
+ `await window.knobs.ready()` and check again.
170
171
 
171
172
  ## Apply the user's edits
172
173
 
@@ -174,7 +175,7 @@ The user can edit styles and the html in inspect's view (`⇧C`) and ask you
174
175
  to put them in the code. Read them:
175
176
 
176
177
  ```js
177
- window.devknobs.edits();
178
+ window.knobs.edits();
178
179
  ```
179
180
 
180
181
  Each edit is plain json: `kind` (`css-value`, `css-toggle`, `css-add` or
@@ -223,14 +224,14 @@ save the list and make it again:
223
224
 
224
225
  ```js
225
226
  // Read the list into your own context (the result of the evaluate call): a reload clears the page's variables.
226
- JSON.stringify(window.devknobs.edits());
227
+ JSON.stringify(window.knobs.edits());
227
228
  ```
228
229
 
229
230
  It comes back as a JSON string. Reload the page, then parse it and pass it back in:
230
231
 
231
232
  ```js
232
- const { applied, skipped } = await window.devknobs.setEdits(JSON.parse(JSON_YOU_KEPT));
233
- window.devknobs.undoEdit(); // undoes the last edit in force, returns it or null
233
+ const { applied, skipped } = await window.knobs.setEdits(JSON.parse(JSON_YOU_KEPT));
234
+ window.knobs.undoEdit(); // undoes the last edit in force, returns it or null
234
235
  ```
235
236
 
236
237
  `setEdits` makes each edit only where its element is found by its selector
@@ -251,9 +252,9 @@ wait for the user's click on `apply` in the panel.
251
252
  To see or screenshot a state the pointer or the keyboard would give, force it:
252
253
 
253
254
  ```js
254
- window.devknobs.forceState(".cta", ["hover"]); // or "focus", "focus-visible", "active", "focus-within"
255
+ window.knobs.forceState(".cta", ["hover"]); // or "focus", "focus-visible", "active", "focus-within"
255
256
  // screenshot, then:
256
- window.devknobs.forceState(null);
257
+ window.knobs.forceState(null);
257
258
  ```
258
259
 
259
260
  It takes an element or a selector, returns the states forced, and is no edit.
@@ -279,8 +280,8 @@ const conditions = [
279
280
 
280
281
  For each condition:
281
282
 
282
- 1. `window.devknobs.reset()`.
283
- 2. `window.devknobs.setState(condition)`. The panel stays as you set it in
283
+ 1. `window.knobs.reset()`.
284
+ 2. `window.knobs.setState(condition)`. The panel stays as you set it in
284
285
  "Check the page".
285
286
  3. Wait as in "Set a condition".
286
287
  4. Screenshot or read the DOM. Note what breaks.
@@ -296,10 +297,10 @@ changes data values, such as numbers and names. That is not a bug.
296
297
  Put the knobs back, and the panel as you noted it at the start:
297
298
 
298
299
  ```js
299
- window.devknobs.forceState(null); // a state you forced; reset() leaves it
300
- window.devknobs.reset();
301
- window.devknobs.setState({ panel: NOTED_PANEL }); // the panel json you noted
302
- await window.devknobs.ready();
300
+ window.knobs.forceState(null); // a state you forced; reset() leaves it
301
+ window.knobs.reset();
302
+ window.knobs.setState({ panel: NOTED_PANEL }); // the panel json you noted
303
+ await window.knobs.ready();
303
304
  ```
304
305
 
305
306
  The knobs are kept in `sessionStorage` and stay set across reloads in the tab
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __returnValue = (v) => v;
3
- function __exportSetter(name, newValue) {
4
- this[name] = __returnValue.bind(null, newValue);
5
- }
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true,
11
- configurable: true,
12
- set: __exportSetter.bind(all, name)
13
- });
14
- };
15
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
16
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
17
- }) : x)(function(x) {
18
- if (typeof require !== "undefined")
19
- return require.apply(this, arguments);
20
- throw Error('Dynamic require of "' + x + '" is not supported');
21
- });
22
-
23
- export { __export, __require };
@@ -1,24 +0,0 @@
1
- "use client";
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
17
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
18
- }) : x)(function(x) {
19
- if (typeof require !== "undefined")
20
- return require.apply(this, arguments);
21
- throw Error('Dynamic require of "' + x + '" is not supported');
22
- });
23
-
24
- export { __export, __require };